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
@@ -1,58 +1,58 @@
1/* config.h. Generated automatically by configure. */ 1/* config.h. Generated automatically by configure. */
2/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */ 2/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */
3 3
4/* Define to empty if the keyword does not work. */ 4/* Define to empty if the keyword does not work. */
5/* #undef const */ 5/* #undef const */
6 6
7/* Define to `long' if <sys/types.h> doesn't define. */ 7/* Define to `long' if <sys/types.h> doesn't define. */
8/* #undef off_t */ 8/* #undef off_t */
9 9
10/* Define to `unsigned' if <sys/types.h> doesn't define. */ 10/* Define to `unsigned' if <sys/types.h> doesn't define. */
11/* #undef size_t */ 11/* #undef size_t */
12 12
13/* Define if you have the ANSI C header files. */ 13/* Define if you have the ANSI C header files. */
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. */
39#define SIZEOF_OFF_T 8 39#define SIZEOF_OFF_T 8
40 40
41/* The number of bytes in a short. */ 41/* The number of bytes in a short. */
42#define SIZEOF_SHORT 2 42#define SIZEOF_SHORT 2
43 43
44/* The number of bytes in a size_t. */ 44/* The number of bytes in a size_t. */
45#define SIZEOF_SIZE_T 4 45#define SIZEOF_SIZE_T 4
46 46
47/* The number of bytes in a unsigned char. */ 47/* The number of bytes in a unsigned char. */
48#define SIZEOF_UNSIGNED_CHAR 1 48#define SIZEOF_UNSIGNED_CHAR 1
49 49
50/* The number of bytes in a unsigned int. */ 50/* The number of bytes in a unsigned int. */
51#define SIZEOF_UNSIGNED_INT 4 51#define SIZEOF_UNSIGNED_INT 4
52 52
53/* The number of bytes in a unsigned long. */ 53/* The number of bytes in a unsigned long. */
54#define SIZEOF_UNSIGNED_LONG 4 54#define SIZEOF_UNSIGNED_LONG 4
55 55
56/* The number of bytes in a unsigned short. */ 56/* The number of bytes in a unsigned short. */
57#define SIZEOF_UNSIGNED_SHORT 2 57#define SIZEOF_UNSIGNED_SHORT 2
58 58
diff --git a/rsync/trace.h b/rsync/trace.h
index 60a6477..2bb8552 100644
--- a/rsync/trace.h
+++ b/rsync/trace.h
@@ -7,116 +7,106 @@
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by 9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or 10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details. 16 * GNU Lesser General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Lesser General Public License 18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */ 21 */
22 22
23 23
24/* 24/*
25 * TODO: A function like perror that includes strerror output. Apache 25 * TODO: A function like perror that includes strerror output. Apache
26 * does this by adding flags as well as the severity level which say 26 * does this by adding flags as well as the severity level which say
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
121# define rs_trace_enabled() 0 111# define rs_trace_enabled() 0
122#endif 112#endif