From 96c920e166b40bbe50f216e294f2efac154a1cb2 Mon Sep 17 00:00:00 2001 From: Fred Barclay Date: Wed, 24 May 2017 14:13:52 -0500 Subject: Remove trailing whitespace from src/ --- src/libtrace/libtrace.c | 92 ++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'src/libtrace/libtrace.c') diff --git a/src/libtrace/libtrace.c b/src/libtrace/libtrace.c index 1be89052c..5cdb254a3 100644 --- a/src/libtrace/libtrace.c +++ b/src/libtrace/libtrace.c @@ -57,7 +57,7 @@ static char *name(void) { if (!nameinit) { // initialize the name of the process based on /proc/PID/comm memset(myname, 0, MAXNAME); - + pid_t p = pid(); char *fname; if (asprintf(&fname, "/proc/%u/comm", p) == -1) @@ -74,17 +74,17 @@ static char *name(void) { free(fname); return "unknown"; } - + // clean '\n' char *ptr = strchr(myname, '\n'); if (ptr) *ptr = '\0'; - + fclose(fp); free(fname); nameinit = 1; } - + return myname; } @@ -99,20 +99,20 @@ typedef struct { static XTable socket_type[] = { #ifdef SOCK_STREAM { SOCK_STREAM, "SOCK_STREAM" }, -#endif -#ifdef SOCK_DGRAM +#endif +#ifdef SOCK_DGRAM { SOCK_DGRAM, "SOCK_DGRAM" }, -#endif -#ifdef SOCK_RAW +#endif +#ifdef SOCK_RAW { SOCK_RAW, "SOCK_RAW" }, -#endif -#ifdef SOCK_RDM +#endif +#ifdef SOCK_RDM { SOCK_RDM, "SOCK_RDM" }, -#endif -#ifdef SOCK_SEQPACKET +#endif +#ifdef SOCK_SEQPACKET { SOCK_SEQPACKET, "SOCK_SEQPACKET" }, -#endif -#ifdef SOCK_DCCP +#endif +#ifdef SOCK_DCCP { SOCK_DCCP, "SOCK_DCCP" }, #endif { 0, NULL} // NULL terminated @@ -198,7 +198,7 @@ static XTable socket_protocol[] = { #ifdef IPPROTO_AH { IPPROTO_AH, "IPPROTO_AH" }, #endif -#ifdef IPPROTO_BEETPH +#ifdef IPPROTO_BEETPH { IPPROTO_BEETPH, "IPPROTO_BEETPH" }, #endif #ifdef IPPROTO_PIM @@ -225,7 +225,7 @@ static char *translate(XTable *table, int val) { return table->name; table++; } - + return NULL; } @@ -262,7 +262,7 @@ static orig_open_t orig_open = NULL; int open(const char *pathname, int flags, mode_t mode) { if (!orig_open) orig_open = (orig_open_t)dlsym(RTLD_NEXT, "open"); - + int rv = orig_open(pathname, flags, mode); printf("%u:%s:open %s:%d\n", pid(), name(), pathname, rv); return rv; @@ -273,7 +273,7 @@ static orig_open64_t orig_open64 = NULL; int open64(const char *pathname, int flags, mode_t mode) { if (!orig_open64) orig_open64 = (orig_open64_t)dlsym(RTLD_NEXT, "open64"); - + int rv = orig_open64(pathname, flags, mode); printf("%u:%s:open64 %s:%d\n", pid(), name(), pathname, rv); return rv; @@ -285,7 +285,7 @@ static orig_openat_t orig_openat = NULL; int openat(int dirfd, const char *pathname, int flags, mode_t mode) { if (!orig_openat) orig_openat = (orig_openat_t)dlsym(RTLD_NEXT, "openat"); - + int rv = orig_openat(dirfd, pathname, flags, mode); printf("%u:%s:openat %s:%d\n", pid(), name(), pathname, rv); return rv; @@ -296,7 +296,7 @@ static orig_openat64_t orig_openat64 = NULL; int openat64(int dirfd, const char *pathname, int flags, mode_t mode) { if (!orig_openat64) orig_openat64 = (orig_openat64_t)dlsym(RTLD_NEXT, "openat64"); - + int rv = orig_openat64(dirfd, pathname, flags, mode); printf("%u:%s:openat64 %s:%d\n", pid(), name(), pathname, rv); return rv; @@ -307,7 +307,7 @@ int openat64(int dirfd, const char *pathname, int flags, mode_t mode) { FILE *fopen(const char *pathname, const char *mode) { if (!orig_fopen) orig_fopen = (orig_fopen_t)dlsym(RTLD_NEXT, "fopen"); - + FILE *rv = orig_fopen(pathname, mode); printf("%u:%s:fopen %s:%p\n", pid(), name(), pathname, rv); return rv; @@ -317,7 +317,7 @@ FILE *fopen(const char *pathname, const char *mode) { FILE *fopen64(const char *pathname, const char *mode) { if (!orig_fopen64) orig_fopen64 = (orig_fopen_t)dlsym(RTLD_NEXT, "fopen64"); - + FILE *rv = orig_fopen64(pathname, mode); printf("%u:%s:fopen64 %s:%p\n", pid(), name(), pathname, rv); return rv; @@ -331,7 +331,7 @@ static orig_freopen_t orig_freopen = NULL; FILE *freopen(const char *pathname, const char *mode, FILE *stream) { if (!orig_freopen) orig_freopen = (orig_freopen_t)dlsym(RTLD_NEXT, "freopen"); - + FILE *rv = orig_freopen(pathname, mode, stream); printf("%u:%s:freopen %s:%p\n", pid(), name(), pathname, rv); return rv; @@ -343,7 +343,7 @@ static orig_freopen64_t orig_freopen64 = NULL; FILE *freopen64(const char *pathname, const char *mode, FILE *stream) { if (!orig_freopen64) orig_freopen64 = (orig_freopen64_t)dlsym(RTLD_NEXT, "freopen64"); - + FILE *rv = orig_freopen64(pathname, mode, stream); printf("%u:%s:freopen64 %s:%p\n", pid(), name(), pathname, rv); return rv; @@ -356,7 +356,7 @@ static orig_unlink_t orig_unlink = NULL; int unlink(const char *pathname) { if (!orig_unlink) orig_unlink = (orig_unlink_t)dlsym(RTLD_NEXT, "unlink"); - + int rv = orig_unlink(pathname); printf("%u:%s:unlink %s:%d\n", pid(), name(), pathname, rv); return rv; @@ -367,7 +367,7 @@ static orig_unlinkat_t orig_unlinkat = NULL; int unlinkat(int dirfd, const char *pathname, int flags) { if (!orig_unlinkat) orig_unlinkat = (orig_unlinkat_t)dlsym(RTLD_NEXT, "unlinkat"); - + int rv = orig_unlinkat(dirfd, pathname, flags); printf("%u:%s:unlinkat %s:%d\n", pid(), name(), pathname, rv); return rv; @@ -379,7 +379,7 @@ static orig_mkdir_t orig_mkdir = NULL; int mkdir(const char *pathname, mode_t mode) { if (!orig_mkdir) orig_mkdir = (orig_mkdir_t)dlsym(RTLD_NEXT, "mkdir"); - + int rv = orig_mkdir(pathname, mode); printf("%u:%s:mkdir %s:%d\n", pid(), name(), pathname, rv); return rv; @@ -390,7 +390,7 @@ static orig_mkdirat_t orig_mkdirat = NULL; int mkdirat(int dirfd, const char *pathname, mode_t mode) { if (!orig_mkdirat) orig_mkdirat = (orig_mkdirat_t)dlsym(RTLD_NEXT, "mkdirat"); - + int rv = orig_mkdirat(dirfd, pathname, mode); printf("%u:%s:mkdirat %s:%d\n", pid(), name(), pathname, rv); return rv; @@ -401,7 +401,7 @@ static orig_rmdir_t orig_rmdir = NULL; int rmdir(const char *pathname) { if (!orig_rmdir) orig_rmdir = (orig_rmdir_t)dlsym(RTLD_NEXT, "rmdir"); - + int rv = orig_rmdir(pathname); printf("%u:%s:rmdir %s:%d\n", pid(), name(), pathname, rv); return rv; @@ -413,7 +413,7 @@ static orig_stat_t orig_stat = NULL; int stat(const char *pathname, struct stat *buf) { if (!orig_stat) orig_stat = (orig_stat_t)dlsym(RTLD_NEXT, "stat"); - + int rv = orig_stat(pathname, buf); printf("%u:%s:stat %s:%d\n", pid(), name(), pathname, rv); return rv; @@ -425,7 +425,7 @@ static orig_stat64_t orig_stat64 = NULL; int stat64(const char *pathname, struct stat64 *buf) { if (!orig_stat64) orig_stat64 = (orig_stat64_t)dlsym(RTLD_NEXT, "stat64"); - + int rv = orig_stat64(pathname, buf); printf("%u:%s:stat64 %s:%d\n", pid(), name(), pathname, rv); return rv; @@ -463,7 +463,7 @@ static orig_opendir_t orig_opendir = NULL; DIR *opendir(const char *pathname) { if (!orig_opendir) orig_opendir = (orig_opendir_t)dlsym(RTLD_NEXT, "opendir"); - + DIR *rv = orig_opendir(pathname); printf("%u:%s:opendir %s:%p\n", pid(), name(), pathname, rv); return rv; @@ -475,7 +475,7 @@ static orig_access_t orig_access = NULL; int access(const char *pathname, int mode) { if (!orig_access) orig_access = (orig_access_t)dlsym(RTLD_NEXT, "access"); - + int rv = orig_access(pathname, mode); printf("%u:%s:access %s:%d\n", pid(), name(), pathname, rv); return rv; @@ -488,7 +488,7 @@ static orig_connect_t orig_connect = NULL; int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) { if (!orig_connect) orig_connect = (orig_connect_t)dlsym(RTLD_NEXT, "connect"); - + int rv = orig_connect(sockfd, addr, addrlen); print_sockaddr(sockfd, "connect", addr, rv); @@ -502,7 +502,7 @@ static char buf[1024]; int socket(int domain, int type, int protocol) { if (!orig_socket) orig_socket = (orig_socket_t)dlsym(RTLD_NEXT, "socket"); - + int rv = orig_socket(domain, type, protocol); char *ptr = buf; ptr += sprintf(ptr, "%u:%s:socket ", pid(), name()); @@ -545,7 +545,7 @@ static orig_bind_t orig_bind = NULL; int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen) { if (!orig_bind) orig_bind = (orig_bind_t)dlsym(RTLD_NEXT, "bind"); - + int rv = orig_bind(sockfd, addr, addrlen); print_sockaddr(sockfd, "bind", addr, rv); @@ -558,7 +558,7 @@ static orig_accept_t orig_accept = NULL; int accept(int sockfd, struct sockaddr *addr, socklen_t addrlen) { if (!orig_accept) orig_accept = (orig_accept_t)dlsym(RTLD_NEXT, "accept"); - + int rv = orig_accept(sockfd, addr, addrlen); print_sockaddr(sockfd, "accept", addr, rv); @@ -571,7 +571,7 @@ static orig_system_t orig_system = NULL; int system(const char *command) { if (!orig_system) orig_system = (orig_system_t)dlsym(RTLD_NEXT, "system"); - + int rv = orig_system(command); printf("%u:%s:system %s:%d\n", pid(), name(), command, rv); @@ -583,7 +583,7 @@ static orig_setuid_t orig_setuid = NULL; int setuid(uid_t uid) { if (!orig_setuid) orig_setuid = (orig_setuid_t)dlsym(RTLD_NEXT, "setuid"); - + int rv = orig_setuid(uid); printf("%u:%s:setuid %d:%d\n", pid(), name(), uid, rv); @@ -595,7 +595,7 @@ static orig_setgid_t orig_setgid = NULL; int setgid(gid_t gid) { if (!orig_setgid) orig_setgid = (orig_setgid_t)dlsym(RTLD_NEXT, "setgid"); - + int rv = orig_setgid(gid); printf("%u:%s:setgid %d:%d\n", pid(), name(), gid, rv); @@ -607,7 +607,7 @@ static orig_setfsuid_t orig_setfsuid = NULL; int setfsuid(uid_t uid) { if (!orig_setfsuid) orig_setfsuid = (orig_setfsuid_t)dlsym(RTLD_NEXT, "setfsuid"); - + int rv = orig_setfsuid(uid); printf("%u:%s:setfsuid %d:%d\n", pid(), name(), uid, rv); @@ -619,7 +619,7 @@ static orig_setfsgid_t orig_setfsgid = NULL; int setfsgid(gid_t gid) { if (!orig_setfsgid) orig_setfsgid = (orig_setfsgid_t)dlsym(RTLD_NEXT, "setfsgid"); - + int rv = orig_setfsgid(gid); printf("%u:%s:setfsgid %d:%d\n", pid(), name(), gid, rv); @@ -631,7 +631,7 @@ static orig_setreuid_t orig_setreuid = NULL; int setreuid(uid_t ruid, uid_t euid) { if (!orig_setreuid) orig_setreuid = (orig_setreuid_t)dlsym(RTLD_NEXT, "setreuid"); - + int rv = orig_setreuid(ruid, euid); printf("%u:%s:setreuid %d %d:%d\n", pid(), name(), ruid, euid, rv); @@ -643,7 +643,7 @@ static orig_setregid_t orig_setregid = NULL; int setregid(gid_t rgid, gid_t egid) { if (!orig_setregid) orig_setregid = (orig_setregid_t)dlsym(RTLD_NEXT, "setregid"); - + int rv = orig_setregid(rgid, egid); printf("%u:%s:setregid %d %d:%d\n", pid(), name(), rgid, egid, rv); @@ -655,7 +655,7 @@ static orig_setresuid_t orig_setresuid = NULL; int setresuid(uid_t ruid, uid_t euid, uid_t suid) { if (!orig_setresuid) orig_setresuid = (orig_setresuid_t)dlsym(RTLD_NEXT, "setresuid"); - + int rv = orig_setresuid(ruid, euid, suid); printf("%u:%s:setresuid %d %d %d:%d\n", pid(), name(), ruid, euid, suid, rv); @@ -667,7 +667,7 @@ static orig_setresgid_t orig_setresgid = NULL; int setresgid(gid_t rgid, gid_t egid, gid_t sgid) { if (!orig_setresgid) orig_setresgid = (orig_setresgid_t)dlsym(RTLD_NEXT, "setresgid"); - + int rv = orig_setresgid(rgid, egid, sgid); printf("%u:%s:setresgid %d %d %d:%d\n", pid(), name(), rgid, egid, sgid, rv); -- cgit v1.2.3-70-g09d2