summaryrefslogtreecommitdiff
path: root/rsync
Unidiff
Diffstat (limited to 'rsync') (more/less context) (ignore whitespace changes)
-rw-r--r--rsync/config_linux.h2
-rw-r--r--rsync/trace.h40
2 files changed, 16 insertions, 26 deletions
diff --git a/rsync/config_linux.h b/rsync/config_linux.h
index e5ff3e4..f488b78 100644
--- a/rsync/config_linux.h
+++ b/rsync/config_linux.h
@@ -14,25 +14,25 @@
14#define STDC_HEADERS 1 14#define STDC_HEADERS 1
15 15
16/* Define this if your sockaddr structure contains sin_len */ 16/* Define this if your sockaddr structure contains sin_len */
17/* #undef HAVE_SOCK_SIN_LEN */ 17/* #undef HAVE_SOCK_SIN_LEN */
18 18
19/* How many bits would you like to have in an off_t? */ 19/* How many bits would you like to have in an off_t? */
20#define _FILE_OFFSET_BITS 64 20#define _FILE_OFFSET_BITS 64
21 21
22/* Define to include GNU C library extensions. */ 22/* Define to include GNU C library extensions. */
23#define _GNU_SOURCE 1 23#define _GNU_SOURCE 1
24 24
25/* GNU extension of saving argv[0] to program_invocation_short_name */ 25/* GNU extension of saving argv[0] to program_invocation_short_name */
26#define HAVE_PROGRAM_INVOCATION_NAME 1 26/* #define HAVE_PROGRAM_INVOCATION_NAME 1 */
27 27
28/* Define to a replacement type if intmax_t is not a builtin, or in 28/* Define to a replacement type if intmax_t is not a builtin, or in
29 sys/types.h or stdlib.h or stddef.h */ 29 sys/types.h or stdlib.h or stddef.h */
30/* #undef intmax_t */ 30/* #undef intmax_t */
31 31
32/* The number of bytes in a int. */ 32/* The number of bytes in a int. */
33#define SIZEOF_INT 4 33#define SIZEOF_INT 4
34 34
35/* The number of bytes in a long. */ 35/* The number of bytes in a long. */
36#define SIZEOF_LONG 4 36#define SIZEOF_LONG 4
37 37
38/* The number of bytes in a off_t. */ 38/* The number of bytes in a off_t. */
diff --git a/rsync/trace.h b/rsync/trace.h
index 60a6477..2bb8552 100644
--- a/rsync/trace.h
+++ b/rsync/trace.h
@@ -27,94 +27,84 @@
27 * whether such information should be included. 27 * whether such information should be included.
28 */ 28 */
29 29
30 30
31/* 31/*
32 * trace may be turned off. 32 * trace may be turned off.
33 * 33 *
34 * error is always on, but you can return and continue in some way 34 * error is always on, but you can return and continue in some way
35 * 35 *
36 * fatal terminates the whole process 36 * fatal terminates the whole process
37 */ 37 */
38 38
39void rs_fatal0(char const *s, ...); 39#if defined(HAVE_VARARG_MACROS) && defined(__GNUC__)
40void rs_error0(char const *s, ...); 40/*
41void rs_trace0(char const *s, ...); 41 * TODO: Don't assume this is a gcc thing; rather test in autoconf for
42 42 * support for __FUNCTION__. One simple way might just be to try compiling
43void rs_log0_nofn(int level, char const *fmt, ...); 43 * the definition of one of these functions!
44 44 *
45#ifdef __GNUC__ 45 * TODO: Also look for the C9X predefined identifier `_function', or
46 * whatever it's called.
47 */
46 48
47void rs_log0(int level, char const *fn, char const *fmt, ...) 49void rs_log0(int level, char const *fn, char const *fmt, ...)
48 __attribute__ ((format(printf, 3, 4))); 50 __attribute__ ((format(printf, 3, 4)));
49 51
50#ifdef DO_RS_TRACE 52#ifdef DO_RS_TRACE
51# define rs_trace(fmt, arg...) \ 53# define rs_trace(fmt, arg...) \
52 do { rs_log0(RS_LOG_DEBUG, __FUNCTION__, fmt , ##arg); \ 54 do { rs_log0(RS_LOG_DEBUG, __FUNCTION__, fmt , ##arg); \
53 } while (0) 55 } while (0)
54#else 56#else
55# define rs_trace(s, str...) 57# define rs_trace(fmt, arg...)
56 #endif/* !DO_RS_TRACE */ 58 #endif/* !DO_RS_TRACE */
57 59
58/*
59 * TODO: Don't assume this is a gcc thing; rather test in autoconf for
60 * support for __FUNCTION__ and varargs macros. One simple way might
61 * just be to try compiling the definition of one of these functions!
62 *
63 * TODO: Also look for the C9X predefined identifier `_function', or
64 * whatever it's called.
65 */
66
67#define rs_log(l, s, str...) do { \ 60#define rs_log(l, s, str...) do { \
68 rs_log0((l), __FUNCTION__, (s) , ##str); \ 61 rs_log0((l), __FUNCTION__, (s) , ##str); \
69 } while (0) 62 } while (0)
70 63
71 64
72#define rs_error(s, str...) do { \ 65#define rs_error(s, str...) do { \
73 rs_log0(RS_LOG_ERR, __FUNCTION__, (s) , ##str); \ 66 rs_log0(RS_LOG_ERR, __FUNCTION__, (s) , ##str); \
74 } while (0) 67 } while (0)
75 68
76 69
77#define rs_fatal(s, str...) do { \ 70#define rs_fatal(s, str...) do { \
78 rs_log0(RS_LOG_CRIT, __FUNCTION__, \ 71 rs_log0(RS_LOG_CRIT, __FUNCTION__, \
79 (s) , ##str); \ 72 (s) , ##str); \
80 abort(); \ 73 abort(); \
81 } while (0) 74 } while (0)
82 75
83 76
84#else /************************* ! __GNUC__ */ 77#else /************************* ! __GNUC__ */
85 78# define rs_trace rs_trace0
86# define rs_fatal rs_fatal0 79# define rs_fatal rs_fatal0
87# define rs_error rs_error0 80# define rs_error rs_error0
88# define rs_log rs_log0_nofn 81# define rs_log rs_log0_nofn
89
90# ifdef DO_RS_TRACE
91# define rs_trace rs_trace0
92 # endif /* DO_RS_TRACE */
93 #endif /* ! __GNUC__ */ 82 #endif /* ! __GNUC__ */
94 83
95 84void rs_trace0(char const *s, ...);
85void rs_fatal0(char const *s, ...);
86void rs_error0(char const *s, ...);
96void rs_log0(int level, char const *fn, char const *fmt, ...); 87void rs_log0(int level, char const *fn, char const *fmt, ...);
97 88void rs_log0_nofn(int level, char const *fmt, ...);
98 89
99enum { 90enum {
100 RS_LOG_PRIMASK = 7, /**< Mask to extract priority 91 RS_LOG_PRIMASK = 7, /**< Mask to extract priority
101 part. \internal */ 92 part. \internal */
102 93
103 RS_LOG_NONAME = 8 /**< \b Don't show function name in 94 RS_LOG_NONAME = 8 /**< \b Don't show function name in
104 message. */ 95 message. */
105}; 96};
106 97
107 98
108
109/** 99/**
110 * \macro rs_trace_enabled() 100 * \macro rs_trace_enabled()
111 * 101 *
112 * Call this before putting too much effort into generating trace 102 * Call this before putting too much effort into generating trace
113 * messages. 103 * messages.
114 */ 104 */
115 105
116extern int rs_trace_level; 106extern int rs_trace_level;
117 107
118#ifdef DO_RS_TRACE 108#ifdef DO_RS_TRACE
119# define rs_trace_enabled() ((rs_trace_level & RS_LOG_PRIMASK) >= RS_LOG_DEBUG) 109# define rs_trace_enabled() ((rs_trace_level & RS_LOG_PRIMASK) >= RS_LOG_DEBUG)
120#else 110#else