commit 13c7235b018c40bf5c042d1e3aac294dccf225df Author: David Goulet dgoulet@ev0ke.net Date: Tue Feb 18 17:51:59 2014 +0000
Fix: remove all variables with double underscore
Signed-off-by: David Goulet dgoulet@ev0ke.net --- src/lib/close.c | 6 ++-- src/lib/connect.c | 19 +++++----- src/lib/getaddrinfo.c | 22 ++++++------ src/lib/gethostbyname.c | 92 +++++++++++++++++++++++------------------------ src/lib/getpeername.c | 4 +-- src/lib/recv.c | 16 ++++----- src/lib/socket.c | 10 +++--- src/lib/socketpair.c | 8 ++--- src/lib/syscall.c | 20 +++++------ src/lib/torsocks.h | 92 +++++++++++++++++++++++------------------------ 10 files changed, 144 insertions(+), 145 deletions(-)
diff --git a/src/lib/close.c b/src/lib/close.c index b8a6364..d774c85 100644 --- a/src/lib/close.c +++ b/src/lib/close.c @@ -30,10 +30,10 @@ LIBC_CLOSE_RET_TYPE tsocks_close(LIBC_CLOSE_SIG) { struct connection *conn;
- DBG("Close catched for fd %d", __fd); + DBG("Close catched for fd %d", fd);
connection_registry_lock(); - conn = connection_find(__fd); + conn = connection_find(fd); if (conn) { /* * Remove from the registry so it's not visible anymore and thus using @@ -53,7 +53,7 @@ LIBC_CLOSE_RET_TYPE tsocks_close(LIBC_CLOSE_SIG) }
/* Return the original libc close. */ - return tsocks_libc_close(__fd); + return tsocks_libc_close(fd); }
/* diff --git a/src/lib/connect.c b/src/lib/connect.c index 8f34e37..bb15882 100644 --- a/src/lib/connect.c +++ b/src/lib/connect.c @@ -40,18 +40,17 @@ LIBC_CONNECT_RET_TYPE tsocks_connect(LIBC_CONNECT_SIG) struct onion_entry *on_entry; struct sockaddr_in *inet_addr;
- DBG("Connect catched on fd %d", __sockfd); + DBG("Connect catched on fd %d", sockfd);
optlen = sizeof(sock_type); - ret = getsockopt(__sockfd, SOL_SOCKET, SO_TYPE, &sock_type, &optlen); + ret = getsockopt(sockfd, SOL_SOCKET, SO_TYPE, &sock_type, &optlen); if (ret < 0) { /* Use the getsockopt() errno value. */ goto error; }
/* We can't handle a non inet socket. */ - if (__addr->sa_family != AF_INET && - __addr->sa_family != AF_INET6) { + if (addr->sa_family != AF_INET && addr->sa_family != AF_INET6) { DBG("[conect] Connection is not IPv4/v6. Ignoring."); goto libc_connect; } @@ -67,9 +66,9 @@ LIBC_CONNECT_RET_TYPE tsocks_connect(LIBC_CONNECT_SIG) }
DBG("[connect] Socket family %s and type %d", - __addr->sa_family == AF_INET ? "AF_INET" : "AF_INET6", sock_type); + addr->sa_family == AF_INET ? "AF_INET" : "AF_INET6", sock_type);
- inet_addr = (struct sockaddr_in *) __addr; + inet_addr = (struct sockaddr_in *) addr;
/* * Lock registry to get the connection reference if one. In this code path, @@ -78,7 +77,7 @@ LIBC_CONNECT_RET_TYPE tsocks_connect(LIBC_CONNECT_SIG) * quickly unlocked and no reference is needed. */ connection_registry_lock(); - new_conn = connection_find(__sockfd); + new_conn = connection_find(sockfd); connection_registry_unlock(); if (new_conn) { /* Double connect() for the same fd. */ @@ -99,7 +98,7 @@ LIBC_CONNECT_RET_TYPE tsocks_connect(LIBC_CONNECT_SIG) * Create a connection without a destination address since we will set * the onion address name found before. */ - new_conn = connection_create(__sockfd, NULL); + new_conn = connection_create(sockfd, NULL); if (!new_conn) { errno = ENOMEM; goto error; @@ -112,7 +111,7 @@ LIBC_CONNECT_RET_TYPE tsocks_connect(LIBC_CONNECT_SIG) * Check if address is localhost. At this point, we are sure it's not a * .onion cookie address that is by default in the loopback network. */ - if (utils_sockaddr_is_localhost(__addr)) { + if (utils_sockaddr_is_localhost(addr)) { WARN("[connect] Connection to a local address are denied since it " "might be a TCP DNS query to a local DNS server. " "Rejecting it for safety reasons."); @@ -120,7 +119,7 @@ LIBC_CONNECT_RET_TYPE tsocks_connect(LIBC_CONNECT_SIG) goto error; }
- new_conn = connection_create(__sockfd, __addr); + new_conn = connection_create(sockfd, addr); if (!new_conn) { errno = ENOMEM; goto error; diff --git a/src/lib/getaddrinfo.c b/src/lib/getaddrinfo.c index c93cd42..a0f5595 100644 --- a/src/lib/getaddrinfo.c +++ b/src/lib/getaddrinfo.c @@ -39,17 +39,17 @@ LIBC_GETADDRINFO_RET_TYPE tsocks_getaddrinfo(LIBC_GETADDRINFO_SIG) void *addr; char *ip_str, ipv4[INET_ADDRSTRLEN], ipv6[INET6_ADDRSTRLEN]; socklen_t ip_str_size; - const char *node; + const char *tmp_node;
- DBG("[getaddrinfo] Requesting %s hostname", __node); + DBG("[getaddrinfo] Requesting %s hostname", node);
- if (!__node) { + if (!node) { ret = EAI_NONAME; goto error; }
/* Use right domain for the next step. */ - switch (__hints->ai_family) { + switch (hints->ai_family) { default: /* Default value is to use IPv4. */ case AF_INET: @@ -66,24 +66,24 @@ LIBC_GETADDRINFO_RET_TYPE tsocks_getaddrinfo(LIBC_GETADDRINFO_SIG) break; }
- ret = inet_pton(af, __node, addr); + ret = inet_pton(af, node, addr); if (ret == 0) { /* The node most probably is a DNS name. */ - ret = tsocks_tor_resolve(__node, (uint32_t *) addr); + ret = tsocks_tor_resolve(node, (uint32_t *) addr); if (ret < 0) { ret = EAI_FAIL; goto error; }
(void) inet_ntop(af, addr, ip_str, ip_str_size); - node = ip_str; - DBG("[getaddrinfo] Node %s resolved to %s", __node, node); + tmp_node = ip_str; + DBG("[getaddrinfo] Node %s resolved to %s", node,tmp_node); } else { - node = __node; - DBG("[getaddrinfo] Node %s will be passed to the libc call", node); + tmp_node = node; + DBG("[getaddrinfo] Node %s will be passed to the libc call", tmp_node); }
- ret = tsocks_libc_getaddrinfo(node, __service, __hints, __res); + ret = tsocks_libc_getaddrinfo(tmp_node, service, hints, res); if (ret) { goto error; } diff --git a/src/lib/gethostbyname.c b/src/lib/gethostbyname.c index 9ba5cee..1b9d00e 100644 --- a/src/lib/gethostbyname.c +++ b/src/lib/gethostbyname.c @@ -64,15 +64,15 @@ LIBC_GETHOSTBYNAME_RET_TYPE tsocks_gethostbyname(LIBC_GETHOSTBYNAME_SIG) int ret; uint32_t ip;
- DBG("[gethostbyname] Requesting %s hostname", __name); + DBG("[gethostbyname] Requesting %s hostname", name);
- if (!__name) { + if (!name) { h_errno = HOST_NOT_FOUND; goto error; }
/* Resolve the given hostname through Tor. */ - ret = tsocks_tor_resolve(__name, &ip); + ret = tsocks_tor_resolve(name, &ip); if (ret < 0) { goto error; } @@ -88,13 +88,13 @@ LIBC_GETHOSTBYNAME_RET_TYPE tsocks_gethostbyname(LIBC_GETHOSTBYNAME_SIG) tsocks_he_addr_list[0] = tsocks_he_addr; tsocks_he_addr_list[1] = NULL;
- tsocks_he.h_name = (char *) __name; + tsocks_he.h_name = (char *) name; tsocks_he.h_aliases = NULL; tsocks_he.h_length = sizeof(in_addr_t); tsocks_he.h_addrtype = AF_INET; tsocks_he.h_addr_list = tsocks_he_addr_list;
- DBG("Hostname %s resolved to %s", __name, + DBG("Hostname %s resolved to %s", name, inet_ntoa(*((struct in_addr *) &ip)));
errno = 0; @@ -124,12 +124,12 @@ LIBC_GETHOSTBYNAME2_RET_TYPE tsocks_gethostbyname2(LIBC_GETHOSTBYNAME2_SIG) * For now, there is no way of resolving a domain name to IPv6 through Tor * so only accept INET request thus using the original gethostbyname(). */ - if (__af != AF_INET) { + if (af != AF_INET) { h_errno = HOST_NOT_FOUND; return NULL; }
- return tsocks_gethostbyname(__name); + return tsocks_gethostbyname(name); }
/* @@ -155,24 +155,24 @@ LIBC_GETHOSTBYADDR_RET_TYPE tsocks_gethostbyaddr(LIBC_GETHOSTBYADDR_SIG) * Tor does not allow to resolve to an IPv6 pointer so only accept inet * return address. */ - if (!__addr || __type != AF_INET) { + if (!addr || type != AF_INET) { h_errno = HOST_NOT_FOUND; goto error; }
DBG("[gethostbyaddr] Requesting address %s of len %d and type %d", - inet_ntoa(*((struct in_addr *) __addr)), __len, __type); + inet_ntoa(*((struct in_addr *) addr)), len, type);
/* Reset static host entry of tsocks. */ memset(&tsocks_he, 0, sizeof(tsocks_he)); memset(tsocks_he_addr_list, 0, sizeof(tsocks_he_addr_list)); memset(tsocks_he_name, 0, sizeof(tsocks_he_name));
- ret = tsocks_tor_resolve_ptr(__addr, &hostname, __type); + ret = tsocks_tor_resolve_ptr(addr, &hostname, type); if (ret < 0) { const char *ret_str;
- ret_str = inet_ntop(__type, __addr, tsocks_he_name, + ret_str = inet_ntop(type, addr, tsocks_he_name, sizeof(tsocks_he_name)); if (!ret_str) { h_errno = HOST_NOT_FOUND; @@ -181,13 +181,13 @@ LIBC_GETHOSTBYADDR_RET_TYPE tsocks_gethostbyaddr(LIBC_GETHOSTBYADDR_SIG) } else { memcpy(tsocks_he_name, hostname, sizeof(tsocks_he_name)); free(hostname); - tsocks_he_addr_list[0] = (char *) __addr; + tsocks_he_addr_list[0] = (char *) addr; }
tsocks_he.h_name = tsocks_he_name; tsocks_he.h_aliases = NULL; tsocks_he.h_length = strlen(tsocks_he_name); - tsocks_he.h_addrtype = __type; + tsocks_he.h_addrtype = type; tsocks_he.h_addr_list = tsocks_he_addr_list;
errno = 0; @@ -221,53 +221,53 @@ LIBC_GETHOSTBYADDR_R_RET_TYPE tsocks_gethostbyaddr_r(LIBC_GETHOSTBYADDR_R_SIG) char padding[]; } *data;
- if (__buflen < sizeof(struct data)) { + if (buflen < sizeof(struct data)) { ret = ERANGE; goto error; } - data = (struct data *) __buf; + data = (struct data *) buf; memset(data, 0, sizeof(*data));
/* * Tor does not allow to resolve to an IPv6 pointer so only accept inet * return address. */ - if (!__addr || __type != AF_INET) { + if (!addr || type != AF_INET) { ret = HOST_NOT_FOUND; - if (__h_errnop) { - *__h_errnop = HOST_NOT_FOUND; + if (h_errnop) { + *h_errnop = HOST_NOT_FOUND; } goto error; }
DBG("[gethostbyaddr_r] Requesting address %s of len %d and type %d", - inet_ntoa(*((struct in_addr *) __addr)), __len, __type); + inet_ntoa(*((struct in_addr *) addr)), len, type);
/* This call allocates hostname. On error, it's untouched. */ - ret = tsocks_tor_resolve_ptr(__addr, &data->hostname, __type); + ret = tsocks_tor_resolve_ptr(addr, &data->hostname, type); if (ret < 0) { const char *ret_str;
- ret_str = inet_ntop(__type, __addr, __buf, __buflen); + ret_str = inet_ntop(type, addr, buf, buflen); if (!ret_str) { ret = HOST_NOT_FOUND; if (errno == ENOSPC) { ret = ERANGE; } - if (__h_errnop) { - *__h_errnop = HOST_NOT_FOUND; + if (h_errnop) { + *h_errnop = HOST_NOT_FOUND; } goto error; } }
/* Ease our life a bit. */ - he = __ret; + he = hret;
if (!he) { ret = NO_RECOVERY; - if (__h_errnop) { - *__h_errnop = NO_RECOVERY; + if (h_errnop) { + *h_errnop = NO_RECOVERY; } goto error; } @@ -276,8 +276,8 @@ LIBC_GETHOSTBYADDR_R_RET_TYPE tsocks_gethostbyaddr_r(LIBC_GETHOSTBYADDR_R_SIG) he->h_name = data->hostname; } else { ret = NO_RECOVERY; - if (__h_errnop) { - *__h_errnop = NO_RECOVERY; + if (h_errnop) { + *h_errnop = NO_RECOVERY; } goto error; } @@ -285,12 +285,12 @@ LIBC_GETHOSTBYADDR_R_RET_TYPE tsocks_gethostbyaddr_r(LIBC_GETHOSTBYADDR_R_SIG) he->h_aliases = NULL; he->h_length = strlen(he->h_name); /* Assign the address list within the data of the given buffer. */ - data->addr_list[0] = (char *) __addr; + data->addr_list[0] = (char *) addr; data->addr_list[1] = NULL; he->h_addr_list = data->addr_list;
- if (__result) { - *__result = he; + if (result) { + *result = he; }
/* Everything went good. */ @@ -327,34 +327,34 @@ LIBC_GETHOSTBYNAME_R_RET_TYPE tsocks_gethostbyname_r(LIBC_GETHOSTBYNAME_R_SIG) char padding[]; } *data;
- DBG("[gethostbyname_r] Requesting %s hostname", __name); + DBG("[gethostbyname_r] Requesting %s hostname", name);
- if (!__name) { - *__h_errnop = HOST_NOT_FOUND; + if (!name) { + *h_errnop = HOST_NOT_FOUND; ret = -1; goto error; }
- if (__buflen < sizeof(*data)) { + if (buflen < sizeof(*data)) { ret = ERANGE; goto error; }
/* Resolve the given hostname through Tor. */ - ret = tsocks_tor_resolve(__name, &ip); + ret = tsocks_tor_resolve(name, &ip); if (ret < 0) { goto error; }
- data = (struct data *) __buf; + data = (struct data *) buf; memset(data, 0, sizeof(*data)); /* Ease our life a bit. */ - he = __ret; + he = hret;
ret_str = inet_ntop(AF_INET, &ip, data->addr, sizeof(data->addr)); if (!ret_str) { PERROR("inet_ntop"); - *__h_errnop = NO_ADDRESS; + *h_errnop = NO_ADDRESS; goto error; }
@@ -363,12 +363,12 @@ LIBC_GETHOSTBYNAME_R_RET_TYPE tsocks_gethostbyname_r(LIBC_GETHOSTBYNAME_R_SIG) data->addr_list[1] = NULL; he->h_addr_list = data->addr_list;
- he->h_name = (char *) __name; + he->h_name = (char *) name; he->h_aliases = NULL; he->h_length = sizeof(in_addr_t); he->h_addrtype = AF_INET;
- DBG("[gethostbyname_r] Hostname %s resolved to %s", __name, + DBG("[gethostbyname_r] Hostname %s resolved to %s", name, inet_ntoa(*((struct in_addr *) &ip)));
error: @@ -390,19 +390,19 @@ LIBC_GETHOSTBYNAME_R_DECL */ LIBC_GETHOSTBYNAME2_R_RET_TYPE tsocks_gethostbyname2_r(LIBC_GETHOSTBYNAME2_R_SIG) { - DBG("[gethostbyname2_r] Requesting %s hostname", __name); + DBG("[gethostbyname2_r] Requesting %s hostname", name);
/* * For now, there is no way of resolving a domain name to IPv6 through Tor * so only accept INET request thus using the original gethostbyname(). */ - if (__af != AF_INET) { - *__h_errnop = HOST_NOT_FOUND; + if (af != AF_INET) { + *h_errnop = HOST_NOT_FOUND; return -1; }
- return tsocks_gethostbyname_r(__name, __ret, __buf, __buflen, __result, - __h_errnop); + return tsocks_gethostbyname_r(name, hret, buf, buflen, result, + h_errnop); }
/* diff --git a/src/lib/getpeername.c b/src/lib/getpeername.c index 0b0ad9b..607c1b1 100644 --- a/src/lib/getpeername.c +++ b/src/lib/getpeername.c @@ -34,10 +34,10 @@ LIBC_GETPEERNAME_RET_TYPE tsocks_getpeername(LIBC_GETPEERNAME_SIG) int ret = 0; struct connection *conn;
- DBG("[getpeername] Requesting address on socket %d", __sockfd); + DBG("[getpeername] Requesting address on socket %d", sockfd);
connection_registry_lock(); - conn = connection_find(__sockfd); + conn = connection_find(sockfd); if (!conn) { errno = ENOTCONN; ret = -1; diff --git a/src/lib/recv.c b/src/lib/recv.c index 11b2e7b..b041f6d 100644 --- a/src/lib/recv.c +++ b/src/lib/recv.c @@ -39,24 +39,24 @@ LIBC_RECVMSG_RET_TYPE tsocks_recvmsg(LIBC_RECVMSG_SIG) char dummy, recv_fd[CMSG_SPACE(sizeof(fd))]; struct iovec iov[1]; struct cmsghdr *cmsg; - struct msghdr msg; + struct msghdr msg_hdr;
- memset(&msg, 0, sizeof(msg)); + memset(&msg_hdr, 0, sizeof(msg_hdr));
/* Prepare to receive the structures */ iov[0].iov_base = &dummy; iov[0].iov_len = 1; - msg.msg_iov = iov; - msg.msg_iovlen = 1; - msg.msg_control = recv_fd; - msg.msg_controllen = sizeof(recv_fd); + msg_hdr.msg_iov = iov; + msg_hdr.msg_iovlen = 1; + msg_hdr.msg_control = recv_fd; + msg_hdr.msg_controllen = sizeof(recv_fd);
do { /* Just peek the data to inspect the payload for fd. */ - ret = tsocks_libc_recvmsg(__sockfd, &msg, MSG_PEEK); + ret = tsocks_libc_recvmsg(sockfd, &msg_hdr, MSG_PEEK); } while (ret < 0 && errno == EINTR);
- cmsg = CMSG_FIRSTHDR(&msg); + cmsg = CMSG_FIRSTHDR(&msg_hdr); if (!cmsg) { goto end; } diff --git a/src/lib/socket.c b/src/lib/socket.c index 2a50c3e..cae47ec 100644 --- a/src/lib/socket.c +++ b/src/lib/socket.c @@ -30,11 +30,11 @@ TSOCKS_LIBC_DECL(socket, LIBC_SOCKET_RET_TYPE, LIBC_SOCKET_SIG) LIBC_SOCKET_RET_TYPE tsocks_socket(LIBC_SOCKET_SIG) { DBG("[socket] Creating socket with domain %d, type %d and protocol %d", - __domain, __type, __protocol); + domain, type, protocol);
- switch (__type) { + switch (type) { case SOCK_STREAM: - if (__domain == AF_INET6) { + if (domain == AF_INET6) { /* Tor does not handle IPv6 at the moment. Reject it. */ ERR("Socket is IPv6. Tor does not handle AF_INET6 connection."); errno = EINVAL; @@ -42,7 +42,7 @@ LIBC_SOCKET_RET_TYPE tsocks_socket(LIBC_SOCKET_SIG) } break; default: - if (__domain == AF_INET || __domain == AF_INET6) { + if (domain == AF_INET || domain == AF_INET6) { /* * Print this message only in debug mode. Very often, applications * uses the libc to do DNS resolution which first tries with UDP @@ -60,7 +60,7 @@ LIBC_SOCKET_RET_TYPE tsocks_socket(LIBC_SOCKET_SIG) }
/* Stream socket for INET/INET6 is good so open it. */ - return tsocks_libc_socket(__domain, __type, __protocol); + return tsocks_libc_socket(domain, type, protocol); }
/* diff --git a/src/lib/socketpair.c b/src/lib/socketpair.c index 8889410..a358124 100644 --- a/src/lib/socketpair.c +++ b/src/lib/socketpair.c @@ -30,13 +30,13 @@ TSOCKS_LIBC_DECL(socketpair, LIBC_SOCKETPAIR_RET_TYPE, LIBC_SOCKETPAIR_SIG) LIBC_SOCKETPAIR_RET_TYPE tsocks_socketpair(LIBC_SOCKETPAIR_SIG) { DBG("[socketpair] Creating socket with domain %d, type %d and protocol %d", - __domain, __type, __protocol); + domain, type, protocol);
- switch (__type) { + switch (type) { case SOCK_STREAM: break; default: - if (__domain == AF_INET || __domain == AF_INET6) { + if (domain == AF_INET || domain == AF_INET6) { ERR("Non TCP socketpair denied. Tor network can't handle it. " "Stopping everything!"); errno = EINVAL; @@ -46,7 +46,7 @@ LIBC_SOCKETPAIR_RET_TYPE tsocks_socketpair(LIBC_SOCKETPAIR_SIG) }
/* Stream socket for INET/INET6 is good so open it. */ - return tsocks_libc_socketpair(__domain, __type, __protocol, __sv); + return tsocks_libc_socketpair(domain, type, protocol, sv); }
/* diff --git a/src/lib/syscall.c b/src/lib/syscall.c index adc433b..2539855 100644 --- a/src/lib/syscall.c +++ b/src/lib/syscall.c @@ -107,11 +107,11 @@ static LIBC_SYSCALL_RET_TYPE handle_munmap(va_list args) /* * Torsocks call for syscall(2) */ -LIBC_SYSCALL_RET_TYPE tsocks_syscall(long int __number, va_list args) +LIBC_SYSCALL_RET_TYPE tsocks_syscall(long int number, va_list args) { LIBC_SYSCALL_RET_TYPE ret;
- switch (__number) { + switch (number) { case TSOCKS_NR_SOCKET: ret = handle_socket(args); break; @@ -162,7 +162,7 @@ LIBC_SYSCALL_RET_TYPE tsocks_syscall(long int __number, va_list args) * off the Tor network. */ WARN("[syscall] Unsupported syscall number %ld. Denying the call", - __number); + number); ret = -1; errno = ENOSYS; break; @@ -179,8 +179,8 @@ LIBC_SYSCALL_DECL LIBC_SYSCALL_RET_TYPE ret; va_list args;
- va_start(args, __number); - ret = tsocks_syscall(__number, args); + va_start(args, number); + ret = tsocks_syscall(number, args); va_end(args);
return ret; @@ -212,11 +212,11 @@ static LIBC___SYSCALL_RET_TYPE handle_bsd_mmap(va_list args) return (LIBC___SYSCALL_RET_TYPE) mmap(addr, len, prot, flags, fd, offset); }
-LIBC___SYSCALL_RET_TYPE tsocks___syscall(quad_t __number, va_list args) +LIBC___SYSCALL_RET_TYPE tsocks___syscall(quad_t number, va_list args) { LIBC_SYSCALL_RET_TYPE ret;
- switch (__number) { + switch (number) { case TSOCKS_NR_MMAP: /* * Please see the mmap comment in the syscall() function to understand @@ -230,7 +230,7 @@ LIBC___SYSCALL_RET_TYPE tsocks___syscall(quad_t __number, va_list args) * off the Tor network. */ WARN("[syscall] Unsupported __syscall number %ld. Denying the call", - __number); + number); ret = -1; errno = ENOSYS; break; @@ -244,8 +244,8 @@ LIBC___SYSCALL_DECL LIBC___SYSCALL_RET_TYPE ret; va_list args;
- va_start(args, __number); - ret = tsocks___syscall(__number, args); + va_start(args, number); + ret = tsocks___syscall(number, args); va_end(args);
return ret; diff --git a/src/lib/torsocks.h b/src/lib/torsocks.h index 3e82a94..454ad1c 100644 --- a/src/lib/torsocks.h +++ b/src/lib/torsocks.h @@ -43,27 +43,27 @@ #define LIBC_CONNECT_NAME_STR XSTR(LIBC_CONNECT_NAME) #define LIBC_CONNECT_RET_TYPE int #define LIBC_CONNECT_SIG \ - int __sockfd, const struct sockaddr *__addr, socklen_t __addrlen + int sockfd, const struct sockaddr *addr, socklen_t addrlen #define LIBC_CONNECT_ARGS \ - __sockfd, __addr, __addrlen + sockfd, addr, addrlen
/* socket(2) */ #define LIBC_SOCKET_NAME socket #define LIBC_SOCKET_NAME_STR XSTR(LIBC_SOCKET_NAME) #define LIBC_SOCKET_RET_TYPE int #define LIBC_SOCKET_SIG \ - int __domain, int __type, int __protocol + int domain, int type, int protocol #define LIBC_SOCKET_ARGS \ - __domain, __type, __protocol + domain, type, protocol
/* socketpair(2) */ #define LIBC_SOCKETPAIR_NAME socketpair #define LIBC_SOCKETPAIR_NAME_STR XSTR(LIBC_SOCKETPAIR_NAME) #define LIBC_SOCKETPAIR_RET_TYPE int #define LIBC_SOCKETPAIR_SIG \ - int __domain, int __type, int __protocol, int __sv[2] + int domain, int type, int protocol, int sv[2] #define LIBC_SOCKETPAIR_ARGS \ - __domain, __type, __protocol, __sv + domain, type, protocol, sv
/* close(2) */ #include <unistd.h> @@ -71,8 +71,8 @@ #define LIBC_CLOSE_NAME close #define LIBC_CLOSE_NAME_STR XSTR(LIBC_CLOSE_NAME) #define LIBC_CLOSE_RET_TYPE int -#define LIBC_CLOSE_SIG int __fd -#define LIBC_CLOSE_ARGS __fd +#define LIBC_CLOSE_SIG int fd +#define LIBC_CLOSE_ARGS fd
/* gethostbyname(3) - DEPRECATED in glibc. */ #include <netdb.h> @@ -91,35 +91,35 @@ extern char tsocks_he_name[255]; #define LIBC_GETHOSTBYNAME_NAME gethostbyname #define LIBC_GETHOSTBYNAME_NAME_STR XSTR(LIBC_GETHOSTBYNAME_NAME) #define LIBC_GETHOSTBYNAME_RET_TYPE struct hostent * -#define LIBC_GETHOSTBYNAME_SIG const char *__name -#define LIBC_GETHOSTBYNAME_ARGS __name +#define LIBC_GETHOSTBYNAME_SIG const char *name +#define LIBC_GETHOSTBYNAME_ARGS name
/* gethostbyname2(3) - GNU extension to avoid static data. */ #define LIBC_GETHOSTBYNAME2_NAME gethostbyname2 #define LIBC_GETHOSTBYNAME2_NAME_STR XSTR(LIBC_GETHOSTBYNAME2_NAME) #define LIBC_GETHOSTBYNAME2_RET_TYPE struct hostent * -#define LIBC_GETHOSTBYNAME2_SIG const char *__name, int __af -#define LIBC_GETHOSTBYNAME2_ARGS __name, __af +#define LIBC_GETHOSTBYNAME2_SIG const char *name, int af +#define LIBC_GETHOSTBYNAME2_ARGS name, af
/* GNU extension. Reentrant version. */ #define LIBC_GETHOSTBYNAME_R_NAME gethostbyname_r #define LIBC_GETHOSTBYNAME_R_NAME_STR XSTR(LIBC_GETHOSTBYNAME_R_NAME) #define LIBC_GETHOSTBYNAME_R_RET_TYPE int -#define LIBC_GETHOSTBYNAME_R_SIG const char *__name, \ - struct hostent *__ret, char *__buf, size_t __buflen, \ - struct hostent **__result, int *__h_errnop -#define LIBC_GETHOSTBYNAME_R_ARGS __name, __ret, __buf, \ - __buflen, __result, __h_errnop +#define LIBC_GETHOSTBYNAME_R_SIG const char *name, \ + struct hostent *hret, char *buf, size_t buflen, \ + struct hostent **result, int *h_errnop +#define LIBC_GETHOSTBYNAME_R_ARGS name, hret, buf, \ + buflen, result, h_errnop
/* GNU extension. Reentrant version 2. */ #define LIBC_GETHOSTBYNAME2_R_NAME gethostbyname2_r #define LIBC_GETHOSTBYNAME2_R_NAME_STR XSTR(LIBC_GETHOSTBYNAME2_R_NAME) #define LIBC_GETHOSTBYNAME2_R_RET_TYPE int -#define LIBC_GETHOSTBYNAME2_R_SIG const char *__name, int __af, \ - struct hostent *__ret, char *__buf, size_t __buflen, \ -struct hostent **__result, int *__h_errnop -#define LIBC_GETHOSTBYNAME2_R_ARGS __name, __af, __ret, __buf, \ - __buflen, __result, __h_errnop +#define LIBC_GETHOSTBYNAME2_R_SIG const char *name, int af, \ + struct hostent *hret, char *buf, size_t buflen, \ +struct hostent **result, int *h_errnop +#define LIBC_GETHOSTBYNAME2_R_ARGS name, af, hret, buf, \ + buflen, result, h_errnop
/* gethostbyaddr(3) - DEPRECATED in glibc. */ #include <sys/socket.h> @@ -127,18 +127,18 @@ struct hostent **__result, int *__h_errnop #define LIBC_GETHOSTBYADDR_NAME gethostbyaddr #define LIBC_GETHOSTBYADDR_NAME_STR XSTR(LIBC_GETHOSTBYADDR_NAME) #define LIBC_GETHOSTBYADDR_RET_TYPE struct hostent * -#define LIBC_GETHOSTBYADDR_SIG const void *__addr, socklen_t __len, int __type -#define LIBC_GETHOSTBYADDR_ARGS __addr, __len, __type +#define LIBC_GETHOSTBYADDR_SIG const void *addr, socklen_t len, int type +#define LIBC_GETHOSTBYADDR_ARGS addr, len, type
/* GNU extension. Reentrant version. */ #define LIBC_GETHOSTBYADDR_R_NAME gethostbyaddr_r #define LIBC_GETHOSTBYADDR_R_NAME_STR XSTR(LIBC_GETHOSTBYADDR_R_NAME) #define LIBC_GETHOSTBYADDR_R_RET_TYPE int -#define LIBC_GETHOSTBYADDR_R_SIG const void *__addr, socklen_t __len, int __type, \ - struct hostent *__ret, char *__buf, size_t __buflen, \ - struct hostent **__result, int *__h_errnop -#define LIBC_GETHOSTBYADDR_R_ARGS __addr, __len, __type, __ret, __buf, \ - __buflen, __result, __h_errnop +#define LIBC_GETHOSTBYADDR_R_SIG const void *addr, socklen_t len, int type, \ + struct hostent *hret, char *buf, size_t buflen, \ + struct hostent **result, int *h_errnop +#define LIBC_GETHOSTBYADDR_R_ARGS addr, len, type, hret, buf, \ + buflen, result, h_errnop
/* getaddrinfo(3) */ #include <netdb.h> @@ -147,9 +147,9 @@ struct hostent **__result, int *__h_errnop #define LIBC_GETADDRINFO_NAME_STR XSTR(LIBC_GETADDRINFO_NAME) #define LIBC_GETADDRINFO_RET_TYPE int #define LIBC_GETADDRINFO_SIG \ - const char *__node, const char *__service, const struct addrinfo *__hints,\ - struct addrinfo **__res -#define LIBC_GETADDRINFO_ARGS __node, __service, __hints, __res + const char *node, const char *service, const struct addrinfo *hints,\ + struct addrinfo **res +#define LIBC_GETADDRINFO_ARGS node, service, hints, res
/* getpeername(2) */ #include <sys/socket.h> @@ -158,16 +158,16 @@ struct hostent **__result, int *__h_errnop #define LIBC_GETPEERNAME_NAME_STR XSTR(LIBC_GETPEERNAME_NAME) #define LIBC_GETPEERNAME_RET_TYPE int #define LIBC_GETPEERNAME_SIG \ - int __sockfd, struct sockaddr *__addr, socklen_t *__addrlen -#define LIBC_GETPEERNAME_ARGS __sockfd, __addr, __addrlen + int sockfd, struct sockaddr *addr, socklen_t *addrlen +#define LIBC_GETPEERNAME_ARGS sockfd, addr, addrlen
#define LIBC_RECVMSG_NAME recvmsg #define LIBC_RECVMSG_NAME_STR XSTR(LIBC_RECVMSG_NAME) #define LIBC_RECVMSG_RET_TYPE ssize_t #define LIBC_RECVMSG_SIG \ - int __sockfd, struct msghdr *__msg, int __flags + int sockfd, struct msghdr *msg, int flags #define LIBC_RECVMSG_ARGS \ - __sockfd, __msg, __flags + sockfd, msg, flags
#else #error "OS not supported." @@ -181,8 +181,8 @@ struct hostent **__result, int *__h_errnop #define LIBC_SYSCALL_NAME syscall #define LIBC_SYSCALL_NAME_STR XSTR(LIBC_SYSCALL_NAME) #define LIBC_SYSCALL_RET_TYPE long int -#define LIBC_SYSCALL_SIG long int __number, ... -#define LIBC_SYSCALL_ARGS __number +#define LIBC_SYSCALL_SIG long int number, ... +#define LIBC_SYSCALL_ARGS number
#endif /* __linux__ */
@@ -192,8 +192,8 @@ struct hostent **__result, int *__h_errnop #define LIBC_SYSCALL_NAME syscall #define LIBC_SYSCALL_NAME_STR XSTR(LIBC_SYSCALL_NAME) #define LIBC_SYSCALL_RET_TYPE int -#define LIBC_SYSCALL_SIG int __number, ... -#define LIBC_SYSCALL_ARGS __number +#define LIBC_SYSCALL_SIG int number, ... +#define LIBC_SYSCALL_ARGS number
#endif /* __FreeBSD__, __darwin__, __NetBSD__ */
@@ -203,8 +203,8 @@ struct hostent **__result, int *__h_errnop #define LIBC_SYSCALL_NAME syscall #define LIBC_SYSCALL_NAME_STR XSTR(LIBC_SYSCALL_NAME) #define LIBC_SYSCALL_RET_TYPE long int -#define LIBC_SYSCALL_SIG long int __number, ... -#define LIBC_SYSCALL_ARGS __number +#define LIBC_SYSCALL_SIG long int number, ... +#define LIBC_SYSCALL_ARGS number
#endif /* __GLIBC__ && __FreeBSD_kernel__ */
@@ -214,16 +214,16 @@ struct hostent **__result, int *__h_errnop #define LIBC___SYSCALL_NAME __syscall #define LIBC___SYSCALL_NAME_STR XSTR(LIBC___SYSCALL_NAME) #define LIBC___SYSCALL_RET_TYPE off_t -#define LIBC___SYSCALL_SIG quad_t __number, ... -#define LIBC___SYSCALL_ARGS __number +#define LIBC___SYSCALL_SIG quad_t number, ... +#define LIBC___SYSCALL_ARGS number
#elif defined(__NetBSD__)
#define LIBC___SYSCALL_NAME __syscall #define LIBC___SYSCALL_NAME_STR XSTR(LIBC___SYSCALL_NAME) #define LIBC___SYSCALL_RET_TYPE quad_t -#define LIBC___SYSCALL_SIG quad_t __number, ... -#define LIBC___SYSCALL_ARGS __number +#define LIBC___SYSCALL_SIG quad_t number, ... +#define LIBC___SYSCALL_ARGS number
#endif /* __FreeBSD__, __NetBSD__ */
tor-commits@lists.torproject.org