@@ -57,62 +57,62 @@ namespace ipxp
5757
5858int connect_to_exporter (const char *path)
5959{
60- int sd ;
60+ int fd ;
6161 struct sockaddr_un addr;
6262
6363 memset (&addr, 0 , sizeof (addr));
6464 addr.sun_family = AF_UNIX;
6565 snprintf (addr.sun_path , sizeof (addr.sun_path ) - 1 , " %s" , path);
6666
67- sd = socket (AF_UNIX, SOCK_STREAM, 0 );
68- if (sd != -1 ) {
69- if (connect (sd , (struct sockaddr *) &addr, sizeof (addr)) == -1 ) {
67+ fd = socket (AF_UNIX, SOCK_STREAM, 0 );
68+ if (fd != -1 ) {
69+ if (connect (fd , (struct sockaddr *) &addr, sizeof (addr)) == -1 ) {
7070 perror (" unable to connect" );
71- close (sd );
71+ close (fd );
7272 return -1 ;
7373 }
7474 }
75- return sd ;
75+ return fd ;
7676}
7777
7878int create_stats_sock (const char *path)
7979{
80- int sd ;
80+ int fd ;
8181 struct sockaddr_un addr;
8282
8383 addr.sun_family = AF_UNIX;
8484 snprintf (addr.sun_path , sizeof (addr.sun_path ) - 1 , " %s" , path);
8585
8686 unlink (addr.sun_path );
87- sd = socket (AF_UNIX, SOCK_STREAM, 0 );
88- if (sd ) {
89- if (bind (sd , (struct sockaddr *) &addr, sizeof (addr)) == -1 ) {
87+ fd = socket (AF_UNIX, SOCK_STREAM, 0 );
88+ if (fd ) {
89+ if (bind (fd , (struct sockaddr *) &addr, sizeof (addr)) == -1 ) {
9090 perror (" unable to bind socket" );
91- close (sd );
91+ close (fd );
9292 return -1 ;
9393 }
94- if (listen (sd , 1 ) == -1 ) {
94+ if (listen (fd , 1 ) == -1 ) {
9595 perror (" unable to listen on socket" );
96- close (sd );
96+ close (fd );
9797 return -1 ;
9898 }
9999 if (chmod (addr.sun_path , S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) == -1 ) {
100100 perror (" unable to set access rights" );
101- close (sd );
101+ close (fd );
102102 return -1 ;
103103 }
104104 }
105- return sd ;
105+ return fd ;
106106}
107107
108- int recv_data (int sd , uint32_t size, void *data)
108+ int recv_data (int fd , uint32_t size, void *data)
109109{
110110 size_t num_of_timeouts = 0 ;
111111 size_t total_received = 0 ;
112112 ssize_t last_received = 0 ;
113113
114114 while (total_received < size) {
115- last_received = recv (sd , (uint8_t *) data + total_received, size - total_received, MSG_DONTWAIT);
115+ last_received = recv (fd , (uint8_t *) data + total_received, size - total_received, MSG_DONTWAIT);
116116 if (last_received == 0 ) {
117117 return -1 ;
118118 } else if (last_received == -1 ) {
@@ -132,14 +132,14 @@ int recv_data(int sd, uint32_t size, void *data)
132132 return 0 ;
133133}
134134
135- int send_data (int sd , uint32_t size, void *data)
135+ int send_data (int fd , uint32_t size, void *data)
136136{
137137 size_t num_of_timeouts = 0 ;
138138 size_t total_sent = 0 ;
139139 ssize_t last_sent = 0 ;
140140
141141 while (total_sent < size) {
142- last_sent = send (sd , (uint8_t *) data + total_sent, size - total_sent, MSG_DONTWAIT);
142+ last_sent = send (fd , (uint8_t *) data + total_sent, size - total_sent, MSG_DONTWAIT);
143143 if (last_sent == -1 ) {
144144 if (errno == EAGAIN || errno == EWOULDBLOCK) {
145145 num_of_timeouts++;
0 commit comments