diff options
-rw-r--r-- | src/fnettrace/main.c | 2 | ||||
-rw-r--r-- | src/libtrace/libtrace.c | 20 | ||||
-rw-r--r-- | src/libtracelog/libtracelog.c | 20 |
3 files changed, 21 insertions, 21 deletions
diff --git a/src/fnettrace/main.c b/src/fnettrace/main.c index da5ac02c6..56974e79c 100644 --- a/src/fnettrace/main.c +++ b/src/fnettrace/main.c | |||
@@ -19,6 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | #include "fnettrace.h" | 20 | #include "fnettrace.h" |
21 | #include "radix.h" | 21 | #include "radix.h" |
22 | #include <limits.h> | ||
22 | #include <sys/ioctl.h> | 23 | #include <sys/ioctl.h> |
23 | #define MAX_BUF_SIZE (64 * 1024) | 24 | #define MAX_BUF_SIZE (64 * 1024) |
24 | 25 | ||
@@ -190,7 +191,6 @@ static char *print_bw(unsigned units) { | |||
190 | return bw_line[units]; | 191 | return bw_line[units]; |
191 | } | 192 | } |
192 | 193 | ||
193 | #define LINE_MAX 200 | ||
194 | static inline void adjust_line(char *str, int len, int cols) { | 194 | static inline void adjust_line(char *str, int len, int cols) { |
195 | if (len > LINE_MAX) // functions such as snprintf truncate the string, and return the length of the untruncated string | 195 | if (len > LINE_MAX) // functions such as snprintf truncate the string, and return the length of the untruncated string |
196 | len = LINE_MAX; | 196 | len = LINE_MAX; |
diff --git a/src/libtrace/libtrace.c b/src/libtrace/libtrace.c index c0832cbde..aa37bb758 100644 --- a/src/libtrace/libtrace.c +++ b/src/libtrace/libtrace.c | |||
@@ -44,8 +44,6 @@ | |||
44 | // break recursivity on fopen call | 44 | // break recursivity on fopen call |
45 | typedef FILE *(*orig_fopen_t)(const char *pathname, const char *mode); | 45 | typedef FILE *(*orig_fopen_t)(const char *pathname, const char *mode); |
46 | static orig_fopen_t orig_fopen = NULL; | 46 | static orig_fopen_t orig_fopen = NULL; |
47 | typedef FILE *(*orig_fopen64_t)(const char *pathname, const char *mode); | ||
48 | static orig_fopen64_t orig_fopen64 = NULL; | ||
49 | typedef int (*orig_access_t)(const char *pathname, int mode); | 47 | typedef int (*orig_access_t)(const char *pathname, int mode); |
50 | static orig_access_t orig_access = NULL; | 48 | static orig_access_t orig_access = NULL; |
51 | 49 | ||
@@ -341,7 +339,9 @@ FILE *fopen(const char *pathname, const char *mode) { | |||
341 | return rv; | 339 | return rv; |
342 | } | 340 | } |
343 | 341 | ||
344 | #ifdef __GLIBC__ | 342 | #ifndef fopen64 |
343 | typedef FILE *(*orig_fopen64_t)(const char *pathname, const char *mode); | ||
344 | static orig_fopen64_t orig_fopen64 = NULL; | ||
345 | FILE *fopen64(const char *pathname, const char *mode) { | 345 | FILE *fopen64(const char *pathname, const char *mode) { |
346 | if (!orig_fopen64) | 346 | if (!orig_fopen64) |
347 | orig_fopen64 = (orig_fopen_t)dlsym(RTLD_NEXT, "fopen64"); | 347 | orig_fopen64 = (orig_fopen_t)dlsym(RTLD_NEXT, "fopen64"); |
@@ -350,7 +350,7 @@ FILE *fopen64(const char *pathname, const char *mode) { | |||
350 | tprintf(ftty, "%u:%s:fopen64 %s:%p\n", mypid, myname, pathname, rv); | 350 | tprintf(ftty, "%u:%s:fopen64 %s:%p\n", mypid, myname, pathname, rv); |
351 | return rv; | 351 | return rv; |
352 | } | 352 | } |
353 | #endif /* __GLIBC__ */ | 353 | #endif |
354 | 354 | ||
355 | 355 | ||
356 | // freopen | 356 | // freopen |
@@ -365,7 +365,7 @@ FILE *freopen(const char *pathname, const char *mode, FILE *stream) { | |||
365 | return rv; | 365 | return rv; |
366 | } | 366 | } |
367 | 367 | ||
368 | #ifdef __GLIBC__ | 368 | #ifndef freopen64 |
369 | typedef FILE *(*orig_freopen64_t)(const char *pathname, const char *mode, FILE *stream); | 369 | typedef FILE *(*orig_freopen64_t)(const char *pathname, const char *mode, FILE *stream); |
370 | static orig_freopen64_t orig_freopen64 = NULL; | 370 | static orig_freopen64_t orig_freopen64 = NULL; |
371 | FILE *freopen64(const char *pathname, const char *mode, FILE *stream) { | 371 | FILE *freopen64(const char *pathname, const char *mode, FILE *stream) { |
@@ -376,7 +376,7 @@ FILE *freopen64(const char *pathname, const char *mode, FILE *stream) { | |||
376 | tprintf(ftty, "%u:%s:freopen64 %s:%p\n", mypid, myname, pathname, rv); | 376 | tprintf(ftty, "%u:%s:freopen64 %s:%p\n", mypid, myname, pathname, rv); |
377 | return rv; | 377 | return rv; |
378 | } | 378 | } |
379 | #endif /* __GLIBC__ */ | 379 | #endif |
380 | 380 | ||
381 | // unlink | 381 | // unlink |
382 | typedef int (*orig_unlink_t)(const char *pathname); | 382 | typedef int (*orig_unlink_t)(const char *pathname); |
@@ -447,7 +447,7 @@ int stat(const char *pathname, struct stat *statbuf) { | |||
447 | return rv; | 447 | return rv; |
448 | } | 448 | } |
449 | 449 | ||
450 | #ifdef __GLIBC__ | 450 | #ifndef stat64 |
451 | typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *statbuf); | 451 | typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *statbuf); |
452 | static orig_stat64_t orig_stat64 = NULL; | 452 | static orig_stat64_t orig_stat64 = NULL; |
453 | int stat64(const char *pathname, struct stat64 *statbuf) { | 453 | int stat64(const char *pathname, struct stat64 *statbuf) { |
@@ -458,7 +458,7 @@ int stat64(const char *pathname, struct stat64 *statbuf) { | |||
458 | tprintf(ftty, "%u:%s:stat64 %s:%d\n", mypid, myname, pathname, rv); | 458 | tprintf(ftty, "%u:%s:stat64 %s:%d\n", mypid, myname, pathname, rv); |
459 | return rv; | 459 | return rv; |
460 | } | 460 | } |
461 | #endif /* __GLIBC__ */ | 461 | #endif |
462 | 462 | ||
463 | // lstat | 463 | // lstat |
464 | typedef int (*orig_lstat_t)(const char *pathname, struct stat *statbuf); | 464 | typedef int (*orig_lstat_t)(const char *pathname, struct stat *statbuf); |
@@ -472,7 +472,7 @@ int lstat(const char *pathname, struct stat *statbuf) { | |||
472 | return rv; | 472 | return rv; |
473 | } | 473 | } |
474 | 474 | ||
475 | #ifdef __GLIBC__ | 475 | #ifndef lstat64 |
476 | typedef int (*orig_lstat64_t)(const char *pathname, struct stat64 *statbuf); | 476 | typedef int (*orig_lstat64_t)(const char *pathname, struct stat64 *statbuf); |
477 | static orig_lstat64_t orig_lstat64 = NULL; | 477 | static orig_lstat64_t orig_lstat64 = NULL; |
478 | int lstat64(const char *pathname, struct stat64 *statbuf) { | 478 | int lstat64(const char *pathname, struct stat64 *statbuf) { |
@@ -483,7 +483,7 @@ int lstat64(const char *pathname, struct stat64 *statbuf) { | |||
483 | tprintf(ftty, "%u:%s:lstat64 %s:%d\n", mypid, myname, pathname, rv); | 483 | tprintf(ftty, "%u:%s:lstat64 %s:%d\n", mypid, myname, pathname, rv); |
484 | return rv; | 484 | return rv; |
485 | } | 485 | } |
486 | #endif /* __GLIBC__ */ | 486 | #endif |
487 | 487 | ||
488 | // opendir | 488 | // opendir |
489 | typedef DIR *(*orig_opendir_t)(const char *pathname); | 489 | typedef DIR *(*orig_opendir_t)(const char *pathname); |
diff --git a/src/libtracelog/libtracelog.c b/src/libtracelog/libtracelog.c index 760ac7612..fc2eba638 100644 --- a/src/libtracelog/libtracelog.c +++ b/src/libtracelog/libtracelog.c | |||
@@ -39,8 +39,6 @@ | |||
39 | // break recursivity on fopen call | 39 | // break recursivity on fopen call |
40 | typedef FILE *(*orig_fopen_t)(const char *pathname, const char *mode); | 40 | typedef FILE *(*orig_fopen_t)(const char *pathname, const char *mode); |
41 | static orig_fopen_t orig_fopen = NULL; | 41 | static orig_fopen_t orig_fopen = NULL; |
42 | typedef FILE *(*orig_fopen64_t)(const char *pathname, const char *mode); | ||
43 | static orig_fopen64_t orig_fopen64 = NULL; | ||
44 | 42 | ||
45 | // | 43 | // |
46 | // blacklist storage | 44 | // blacklist storage |
@@ -405,7 +403,9 @@ FILE *fopen(const char *pathname, const char *mode) { | |||
405 | return rv; | 403 | return rv; |
406 | } | 404 | } |
407 | 405 | ||
408 | #ifdef __GLIBC__ | 406 | #ifndef fopen64 |
407 | typedef FILE *(*orig_fopen64_t)(const char *pathname, const char *mode); | ||
408 | static orig_fopen64_t orig_fopen64 = NULL; | ||
409 | FILE *fopen64(const char *pathname, const char *mode) { | 409 | FILE *fopen64(const char *pathname, const char *mode) { |
410 | #ifdef DEBUG | 410 | #ifdef DEBUG |
411 | printf("%s %s\n", __FUNCTION__, pathname); | 411 | printf("%s %s\n", __FUNCTION__, pathname); |
@@ -420,7 +420,7 @@ FILE *fopen64(const char *pathname, const char *mode) { | |||
420 | FILE *rv = orig_fopen64(pathname, mode); | 420 | FILE *rv = orig_fopen64(pathname, mode); |
421 | return rv; | 421 | return rv; |
422 | } | 422 | } |
423 | #endif /* __GLIBC__ */ | 423 | #endif |
424 | 424 | ||
425 | 425 | ||
426 | // freopen | 426 | // freopen |
@@ -441,7 +441,7 @@ FILE *freopen(const char *pathname, const char *mode, FILE *stream) { | |||
441 | return rv; | 441 | return rv; |
442 | } | 442 | } |
443 | 443 | ||
444 | #ifdef __GLIBC__ | 444 | #ifndef freopen64 |
445 | typedef FILE *(*orig_freopen64_t)(const char *pathname, const char *mode, FILE *stream); | 445 | typedef FILE *(*orig_freopen64_t)(const char *pathname, const char *mode, FILE *stream); |
446 | static orig_freopen64_t orig_freopen64 = NULL; | 446 | static orig_freopen64_t orig_freopen64 = NULL; |
447 | FILE *freopen64(const char *pathname, const char *mode, FILE *stream) { | 447 | FILE *freopen64(const char *pathname, const char *mode, FILE *stream) { |
@@ -458,7 +458,7 @@ FILE *freopen64(const char *pathname, const char *mode, FILE *stream) { | |||
458 | FILE *rv = orig_freopen64(pathname, mode, stream); | 458 | FILE *rv = orig_freopen64(pathname, mode, stream); |
459 | return rv; | 459 | return rv; |
460 | } | 460 | } |
461 | #endif /* __GLIBC__ */ | 461 | #endif |
462 | 462 | ||
463 | // unlink | 463 | // unlink |
464 | typedef int (*orig_unlink_t)(const char *pathname); | 464 | typedef int (*orig_unlink_t)(const char *pathname); |
@@ -565,7 +565,7 @@ int stat(const char *pathname, struct stat *buf) { | |||
565 | return rv; | 565 | return rv; |
566 | } | 566 | } |
567 | 567 | ||
568 | #ifdef __GLIBC__ | 568 | #ifndef stat64 |
569 | typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *buf); | 569 | typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *buf); |
570 | static orig_stat64_t orig_stat64 = NULL; | 570 | static orig_stat64_t orig_stat64 = NULL; |
571 | int stat64(const char *pathname, struct stat64 *buf) { | 571 | int stat64(const char *pathname, struct stat64 *buf) { |
@@ -582,7 +582,7 @@ int stat64(const char *pathname, struct stat64 *buf) { | |||
582 | int rv = orig_stat64(pathname, buf); | 582 | int rv = orig_stat64(pathname, buf); |
583 | return rv; | 583 | return rv; |
584 | } | 584 | } |
585 | #endif /* __GLIBC__ */ | 585 | #endif |
586 | 586 | ||
587 | typedef int (*orig_lstat_t)(const char *pathname, struct stat *buf); | 587 | typedef int (*orig_lstat_t)(const char *pathname, struct stat *buf); |
588 | static orig_lstat_t orig_lstat = NULL; | 588 | static orig_lstat_t orig_lstat = NULL; |
@@ -601,7 +601,7 @@ int lstat(const char *pathname, struct stat *buf) { | |||
601 | return rv; | 601 | return rv; |
602 | } | 602 | } |
603 | 603 | ||
604 | #ifdef __GLIBC__ | 604 | #ifndef lstat64 |
605 | typedef int (*orig_lstat64_t)(const char *pathname, struct stat64 *buf); | 605 | typedef int (*orig_lstat64_t)(const char *pathname, struct stat64 *buf); |
606 | static orig_lstat64_t orig_lstat64 = NULL; | 606 | static orig_lstat64_t orig_lstat64 = NULL; |
607 | int lstat64(const char *pathname, struct stat64 *buf) { | 607 | int lstat64(const char *pathname, struct stat64 *buf) { |
@@ -618,7 +618,7 @@ int lstat64(const char *pathname, struct stat64 *buf) { | |||
618 | int rv = orig_lstat64(pathname, buf); | 618 | int rv = orig_lstat64(pathname, buf); |
619 | return rv; | 619 | return rv; |
620 | } | 620 | } |
621 | #endif /* __GLIBC__ */ | 621 | #endif |
622 | 622 | ||
623 | // access | 623 | // access |
624 | typedef int (*orig_access_t)(const char *pathname, int mode); | 624 | typedef int (*orig_access_t)(const char *pathname, int mode); |