~andreserl/ubuntu/lucid/bind9/bind9-apport-533601

« back to all changes in this revision

Viewing changes to lib/isc/log.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones, LaMont Jones, Internet Software Consortium, Inc, localization folks
  • Date: 2008-08-02 14:20:20 UTC
  • mfrom: (1.2.1 upstream) (6.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080802142020-l1hon9jy8lbbjxmg
[LaMont Jones]

* default to using resolvconf if it is installed
* fix sonames and dependencies.  Closes: #149259, #492418
* Do not build-depend libcap2-dev on non-linux.  Closes: #493392
* drop unused query-loc manpage.  Closes: #492564
* lwresd: Deliver /etc/bind directory.  Closes: #490027
* fix query-source comment in default install

[Internet Software Consortium, Inc]

* 9.5.0-P2.  Closes: #492949

[localization folks]

* l10n: Spanish debconf translation.  Closes: #492425 (Ignacio Mondino)
* l10n: Swedish debconf templates.  Closes: #491369 (Martin Ågren)
* l10n: Japanese debconf translations.  Closes: #492048 (Hideki Yamane
  (Debian-JP))
* l10n: Finnish translation.  Closes: #490630 (Esko Arajärvi)
* l10n: Italian debconf translations.  Closes: #492587 (Alessandro Vietta)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 
2
 * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
3
3
 * Copyright (C) 1999-2003  Internet Software Consortium.
4
4
 *
5
 
 * Permission to use, copy, modify, and distribute this software for any
 
5
 * Permission to use, copy, modify, and/or distribute this software for any
6
6
 * purpose with or without fee is hereby granted, provided that the above
7
7
 * copyright notice and this permission notice appear in all copies.
8
8
 *
15
15
 * PERFORMANCE OF THIS SOFTWARE.
16
16
 */
17
17
 
18
 
/* $Id: log.c,v 1.70.2.8.2.12 2004/06/11 00:35:38 marka Exp $ */
 
18
/* $Id: log.c,v 1.94 2007/06/19 23:47:17 tbox Exp $ */
19
19
 
20
 
/* Principal Authors: DCL */
 
20
/*! \file
 
21
 * \author  Principal Authors: DCL */
21
22
 
22
23
#include <config.h>
23
24
 
56
57
#define PATH_MAX 1024   /* AIX and others don't define this. */
57
58
#endif
58
59
 
59
 
/*
 
60
/*!
60
61
 * This is the structure that holds each named channel.  A simple linked
61
62
 * list chains all of the channels together, so an individual channel is
62
63
 * found by doing strcmp()s with the names down the list.  Their should
76
77
        ISC_LINK(isc_logchannel_t)      link;
77
78
};
78
79
 
79
 
/*
 
80
/*!
80
81
 * The logchannellist structure associates categories and modules with
81
82
 * channels.  First the appropriate channellist is found based on the
82
83
 * category, and then each structure in the linked list is checked for
92
93
        ISC_LINK(isc_logchannellist_t)  link;
93
94
};
94
95
 
95
 
/*
 
96
/*!
96
97
 * This structure is used to remember messages for pruning via
97
98
 * isc_log_[v]write1().
98
99
 */
104
105
        ISC_LINK(isc_logmessage_t)      link;
105
106
};
106
107
 
107
 
/*
 
108
/*!
108
109
 * The isc_logconfig structure is used to store the configurable information
109
110
 * about where messages are actually supposed to be sent -- the information
110
111
 * that could changed based on some configuration file, as opposed to the
123
124
        isc_boolean_t                   dynamic;
124
125
};
125
126
 
126
 
/*
 
127
/*!
127
128
 * This isc_log structure provides the context for the isc_log functions.
128
129
 * The log context locks itself in isc_log_doit, the internal backend to
129
130
 * isc_log_write.  The locking is necessary both to provide exclusive access
156
157
        ISC_LIST(isc_logmessage_t)      messages;
157
158
};
158
159
 
159
 
/*
 
160
/*!
160
161
 * Used when ISC_LOG_PRINTLEVEL is enabled for a channel.
161
162
 */
162
163
static const char *log_level_strings[] = {
168
169
        "critical"
169
170
};
170
171
 
171
 
/*
 
172
/*!
172
173
 * Used to convert ISC_LOG_* priorities into syslog priorities.
173
174
 * XXXDCL This will need modification for NT.
174
175
 */
181
182
        LOG_CRIT
182
183
};
183
184
 
184
 
/*
 
185
/*!
185
186
 * When adding new categories, a corresponding ISC_LOGCATEGORY_foo
186
187
 * definition needs to be added to <isc/log.h>.
187
188
 *
195
196
        { NULL, 0 }
196
197
};
197
198
 
198
 
/*
199
 
 * See above comment for categories, and apply it to modules.
 
199
/*!
 
200
 * See above comment for categories on LIBISC_EXTERNAL_DATA, and apply it to modules.
200
201
 */
201
202
LIBISC_EXTERNAL_DATA isc_logmodule_t isc_modules[] = {
202
203
        { "socket", 0 },
206
207
        { NULL, 0 }
207
208
};
208
209
 
209
 
/*
 
210
/*!
210
211
 * This essentially constant structure must be filled in at run time,
211
212
 * because its channel member is pointed to a channel that is created
212
213
 * dynamically with isc_log_createchannel.
213
214
 */
214
215
static isc_logchannellist_t default_channel;
215
216
 
216
 
/*
 
217
/*!
217
218
 * libisc logs to this context.
218
219
 */
219
220
LIBISC_EXTERNAL_DATA isc_log_t *isc_lctx = NULL;
220
221
 
221
 
/*
 
222
/*!
222
223
 * Forward declarations.
223
224
 */
224
225
static isc_result_t
241
242
             const char *format, va_list args)
242
243
     ISC_FORMAT_PRINTF(9, 0);
243
244
 
244
 
/*
 
245
/*@{*/
 
246
/*!
245
247
 * Convenience macros.
246
248
 */
247
249
 
252
254
#define FILE_MAXSIZE(channel)    (channel->destination.file.maximum_size)
253
255
#define FILE_MAXREACHED(channel) (channel->destination.file.maximum_reached)
254
256
 
 
257
/*@}*/
255
258
/****
256
259
 **** Public interfaces.
257
260
 ****/
280
283
 
281
284
                ISC_LIST_INIT(lctx->messages);
282
285
 
283
 
                RUNTIME_CHECK(isc_mutex_init(&lctx->lock) == ISC_R_SUCCESS);
 
286
                result = isc_mutex_init(&lctx->lock);
 
287
                if (result != ISC_R_SUCCESS) {
 
288
                        isc_mem_put(mctx, lctx, sizeof(*lctx));
 
289
                        return (result);
 
290
                }
284
291
 
285
292
                /*
286
293
                 * Normally setting the magic number is the last step done
1728
1735
                                syslog_level = syslog_map[-level];
1729
1736
 
1730
1737
                        (void)syslog(FACILITY(channel) | syslog_level,
1731
 
                               "%s%s%s%s%s%s%s%s%s",
 
1738
                               "%s%s%s%s%s%s%s%s%s%s",
1732
1739
                               printtime     ? time_string      : "",
 
1740
                               printtime     ? " "              : "",
1733
1741
                               printtag      ? lcfg->tag        : "",
1734
1742
                               printtag      ? ": "             : "",
1735
1743
                               printcategory ? category->name   : "",