2000-02-09 01:28:47 +05:30
|
|
|
/* vi: set sw=4 ts=4: */
|
1999-11-25 13:00:46 +05:30
|
|
|
/*
|
|
|
|
* Mini syslogd implementation for busybox
|
|
|
|
*
|
2004-03-15 13:59:22 +05:30
|
|
|
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
1999-11-25 13:00:46 +05:30
|
|
|
*
|
2000-04-19 05:21:51 +05:30
|
|
|
* Copyright (C) 2000 by Karl M. Hegbloom <karlheg@debian.org>
|
|
|
|
*
|
2002-12-12 16:24:48 +05:30
|
|
|
* "circular buffer" Copyright (C) 2001 by Gennady Feldman <gfeldman@gena01.com>
|
2001-03-13 04:21:50 +05:30
|
|
|
*
|
2002-12-12 16:24:48 +05:30
|
|
|
* Maintainer: Gennady Feldman <gfeldman@gena01.com> as of Mar 12, 2001
|
2001-03-13 05:11:34 +05:30
|
|
|
*
|
2006-01-23 04:25:11 +05:30
|
|
|
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
|
1999-11-25 13:00:46 +05:30
|
|
|
*/
|
1999-11-24 14:34:33 +05:30
|
|
|
|
2006-06-03 02:26:16 +05:30
|
|
|
#include "busybox.h"
|
2000-04-04 23:44:25 +05:30
|
|
|
#include <paths.h>
|
2004-06-22 15:42:59 +05:30
|
|
|
#include <stdbool.h>
|
1999-11-24 14:34:33 +05:30
|
|
|
#include <sys/un.h>
|
2000-06-19 23:18:02 +05:30
|
|
|
|
1999-11-25 13:00:46 +05:30
|
|
|
/* SYSLOG_NAMES defined to pull some extra junk from syslog.h */
|
|
|
|
#define SYSLOG_NAMES
|
|
|
|
#include <sys/syslog.h>
|
2000-07-21 05:11:24 +05:30
|
|
|
#include <sys/uio.h>
|
1999-11-25 13:00:46 +05:30
|
|
|
|
2000-04-04 23:44:25 +05:30
|
|
|
/* Path to the unix socket */
|
2002-09-18 01:36:29 +05:30
|
|
|
static char lfile[MAXPATHLEN];
|
1999-11-25 13:00:46 +05:30
|
|
|
|
2006-10-01 00:50:00 +05:30
|
|
|
/* Path for the file where all log messages are written */
|
|
|
|
static const char *logFilePath = "/var/log/messages";
|
2000-02-09 01:28:47 +05:30
|
|
|
|
2003-10-09 15:13:18 +05:30
|
|
|
#ifdef CONFIG_FEATURE_ROTATE_LOGFILE
|
2004-04-14 23:21:38 +05:30
|
|
|
/* max size of message file before being rotated */
|
2003-10-09 15:13:18 +05:30
|
|
|
static int logFileSize = 200 * 1024;
|
|
|
|
|
|
|
|
/* number of rotated message files */
|
|
|
|
static int logFileRotate = 1;
|
|
|
|
#endif
|
|
|
|
|
1999-11-25 13:00:46 +05:30
|
|
|
/* interval between marks in seconds */
|
2000-02-09 01:28:47 +05:30
|
|
|
static int MarkInterval = 20 * 60;
|
|
|
|
|
2006-10-01 00:47:40 +05:30
|
|
|
/* level of messages to be locally logged */
|
|
|
|
static int logLevel = 8;
|
|
|
|
|
1999-11-25 13:00:46 +05:30
|
|
|
/* localhost's name */
|
2002-09-18 01:36:29 +05:30
|
|
|
static char LocalHostName[64];
|
1999-11-24 14:34:33 +05:30
|
|
|
|
2001-10-24 10:30:29 +05:30
|
|
|
#ifdef CONFIG_FEATURE_REMOTE_LOG
|
2000-07-21 05:11:24 +05:30
|
|
|
#include <netinet/in.h>
|
|
|
|
/* udp socket for logging to remote host */
|
2000-12-09 01:22:01 +05:30
|
|
|
static int remotefd = -1;
|
2004-08-27 04:45:29 +05:30
|
|
|
static struct sockaddr_in remoteaddr;
|
2002-11-11 04:16:45 +05:30
|
|
|
|
2000-07-21 05:11:24 +05:30
|
|
|
#endif
|
|
|
|
|
- merge -r15463:15564 from busybox_scratch branch through these changesets:
------------------------------------------------------------------------
r15465 | aldot | 2006-06-21 20:48:06 +0200 (Wed, 21 Jun 2006) | 3 lines
- use CONFIG_BUSYBOX_EXEC_PATH as before it one was broken by a recent revert.
- use xchdir() since all is invain if it fails there anyways, supposedly
------------------------------------------------------------------------
r15466 | aldot | 2006-06-21 20:55:16 +0200 (Wed, 21 Jun 2006) | 2 lines
- adjust docs to take CONFIG_BUSYBOX_EXEC_PATH into account.
------------------------------------------------------------------------
r15467 | aldot | 2006-06-21 21:31:24 +0200 (Wed, 21 Jun 2006) | 18 lines
- partial fallout of my TREE_USED touchup against gcc-4.2: rip unused vars, save
s 144 bytes
text data bss dec hex filename
862434 10156 645924 1518514 172bb2 busybox.old
862322 10156 645892 1518370 172b22 busybox
function old new delta
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
new_text 70 60 -10
ipaddr_list_link 33 23 -10
gzip_main 898 822 -76
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 0/3 up/down: 0/-120) Total: -120 bytes
------------------------------------------------------------------------
r15468 | aldot | 2006-06-21 21:43:05 +0200 (Wed, 21 Jun 2006) | 19 lines
- remove useless global exports
function old new delta
rpm_main 940 1601 +661
rpm_getstring 107 112 +5
rpm_getint 148 153 +5
loop_through_files 103 106 +3
fileaction_dobackup 115 113 -2
fileaction_list 5 - -5
rpm_getcount 42 - -42
extract_cpio_gz 161 - -161
rpm_gettags 504 - -504
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/1 up/down: 674/-714) Total: -40 bytes
text data bss dec hex filename
862322 10156 645892 1518370 172b22 busybox.old
862290 10156 645892 1518338 172b02 busybox
------------------------------------------------------------------------
r15555 | aldot | 2006-06-30 14:10:11 +0200 (Fri, 30 Jun 2006) | 22 lines
- shrink syslog a little bit, move a big buffer (for 'line') off the bss, fold s
emaphore stuff into single caller manually.
stats:
function old new delta
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
small 1 - -1
local_logging 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
syslogd_main 1299 1285 -14
static.res 36 16 -20
.rodata 186650 186586 -64
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/5 grow/shrink: 2/3 up/down: 48/-1136) Total: -1088 bytes
cow@s37:~/src/busybox_scratch$ size sysklogd/syslogd.o{.orig,}
text data bss dec hex filename
3723 348 5242 9313 2461 sysklogd/syslogd.o.orig
3697 348 4188 8233 2029 sysklogd/syslogd.o
==============================================================================
Overall bloatcheck for the changeset mentioned above:
function old new delta
rpm_main 953 1608 +655
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
rpm_getstring 107 110 +3
rpm_getint 148 151 +3
loop_through_files 103 104 +1
small 1 - -1
fileaction_dobackup 115 113 -2
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
local_logging 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
fileaction_list 5 - -5
new_text 70 60 -10
ipaddr_list_link 33 23 -10
clear_bufs 31 21 -10
syslogd_main 1287 1273 -14
builtin_help 190 176 -14
static.res 36 16 -20
builtin_source 229 199 -30
rpm_getcount 42 - -42
gzip_main 842 786 -56
.rodata 227176 227112 -64
lash_main 609 527 -82
busy_loop 3883 3739 -144
extract_cpio_gz 155 - -155
rpm_gettags 501 - -501
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/15 grow/shrink: 6/12 up/down: 710/-2221) Total: -1511 bytes
2006-08-20 23:05:13 +05:30
|
|
|
/* options */
|
2006-10-01 00:50:00 +05:30
|
|
|
/* Correct regardless of combination of CONFIG_xxx */
|
|
|
|
enum {
|
|
|
|
OPTBIT_mark = 0, // -m
|
|
|
|
OPTBIT_nofork, // -n
|
|
|
|
OPTBIT_outfile, // -O
|
|
|
|
OPTBIT_loglevel, // -l
|
|
|
|
OPTBIT_small, // -S
|
|
|
|
USE_FEATURE_ROTATE_LOGFILE(OPTBIT_filesize ,) // -s
|
|
|
|
USE_FEATURE_ROTATE_LOGFILE(OPTBIT_rotatecnt ,) // -b
|
|
|
|
USE_FEATURE_REMOTE_LOG( OPTBIT_remote ,) // -R
|
|
|
|
USE_FEATURE_REMOTE_LOG( OPTBIT_localtoo ,) // -L
|
|
|
|
USE_FEATURE_IPC_SYSLOG( OPTBIT_circularlog,) // -C
|
|
|
|
|
|
|
|
OPT_mark = 1 << OPTBIT_mark ,
|
|
|
|
OPT_nofork = 1 << OPTBIT_nofork ,
|
|
|
|
OPT_outfile = 1 << OPTBIT_outfile ,
|
|
|
|
OPT_loglevel = 1 << OPTBIT_loglevel,
|
|
|
|
OPT_small = 1 << OPTBIT_small ,
|
|
|
|
OPT_filesize = USE_FEATURE_ROTATE_LOGFILE((1 << OPTBIT_filesize )) + 0,
|
|
|
|
OPT_rotatecnt = USE_FEATURE_ROTATE_LOGFILE((1 << OPTBIT_rotatecnt )) + 0,
|
|
|
|
OPT_remotelog = USE_FEATURE_REMOTE_LOG( (1 << OPTBIT_remote )) + 0,
|
|
|
|
OPT_locallog = USE_FEATURE_REMOTE_LOG( (1 << OPTBIT_localtoo )) + 0,
|
|
|
|
OPT_circularlog = USE_FEATURE_IPC_SYSLOG( (1 << OPTBIT_circularlog)) + 0,
|
|
|
|
};
|
|
|
|
#define OPTION_STR "m:nO:l:S" \
|
|
|
|
USE_FEATURE_ROTATE_LOGFILE("s:" ) \
|
|
|
|
USE_FEATURE_ROTATE_LOGFILE("b:" ) \
|
|
|
|
USE_FEATURE_REMOTE_LOG( "R:" ) \
|
|
|
|
USE_FEATURE_REMOTE_LOG( "L" ) \
|
|
|
|
USE_FEATURE_IPC_SYSLOG( "C::")
|
|
|
|
#define OPTION_DECL *opt_m, *opt_l \
|
|
|
|
USE_FEATURE_ROTATE_LOGFILE(,*opt_s) \
|
|
|
|
USE_FEATURE_ROTATE_LOGFILE(,*opt_b) \
|
|
|
|
USE_FEATURE_REMOTE_LOG( ,*opt_R) \
|
|
|
|
USE_FEATURE_IPC_SYSLOG( ,*opt_C = NULL)
|
|
|
|
#define OPTION_PARAM &opt_m, &logFilePath, &opt_l \
|
|
|
|
USE_FEATURE_ROTATE_LOGFILE(,&opt_s) \
|
|
|
|
USE_FEATURE_ROTATE_LOGFILE(,&opt_b) \
|
|
|
|
USE_FEATURE_REMOTE_LOG( ,&opt_R) \
|
|
|
|
USE_FEATURE_IPC_SYSLOG( ,&opt_C)
|
2002-09-18 01:36:29 +05:30
|
|
|
|
2002-11-11 04:16:45 +05:30
|
|
|
#define MAXLINE 1024 /* maximum line length */
|
2002-09-18 01:36:29 +05:30
|
|
|
|
2001-03-13 04:21:50 +05:30
|
|
|
/* circular buffer variables/structures */
|
2001-10-24 10:30:29 +05:30
|
|
|
#ifdef CONFIG_FEATURE_IPC_SYSLOG
|
2003-12-19 17:02:14 +05:30
|
|
|
|
|
|
|
#if CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE < 4
|
|
|
|
#error Sorry, you must set the syslogd buffer size to at least 4KB.
|
|
|
|
#error Please check CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE
|
|
|
|
#endif
|
|
|
|
|
2001-03-13 04:21:50 +05:30
|
|
|
#include <sys/ipc.h>
|
|
|
|
#include <sys/sem.h>
|
|
|
|
#include <sys/shm.h>
|
|
|
|
|
|
|
|
/* our shared key */
|
2006-10-01 00:50:00 +05:30
|
|
|
#define KEY_ID ((long)0x414e4547) /* "GENA" */
|
2001-03-13 04:21:50 +05:30
|
|
|
|
|
|
|
// Semaphore operation structures
|
|
|
|
static struct shbuf_ds {
|
2006-10-01 00:50:00 +05:30
|
|
|
int size; // size of data written
|
|
|
|
int head; // start of message list
|
|
|
|
int tail; // end of message list
|
|
|
|
char data[1]; // data/messages
|
|
|
|
} *shbuf = NULL; // shared memory pointer
|
2002-11-11 04:16:45 +05:30
|
|
|
|
|
|
|
static struct sembuf SMwup[1] = { {1, -1, IPC_NOWAIT} }; // set SMwup
|
|
|
|
static struct sembuf SMwdn[3] = { {0, 0}, {1, 0}, {1, +1} }; // set SMwdn
|
|
|
|
|
2006-10-01 00:50:00 +05:30
|
|
|
static int shmid = -1; // ipc shared memory id
|
|
|
|
static int s_semid = -1; // ipc semaphore id
|
2003-12-19 17:02:14 +05:30
|
|
|
static int shm_size = ((CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE)*1024); // default shm size
|
2002-09-18 01:36:29 +05:30
|
|
|
|
2005-09-22 18:29:26 +05:30
|
|
|
static void ipcsyslog_cleanup(void)
|
2002-11-11 04:16:45 +05:30
|
|
|
{
|
2006-10-01 00:50:00 +05:30
|
|
|
puts("Exiting syslogd!");
|
2002-11-11 04:16:45 +05:30
|
|
|
if (shmid != -1) {
|
2006-10-01 00:50:00 +05:30
|
|
|
shmdt(shbuf);
|
2002-11-11 04:16:45 +05:30
|
|
|
}
|
2001-03-13 04:21:50 +05:30
|
|
|
|
2002-11-11 04:16:45 +05:30
|
|
|
if (shmid != -1) {
|
2001-03-13 04:21:50 +05:30
|
|
|
shmctl(shmid, IPC_RMID, NULL);
|
2002-11-11 04:16:45 +05:30
|
|
|
}
|
|
|
|
if (s_semid != -1) {
|
2001-03-13 04:21:50 +05:30
|
|
|
semctl(s_semid, 0, IPC_RMID, 0);
|
2002-11-11 04:16:45 +05:30
|
|
|
}
|
2001-03-13 04:21:50 +05:30
|
|
|
}
|
|
|
|
|
2005-09-22 18:29:26 +05:30
|
|
|
static void ipcsyslog_init(void)
|
2002-11-11 04:16:45 +05:30
|
|
|
{
|
2006-10-01 00:50:00 +05:30
|
|
|
if (shbuf == NULL) {
|
|
|
|
shmid = shmget(KEY_ID, shm_size, IPC_CREAT | 1023);
|
|
|
|
if (shmid == -1) {
|
2003-03-19 14:43:01 +05:30
|
|
|
bb_perror_msg_and_die("shmget");
|
2002-11-11 04:16:45 +05:30
|
|
|
}
|
2001-03-13 04:21:50 +05:30
|
|
|
|
2006-10-01 00:50:00 +05:30
|
|
|
shbuf = shmat(shmid, NULL, 0);
|
|
|
|
if (!shbuf) {
|
2003-03-19 14:43:01 +05:30
|
|
|
bb_perror_msg_and_die("shmat");
|
2002-11-11 04:16:45 +05:30
|
|
|
}
|
2001-03-13 04:21:50 +05:30
|
|
|
|
2006-10-01 00:50:00 +05:30
|
|
|
shbuf->size = shm_size - sizeof(*shbuf);
|
|
|
|
shbuf->head = shbuf->tail = 0;
|
2001-03-13 04:21:50 +05:30
|
|
|
|
2002-11-11 04:16:45 +05:30
|
|
|
// we'll trust the OS to set initial semval to 0 (let's hope)
|
2006-10-01 00:50:00 +05:30
|
|
|
s_semid = semget(KEY_ID, 2, IPC_CREAT | IPC_EXCL | 1023);
|
|
|
|
if (s_semid == -1) {
|
2002-11-11 04:16:45 +05:30
|
|
|
if (errno == EEXIST) {
|
2006-10-01 00:50:00 +05:30
|
|
|
s_semid = semget(KEY_ID, 2, 0);
|
|
|
|
if (s_semid == -1) {
|
2003-03-19 14:43:01 +05:30
|
|
|
bb_perror_msg_and_die("semget");
|
2002-11-11 04:16:45 +05:30
|
|
|
}
|
|
|
|
} else {
|
2003-03-19 14:43:01 +05:30
|
|
|
bb_perror_msg_and_die("semget");
|
2002-11-11 04:16:45 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2001-03-13 04:21:50 +05:30
|
|
|
printf("Buffer already allocated just grab the semaphore?");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write message to buffer */
|
2005-09-22 18:29:26 +05:30
|
|
|
static void circ_message(const char *msg)
|
2002-11-11 04:16:45 +05:30
|
|
|
{
|
|
|
|
int l = strlen(msg) + 1; /* count the whole message w/ '\0' included */
|
- merge -r15463:15564 from busybox_scratch branch through these changesets:
------------------------------------------------------------------------
r15465 | aldot | 2006-06-21 20:48:06 +0200 (Wed, 21 Jun 2006) | 3 lines
- use CONFIG_BUSYBOX_EXEC_PATH as before it one was broken by a recent revert.
- use xchdir() since all is invain if it fails there anyways, supposedly
------------------------------------------------------------------------
r15466 | aldot | 2006-06-21 20:55:16 +0200 (Wed, 21 Jun 2006) | 2 lines
- adjust docs to take CONFIG_BUSYBOX_EXEC_PATH into account.
------------------------------------------------------------------------
r15467 | aldot | 2006-06-21 21:31:24 +0200 (Wed, 21 Jun 2006) | 18 lines
- partial fallout of my TREE_USED touchup against gcc-4.2: rip unused vars, save
s 144 bytes
text data bss dec hex filename
862434 10156 645924 1518514 172bb2 busybox.old
862322 10156 645892 1518370 172b22 busybox
function old new delta
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
new_text 70 60 -10
ipaddr_list_link 33 23 -10
gzip_main 898 822 -76
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 0/3 up/down: 0/-120) Total: -120 bytes
------------------------------------------------------------------------
r15468 | aldot | 2006-06-21 21:43:05 +0200 (Wed, 21 Jun 2006) | 19 lines
- remove useless global exports
function old new delta
rpm_main 940 1601 +661
rpm_getstring 107 112 +5
rpm_getint 148 153 +5
loop_through_files 103 106 +3
fileaction_dobackup 115 113 -2
fileaction_list 5 - -5
rpm_getcount 42 - -42
extract_cpio_gz 161 - -161
rpm_gettags 504 - -504
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/1 up/down: 674/-714) Total: -40 bytes
text data bss dec hex filename
862322 10156 645892 1518370 172b22 busybox.old
862290 10156 645892 1518338 172b02 busybox
------------------------------------------------------------------------
r15555 | aldot | 2006-06-30 14:10:11 +0200 (Fri, 30 Jun 2006) | 22 lines
- shrink syslog a little bit, move a big buffer (for 'line') off the bss, fold s
emaphore stuff into single caller manually.
stats:
function old new delta
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
small 1 - -1
local_logging 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
syslogd_main 1299 1285 -14
static.res 36 16 -20
.rodata 186650 186586 -64
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/5 grow/shrink: 2/3 up/down: 48/-1136) Total: -1088 bytes
cow@s37:~/src/busybox_scratch$ size sysklogd/syslogd.o{.orig,}
text data bss dec hex filename
3723 348 5242 9313 2461 sysklogd/syslogd.o.orig
3697 348 4188 8233 2029 sysklogd/syslogd.o
==============================================================================
Overall bloatcheck for the changeset mentioned above:
function old new delta
rpm_main 953 1608 +655
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
rpm_getstring 107 110 +3
rpm_getint 148 151 +3
loop_through_files 103 104 +1
small 1 - -1
fileaction_dobackup 115 113 -2
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
local_logging 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
fileaction_list 5 - -5
new_text 70 60 -10
ipaddr_list_link 33 23 -10
clear_bufs 31 21 -10
syslogd_main 1287 1273 -14
builtin_help 190 176 -14
static.res 36 16 -20
builtin_source 229 199 -30
rpm_getcount 42 - -42
gzip_main 842 786 -56
.rodata 227176 227112 -64
lash_main 609 527 -82
busy_loop 3883 3739 -144
extract_cpio_gz 155 - -155
rpm_gettags 501 - -501
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/15 grow/shrink: 6/12 up/down: 710/-2221) Total: -1511 bytes
2006-08-20 23:05:13 +05:30
|
|
|
const char * const fail_msg = "Can't find the terminator token%s?\n";
|
2001-03-13 04:21:50 +05:30
|
|
|
|
- merge -r15463:15564 from busybox_scratch branch through these changesets:
------------------------------------------------------------------------
r15465 | aldot | 2006-06-21 20:48:06 +0200 (Wed, 21 Jun 2006) | 3 lines
- use CONFIG_BUSYBOX_EXEC_PATH as before it one was broken by a recent revert.
- use xchdir() since all is invain if it fails there anyways, supposedly
------------------------------------------------------------------------
r15466 | aldot | 2006-06-21 20:55:16 +0200 (Wed, 21 Jun 2006) | 2 lines
- adjust docs to take CONFIG_BUSYBOX_EXEC_PATH into account.
------------------------------------------------------------------------
r15467 | aldot | 2006-06-21 21:31:24 +0200 (Wed, 21 Jun 2006) | 18 lines
- partial fallout of my TREE_USED touchup against gcc-4.2: rip unused vars, save
s 144 bytes
text data bss dec hex filename
862434 10156 645924 1518514 172bb2 busybox.old
862322 10156 645892 1518370 172b22 busybox
function old new delta
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
new_text 70 60 -10
ipaddr_list_link 33 23 -10
gzip_main 898 822 -76
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 0/3 up/down: 0/-120) Total: -120 bytes
------------------------------------------------------------------------
r15468 | aldot | 2006-06-21 21:43:05 +0200 (Wed, 21 Jun 2006) | 19 lines
- remove useless global exports
function old new delta
rpm_main 940 1601 +661
rpm_getstring 107 112 +5
rpm_getint 148 153 +5
loop_through_files 103 106 +3
fileaction_dobackup 115 113 -2
fileaction_list 5 - -5
rpm_getcount 42 - -42
extract_cpio_gz 161 - -161
rpm_gettags 504 - -504
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/1 up/down: 674/-714) Total: -40 bytes
text data bss dec hex filename
862322 10156 645892 1518370 172b22 busybox.old
862290 10156 645892 1518338 172b02 busybox
------------------------------------------------------------------------
r15555 | aldot | 2006-06-30 14:10:11 +0200 (Fri, 30 Jun 2006) | 22 lines
- shrink syslog a little bit, move a big buffer (for 'line') off the bss, fold s
emaphore stuff into single caller manually.
stats:
function old new delta
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
small 1 - -1
local_logging 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
syslogd_main 1299 1285 -14
static.res 36 16 -20
.rodata 186650 186586 -64
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/5 grow/shrink: 2/3 up/down: 48/-1136) Total: -1088 bytes
cow@s37:~/src/busybox_scratch$ size sysklogd/syslogd.o{.orig,}
text data bss dec hex filename
3723 348 5242 9313 2461 sysklogd/syslogd.o.orig
3697 348 4188 8233 2029 sysklogd/syslogd.o
==============================================================================
Overall bloatcheck for the changeset mentioned above:
function old new delta
rpm_main 953 1608 +655
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
rpm_getstring 107 110 +3
rpm_getint 148 151 +3
loop_through_files 103 104 +1
small 1 - -1
fileaction_dobackup 115 113 -2
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
local_logging 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
fileaction_list 5 - -5
new_text 70 60 -10
ipaddr_list_link 33 23 -10
clear_bufs 31 21 -10
syslogd_main 1287 1273 -14
builtin_help 190 176 -14
static.res 36 16 -20
builtin_source 229 199 -30
rpm_getcount 42 - -42
gzip_main 842 786 -56
.rodata 227176 227112 -64
lash_main 609 527 -82
busy_loop 3883 3739 -144
extract_cpio_gz 155 - -155
rpm_gettags 501 - -501
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/15 grow/shrink: 6/12 up/down: 710/-2221) Total: -1511 bytes
2006-08-20 23:05:13 +05:30
|
|
|
if (semop(s_semid, SMwdn, 3) == -1) {
|
|
|
|
bb_perror_msg_and_die("SMwdn");
|
|
|
|
}
|
2001-03-13 04:21:50 +05:30
|
|
|
|
|
|
|
/*
|
|
|
|
* Circular Buffer Algorithm:
|
|
|
|
* --------------------------
|
|
|
|
*
|
|
|
|
* Start-off w/ empty buffer of specific size SHM_SIZ
|
|
|
|
* Start filling it up w/ messages. I use '\0' as separator to break up messages.
|
|
|
|
* This is also very handy since we can do printf on message.
|
|
|
|
*
|
|
|
|
* Once the buffer is full we need to get rid of the first message in buffer and
|
|
|
|
* insert the new message. (Note: if the message being added is >1 message then
|
|
|
|
* we will need to "remove" >1 old message from the buffer). The way this is done
|
|
|
|
* is the following:
|
2002-09-18 01:36:29 +05:30
|
|
|
* When we reach the end of the buffer we set a mark and start from the beginning.
|
|
|
|
* Now what about the beginning and end of the buffer? Well we have the "head"
|
|
|
|
* index/pointer which is the starting point for the messages and we have "tail"
|
|
|
|
* index/pointer which is the ending point for the messages. When we "display" the
|
|
|
|
* messages we start from the beginning and continue until we reach "tail". If we
|
|
|
|
* reach end of buffer, then we just start from the beginning (offset 0). "head" and
|
|
|
|
* "tail" are actually offsets from the beginning of the buffer.
|
2001-03-13 04:21:50 +05:30
|
|
|
*
|
|
|
|
* Note: This algorithm uses Linux IPC mechanism w/ shared memory and semaphores to provide
|
2006-04-18 18:16:56 +05:30
|
|
|
* a threadsafe way of handling shared memory operations.
|
2001-03-13 04:21:50 +05:30
|
|
|
*/
|
2006-10-01 00:50:00 +05:30
|
|
|
if ((shbuf->tail + l) < shbuf->size) {
|
2001-03-13 04:21:50 +05:30
|
|
|
/* before we append the message we need to check the HEAD so that we won't
|
|
|
|
overwrite any of the message that we still need and adjust HEAD to point
|
|
|
|
to the next message! */
|
2006-10-01 00:50:00 +05:30
|
|
|
if (shbuf->tail < shbuf->head) {
|
|
|
|
if ((shbuf->tail + l) >= shbuf->head) {
|
2002-11-11 04:16:45 +05:30
|
|
|
/* we need to move the HEAD to point to the next message
|
|
|
|
* Theoretically we have enough room to add the whole message to the
|
|
|
|
* buffer, because of the first outer IF statement, so we don't have
|
|
|
|
* to worry about overflows here!
|
|
|
|
*/
|
2006-10-01 00:50:00 +05:30
|
|
|
/* we need to know how many bytes we are overwriting to make enough room */
|
|
|
|
int k = shbuf->tail + l - shbuf->head;
|
2002-11-11 04:16:45 +05:30
|
|
|
char *c =
|
2006-10-01 00:50:00 +05:30
|
|
|
memchr(shbuf->data + shbuf->head + k, '\0',
|
|
|
|
shbuf->size - (shbuf->head + k));
|
|
|
|
if (c != NULL) { /* do a sanity check just in case! */
|
|
|
|
/* we need to convert pointer to offset + skip the '\0'
|
|
|
|
since we need to point to the beginning of the next message */
|
|
|
|
shbuf->head = c - shbuf->data + 1;
|
2002-11-11 04:16:45 +05:30
|
|
|
/* Note: HEAD is only used to "retrieve" messages, it's not used
|
|
|
|
when writing messages into our buffer */
|
2006-10-01 00:50:00 +05:30
|
|
|
} else { /* show an error message to know we messed up? */
|
- merge -r15463:15564 from busybox_scratch branch through these changesets:
------------------------------------------------------------------------
r15465 | aldot | 2006-06-21 20:48:06 +0200 (Wed, 21 Jun 2006) | 3 lines
- use CONFIG_BUSYBOX_EXEC_PATH as before it one was broken by a recent revert.
- use xchdir() since all is invain if it fails there anyways, supposedly
------------------------------------------------------------------------
r15466 | aldot | 2006-06-21 20:55:16 +0200 (Wed, 21 Jun 2006) | 2 lines
- adjust docs to take CONFIG_BUSYBOX_EXEC_PATH into account.
------------------------------------------------------------------------
r15467 | aldot | 2006-06-21 21:31:24 +0200 (Wed, 21 Jun 2006) | 18 lines
- partial fallout of my TREE_USED touchup against gcc-4.2: rip unused vars, save
s 144 bytes
text data bss dec hex filename
862434 10156 645924 1518514 172bb2 busybox.old
862322 10156 645892 1518370 172b22 busybox
function old new delta
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
new_text 70 60 -10
ipaddr_list_link 33 23 -10
gzip_main 898 822 -76
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 0/3 up/down: 0/-120) Total: -120 bytes
------------------------------------------------------------------------
r15468 | aldot | 2006-06-21 21:43:05 +0200 (Wed, 21 Jun 2006) | 19 lines
- remove useless global exports
function old new delta
rpm_main 940 1601 +661
rpm_getstring 107 112 +5
rpm_getint 148 153 +5
loop_through_files 103 106 +3
fileaction_dobackup 115 113 -2
fileaction_list 5 - -5
rpm_getcount 42 - -42
extract_cpio_gz 161 - -161
rpm_gettags 504 - -504
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/1 up/down: 674/-714) Total: -40 bytes
text data bss dec hex filename
862322 10156 645892 1518370 172b22 busybox.old
862290 10156 645892 1518338 172b02 busybox
------------------------------------------------------------------------
r15555 | aldot | 2006-06-30 14:10:11 +0200 (Fri, 30 Jun 2006) | 22 lines
- shrink syslog a little bit, move a big buffer (for 'line') off the bss, fold s
emaphore stuff into single caller manually.
stats:
function old new delta
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
small 1 - -1
local_logging 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
syslogd_main 1299 1285 -14
static.res 36 16 -20
.rodata 186650 186586 -64
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/5 grow/shrink: 2/3 up/down: 48/-1136) Total: -1088 bytes
cow@s37:~/src/busybox_scratch$ size sysklogd/syslogd.o{.orig,}
text data bss dec hex filename
3723 348 5242 9313 2461 sysklogd/syslogd.o.orig
3697 348 4188 8233 2029 sysklogd/syslogd.o
==============================================================================
Overall bloatcheck for the changeset mentioned above:
function old new delta
rpm_main 953 1608 +655
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
rpm_getstring 107 110 +3
rpm_getint 148 151 +3
loop_through_files 103 104 +1
small 1 - -1
fileaction_dobackup 115 113 -2
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
local_logging 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
fileaction_list 5 - -5
new_text 70 60 -10
ipaddr_list_link 33 23 -10
clear_bufs 31 21 -10
syslogd_main 1287 1273 -14
builtin_help 190 176 -14
static.res 36 16 -20
builtin_source 229 199 -30
rpm_getcount 42 - -42
gzip_main 842 786 -56
.rodata 227176 227112 -64
lash_main 609 527 -82
busy_loop 3883 3739 -144
extract_cpio_gz 155 - -155
rpm_gettags 501 - -501
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/15 grow/shrink: 6/12 up/down: 710/-2221) Total: -1511 bytes
2006-08-20 23:05:13 +05:30
|
|
|
printf(fail_msg,"");
|
2006-10-01 00:50:00 +05:30
|
|
|
shbuf->head = 0;
|
2002-11-11 04:16:45 +05:30
|
|
|
}
|
2001-03-13 04:21:50 +05:30
|
|
|
}
|
2002-11-11 04:16:45 +05:30
|
|
|
}
|
2001-03-13 04:21:50 +05:30
|
|
|
|
2002-11-11 04:16:45 +05:30
|
|
|
/* in other cases no overflows have been done yet, so we don't care! */
|
2001-03-13 04:21:50 +05:30
|
|
|
/* we should be ok to append the message now */
|
2006-10-01 00:50:00 +05:30
|
|
|
strncpy(shbuf->data + shbuf->tail, msg, l); /* append our message */
|
|
|
|
shbuf->tail += l; /* count full message w/ '\0' terminating char */
|
2002-11-11 04:16:45 +05:30
|
|
|
} else {
|
2001-03-13 04:21:50 +05:30
|
|
|
/* we need to break up the message and "circle" it around */
|
|
|
|
char *c;
|
2006-10-01 00:50:00 +05:30
|
|
|
int k = shbuf->tail + l - shbuf->size; /* count # of bytes we don't fit */
|
2002-09-18 01:36:29 +05:30
|
|
|
|
2001-03-13 04:21:50 +05:30
|
|
|
/* We need to move HEAD! This is always the case since we are going
|
2006-10-01 00:50:00 +05:30
|
|
|
* to "circle" the message. */
|
|
|
|
c = memchr(shbuf->data + k, '\0', shbuf->size - k);
|
2002-09-18 01:36:29 +05:30
|
|
|
|
2002-11-11 04:16:45 +05:30
|
|
|
if (c != NULL) { /* if we don't have '\0'??? weird!!! */
|
|
|
|
/* move head pointer */
|
2006-10-01 00:50:00 +05:30
|
|
|
shbuf->head = c - shbuf->data + 1;
|
2002-09-18 01:36:29 +05:30
|
|
|
|
|
|
|
/* now write the first part of the message */
|
2006-10-01 00:50:00 +05:30
|
|
|
strncpy(shbuf->data + shbuf->tail, msg, l - k - 1);
|
2002-09-18 01:36:29 +05:30
|
|
|
|
2001-03-13 04:21:50 +05:30
|
|
|
/* ALWAYS terminate end of buffer w/ '\0' */
|
2006-10-01 00:50:00 +05:30
|
|
|
shbuf->data[shbuf->size - 1] = '\0';
|
2002-09-18 01:36:29 +05:30
|
|
|
|
2001-03-13 04:21:50 +05:30
|
|
|
/* now write out the rest of the string to the beginning of the buffer */
|
2006-10-01 00:50:00 +05:30
|
|
|
strcpy(shbuf->data, &msg[l - k - 1]);
|
2001-03-13 04:21:50 +05:30
|
|
|
|
|
|
|
/* we need to place the TAIL at the end of the message */
|
2006-10-01 00:50:00 +05:30
|
|
|
shbuf->tail = k + 1;
|
2002-11-11 04:16:45 +05:30
|
|
|
} else {
|
- merge -r15463:15564 from busybox_scratch branch through these changesets:
------------------------------------------------------------------------
r15465 | aldot | 2006-06-21 20:48:06 +0200 (Wed, 21 Jun 2006) | 3 lines
- use CONFIG_BUSYBOX_EXEC_PATH as before it one was broken by a recent revert.
- use xchdir() since all is invain if it fails there anyways, supposedly
------------------------------------------------------------------------
r15466 | aldot | 2006-06-21 20:55:16 +0200 (Wed, 21 Jun 2006) | 2 lines
- adjust docs to take CONFIG_BUSYBOX_EXEC_PATH into account.
------------------------------------------------------------------------
r15467 | aldot | 2006-06-21 21:31:24 +0200 (Wed, 21 Jun 2006) | 18 lines
- partial fallout of my TREE_USED touchup against gcc-4.2: rip unused vars, save
s 144 bytes
text data bss dec hex filename
862434 10156 645924 1518514 172bb2 busybox.old
862322 10156 645892 1518370 172b22 busybox
function old new delta
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
new_text 70 60 -10
ipaddr_list_link 33 23 -10
gzip_main 898 822 -76
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 0/3 up/down: 0/-120) Total: -120 bytes
------------------------------------------------------------------------
r15468 | aldot | 2006-06-21 21:43:05 +0200 (Wed, 21 Jun 2006) | 19 lines
- remove useless global exports
function old new delta
rpm_main 940 1601 +661
rpm_getstring 107 112 +5
rpm_getint 148 153 +5
loop_through_files 103 106 +3
fileaction_dobackup 115 113 -2
fileaction_list 5 - -5
rpm_getcount 42 - -42
extract_cpio_gz 161 - -161
rpm_gettags 504 - -504
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/1 up/down: 674/-714) Total: -40 bytes
text data bss dec hex filename
862322 10156 645892 1518370 172b22 busybox.old
862290 10156 645892 1518338 172b02 busybox
------------------------------------------------------------------------
r15555 | aldot | 2006-06-30 14:10:11 +0200 (Fri, 30 Jun 2006) | 22 lines
- shrink syslog a little bit, move a big buffer (for 'line') off the bss, fold s
emaphore stuff into single caller manually.
stats:
function old new delta
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
small 1 - -1
local_logging 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
syslogd_main 1299 1285 -14
static.res 36 16 -20
.rodata 186650 186586 -64
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/5 grow/shrink: 2/3 up/down: 48/-1136) Total: -1088 bytes
cow@s37:~/src/busybox_scratch$ size sysklogd/syslogd.o{.orig,}
text data bss dec hex filename
3723 348 5242 9313 2461 sysklogd/syslogd.o.orig
3697 348 4188 8233 2029 sysklogd/syslogd.o
==============================================================================
Overall bloatcheck for the changeset mentioned above:
function old new delta
rpm_main 953 1608 +655
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
rpm_getstring 107 110 +3
rpm_getint 148 151 +3
loop_through_files 103 104 +1
small 1 - -1
fileaction_dobackup 115 113 -2
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
local_logging 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
fileaction_list 5 - -5
new_text 70 60 -10
ipaddr_list_link 33 23 -10
clear_bufs 31 21 -10
syslogd_main 1287 1273 -14
builtin_help 190 176 -14
static.res 36 16 -20
builtin_source 229 199 -30
rpm_getcount 42 - -42
gzip_main 842 786 -56
.rodata 227176 227112 -64
lash_main 609 527 -82
busy_loop 3883 3739 -144
extract_cpio_gz 155 - -155
rpm_gettags 501 - -501
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/15 grow/shrink: 6/12 up/down: 710/-2221) Total: -1511 bytes
2006-08-20 23:05:13 +05:30
|
|
|
printf(fail_msg, " from the beginning");
|
2006-10-01 00:50:00 +05:30
|
|
|
shbuf->head = shbuf->tail = 0; /* reset buffer, since it's probably corrupted */
|
2001-03-13 04:21:50 +05:30
|
|
|
}
|
2002-09-18 01:36:29 +05:30
|
|
|
|
2001-03-13 04:21:50 +05:30
|
|
|
}
|
- merge -r15463:15564 from busybox_scratch branch through these changesets:
------------------------------------------------------------------------
r15465 | aldot | 2006-06-21 20:48:06 +0200 (Wed, 21 Jun 2006) | 3 lines
- use CONFIG_BUSYBOX_EXEC_PATH as before it one was broken by a recent revert.
- use xchdir() since all is invain if it fails there anyways, supposedly
------------------------------------------------------------------------
r15466 | aldot | 2006-06-21 20:55:16 +0200 (Wed, 21 Jun 2006) | 2 lines
- adjust docs to take CONFIG_BUSYBOX_EXEC_PATH into account.
------------------------------------------------------------------------
r15467 | aldot | 2006-06-21 21:31:24 +0200 (Wed, 21 Jun 2006) | 18 lines
- partial fallout of my TREE_USED touchup against gcc-4.2: rip unused vars, save
s 144 bytes
text data bss dec hex filename
862434 10156 645924 1518514 172bb2 busybox.old
862322 10156 645892 1518370 172b22 busybox
function old new delta
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
new_text 70 60 -10
ipaddr_list_link 33 23 -10
gzip_main 898 822 -76
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 0/3 up/down: 0/-120) Total: -120 bytes
------------------------------------------------------------------------
r15468 | aldot | 2006-06-21 21:43:05 +0200 (Wed, 21 Jun 2006) | 19 lines
- remove useless global exports
function old new delta
rpm_main 940 1601 +661
rpm_getstring 107 112 +5
rpm_getint 148 153 +5
loop_through_files 103 106 +3
fileaction_dobackup 115 113 -2
fileaction_list 5 - -5
rpm_getcount 42 - -42
extract_cpio_gz 161 - -161
rpm_gettags 504 - -504
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/1 up/down: 674/-714) Total: -40 bytes
text data bss dec hex filename
862322 10156 645892 1518370 172b22 busybox.old
862290 10156 645892 1518338 172b02 busybox
------------------------------------------------------------------------
r15555 | aldot | 2006-06-30 14:10:11 +0200 (Fri, 30 Jun 2006) | 22 lines
- shrink syslog a little bit, move a big buffer (for 'line') off the bss, fold s
emaphore stuff into single caller manually.
stats:
function old new delta
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
small 1 - -1
local_logging 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
syslogd_main 1299 1285 -14
static.res 36 16 -20
.rodata 186650 186586 -64
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/5 grow/shrink: 2/3 up/down: 48/-1136) Total: -1088 bytes
cow@s37:~/src/busybox_scratch$ size sysklogd/syslogd.o{.orig,}
text data bss dec hex filename
3723 348 5242 9313 2461 sysklogd/syslogd.o.orig
3697 348 4188 8233 2029 sysklogd/syslogd.o
==============================================================================
Overall bloatcheck for the changeset mentioned above:
function old new delta
rpm_main 953 1608 +655
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
rpm_getstring 107 110 +3
rpm_getint 148 151 +3
loop_through_files 103 104 +1
small 1 - -1
fileaction_dobackup 115 113 -2
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
local_logging 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
fileaction_list 5 - -5
new_text 70 60 -10
ipaddr_list_link 33 23 -10
clear_bufs 31 21 -10
syslogd_main 1287 1273 -14
builtin_help 190 176 -14
static.res 36 16 -20
builtin_source 229 199 -30
rpm_getcount 42 - -42
gzip_main 842 786 -56
.rodata 227176 227112 -64
lash_main 609 527 -82
busy_loop 3883 3739 -144
extract_cpio_gz 155 - -155
rpm_gettags 501 - -501
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/15 grow/shrink: 6/12 up/down: 710/-2221) Total: -1511 bytes
2006-08-20 23:05:13 +05:30
|
|
|
if (semop(s_semid, SMwup, 1) == -1) {
|
|
|
|
bb_perror_msg_and_die("SMwup");
|
|
|
|
}
|
|
|
|
|
2001-03-13 04:21:50 +05:30
|
|
|
}
|
2006-08-29 01:46:42 +05:30
|
|
|
#else
|
|
|
|
void ipcsyslog_cleanup(void);
|
|
|
|
void ipcsyslog_init(void);
|
|
|
|
void circ_message(const char *msg);
|
2002-11-11 04:16:45 +05:30
|
|
|
#endif /* CONFIG_FEATURE_IPC_SYSLOG */
|
2002-09-18 01:36:29 +05:30
|
|
|
|
2000-03-21 07:01:24 +05:30
|
|
|
/* Note: There is also a function called "message()" in init.c */
|
2000-04-04 23:44:25 +05:30
|
|
|
/* Print a message to the log file. */
|
2002-11-11 04:16:45 +05:30
|
|
|
static void message(char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
|
|
|
|
static void message(char *fmt, ...)
|
1999-11-25 13:00:46 +05:30
|
|
|
{
|
2006-09-11 07:04:21 +05:30
|
|
|
int fd = -1;
|
2000-04-20 00:22:56 +05:30
|
|
|
struct flock fl;
|
2000-02-09 01:28:47 +05:30
|
|
|
va_list arguments;
|
|
|
|
|
2000-04-20 00:22:56 +05:30
|
|
|
fl.l_whence = SEEK_SET;
|
2002-11-11 04:16:45 +05:30
|
|
|
fl.l_start = 0;
|
|
|
|
fl.l_len = 1;
|
2000-04-20 00:22:56 +05:30
|
|
|
|
2001-10-24 10:30:29 +05:30
|
|
|
#ifdef CONFIG_FEATURE_IPC_SYSLOG
|
2006-10-06 15:19:47 +05:30
|
|
|
if ((option_mask32 & OPT_circularlog) && shbuf) {
|
2002-11-11 04:16:45 +05:30
|
|
|
char b[1024];
|
|
|
|
|
|
|
|
va_start(arguments, fmt);
|
|
|
|
vsnprintf(b, sizeof(b) - 1, fmt, arguments);
|
|
|
|
va_end(arguments);
|
|
|
|
circ_message(b);
|
|
|
|
|
|
|
|
} else
|
2001-03-13 04:21:50 +05:30
|
|
|
#endif
|
2006-09-08 23:01:55 +05:30
|
|
|
fd = device_open(logFilePath, O_WRONLY | O_CREAT
|
|
|
|
| O_NOCTTY | O_APPEND | O_NONBLOCK);
|
|
|
|
if (fd >= 0) {
|
2000-04-20 00:22:56 +05:30
|
|
|
fl.l_type = F_WRLCK;
|
2002-11-11 04:16:45 +05:30
|
|
|
fcntl(fd, F_SETLKW, &fl);
|
- merge -r15463:15564 from busybox_scratch branch through these changesets:
------------------------------------------------------------------------
r15465 | aldot | 2006-06-21 20:48:06 +0200 (Wed, 21 Jun 2006) | 3 lines
- use CONFIG_BUSYBOX_EXEC_PATH as before it one was broken by a recent revert.
- use xchdir() since all is invain if it fails there anyways, supposedly
------------------------------------------------------------------------
r15466 | aldot | 2006-06-21 20:55:16 +0200 (Wed, 21 Jun 2006) | 2 lines
- adjust docs to take CONFIG_BUSYBOX_EXEC_PATH into account.
------------------------------------------------------------------------
r15467 | aldot | 2006-06-21 21:31:24 +0200 (Wed, 21 Jun 2006) | 18 lines
- partial fallout of my TREE_USED touchup against gcc-4.2: rip unused vars, save
s 144 bytes
text data bss dec hex filename
862434 10156 645924 1518514 172bb2 busybox.old
862322 10156 645892 1518370 172b22 busybox
function old new delta
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
new_text 70 60 -10
ipaddr_list_link 33 23 -10
gzip_main 898 822 -76
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 0/3 up/down: 0/-120) Total: -120 bytes
------------------------------------------------------------------------
r15468 | aldot | 2006-06-21 21:43:05 +0200 (Wed, 21 Jun 2006) | 19 lines
- remove useless global exports
function old new delta
rpm_main 940 1601 +661
rpm_getstring 107 112 +5
rpm_getint 148 153 +5
loop_through_files 103 106 +3
fileaction_dobackup 115 113 -2
fileaction_list 5 - -5
rpm_getcount 42 - -42
extract_cpio_gz 161 - -161
rpm_gettags 504 - -504
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/1 up/down: 674/-714) Total: -40 bytes
text data bss dec hex filename
862322 10156 645892 1518370 172b22 busybox.old
862290 10156 645892 1518338 172b02 busybox
------------------------------------------------------------------------
r15555 | aldot | 2006-06-30 14:10:11 +0200 (Fri, 30 Jun 2006) | 22 lines
- shrink syslog a little bit, move a big buffer (for 'line') off the bss, fold s
emaphore stuff into single caller manually.
stats:
function old new delta
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
small 1 - -1
local_logging 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
syslogd_main 1299 1285 -14
static.res 36 16 -20
.rodata 186650 186586 -64
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/5 grow/shrink: 2/3 up/down: 48/-1136) Total: -1088 bytes
cow@s37:~/src/busybox_scratch$ size sysklogd/syslogd.o{.orig,}
text data bss dec hex filename
3723 348 5242 9313 2461 sysklogd/syslogd.o.orig
3697 348 4188 8233 2029 sysklogd/syslogd.o
==============================================================================
Overall bloatcheck for the changeset mentioned above:
function old new delta
rpm_main 953 1608 +655
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
rpm_getstring 107 110 +3
rpm_getint 148 151 +3
loop_through_files 103 104 +1
small 1 - -1
fileaction_dobackup 115 113 -2
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
local_logging 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
fileaction_list 5 - -5
new_text 70 60 -10
ipaddr_list_link 33 23 -10
clear_bufs 31 21 -10
syslogd_main 1287 1273 -14
builtin_help 190 176 -14
static.res 36 16 -20
builtin_source 229 199 -30
rpm_getcount 42 - -42
gzip_main 842 786 -56
.rodata 227176 227112 -64
lash_main 609 527 -82
busy_loop 3883 3739 -144
extract_cpio_gz 155 - -155
rpm_gettags 501 - -501
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/15 grow/shrink: 6/12 up/down: 710/-2221) Total: -1511 bytes
2006-08-20 23:05:13 +05:30
|
|
|
|
2006-08-29 01:46:42 +05:30
|
|
|
#ifdef CONFIG_FEATURE_ROTATE_LOGFILE
|
- merge -r15463:15564 from busybox_scratch branch through these changesets:
------------------------------------------------------------------------
r15465 | aldot | 2006-06-21 20:48:06 +0200 (Wed, 21 Jun 2006) | 3 lines
- use CONFIG_BUSYBOX_EXEC_PATH as before it one was broken by a recent revert.
- use xchdir() since all is invain if it fails there anyways, supposedly
------------------------------------------------------------------------
r15466 | aldot | 2006-06-21 20:55:16 +0200 (Wed, 21 Jun 2006) | 2 lines
- adjust docs to take CONFIG_BUSYBOX_EXEC_PATH into account.
------------------------------------------------------------------------
r15467 | aldot | 2006-06-21 21:31:24 +0200 (Wed, 21 Jun 2006) | 18 lines
- partial fallout of my TREE_USED touchup against gcc-4.2: rip unused vars, save
s 144 bytes
text data bss dec hex filename
862434 10156 645924 1518514 172bb2 busybox.old
862322 10156 645892 1518370 172b22 busybox
function old new delta
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
new_text 70 60 -10
ipaddr_list_link 33 23 -10
gzip_main 898 822 -76
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 0/3 up/down: 0/-120) Total: -120 bytes
------------------------------------------------------------------------
r15468 | aldot | 2006-06-21 21:43:05 +0200 (Wed, 21 Jun 2006) | 19 lines
- remove useless global exports
function old new delta
rpm_main 940 1601 +661
rpm_getstring 107 112 +5
rpm_getint 148 153 +5
loop_through_files 103 106 +3
fileaction_dobackup 115 113 -2
fileaction_list 5 - -5
rpm_getcount 42 - -42
extract_cpio_gz 161 - -161
rpm_gettags 504 - -504
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/1 up/down: 674/-714) Total: -40 bytes
text data bss dec hex filename
862322 10156 645892 1518370 172b22 busybox.old
862290 10156 645892 1518338 172b02 busybox
------------------------------------------------------------------------
r15555 | aldot | 2006-06-30 14:10:11 +0200 (Fri, 30 Jun 2006) | 22 lines
- shrink syslog a little bit, move a big buffer (for 'line') off the bss, fold s
emaphore stuff into single caller manually.
stats:
function old new delta
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
small 1 - -1
local_logging 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
syslogd_main 1299 1285 -14
static.res 36 16 -20
.rodata 186650 186586 -64
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/5 grow/shrink: 2/3 up/down: 48/-1136) Total: -1088 bytes
cow@s37:~/src/busybox_scratch$ size sysklogd/syslogd.o{.orig,}
text data bss dec hex filename
3723 348 5242 9313 2461 sysklogd/syslogd.o.orig
3697 348 4188 8233 2029 sysklogd/syslogd.o
==============================================================================
Overall bloatcheck for the changeset mentioned above:
function old new delta
rpm_main 953 1608 +655
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
rpm_getstring 107 110 +3
rpm_getint 148 151 +3
loop_through_files 103 104 +1
small 1 - -1
fileaction_dobackup 115 113 -2
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
local_logging 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
fileaction_list 5 - -5
new_text 70 60 -10
ipaddr_list_link 33 23 -10
clear_bufs 31 21 -10
syslogd_main 1287 1273 -14
builtin_help 190 176 -14
static.res 36 16 -20
builtin_source 229 199 -30
rpm_getcount 42 - -42
gzip_main 842 786 -56
.rodata 227176 227112 -64
lash_main 609 527 -82
busy_loop 3883 3739 -144
extract_cpio_gz 155 - -155
rpm_gettags 501 - -501
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/15 grow/shrink: 6/12 up/down: 710/-2221) Total: -1511 bytes
2006-08-20 23:05:13 +05:30
|
|
|
if (ENABLE_FEATURE_ROTATE_LOGFILE && logFileSize > 0 ) {
|
2003-10-09 15:13:18 +05:30
|
|
|
struct stat statf;
|
|
|
|
int r = fstat(fd, &statf);
|
2006-10-01 00:50:00 +05:30
|
|
|
if (!r && (statf.st_mode & S_IFREG)
|
|
|
|
&& (lseek(fd,0,SEEK_END) > logFileSize)) {
|
|
|
|
if (logFileRotate > 0) {
|
|
|
|
int i = strlen(logFilePath) + 4;
|
|
|
|
char oldFile[i];
|
|
|
|
char newFile[i];
|
|
|
|
for (i=logFileRotate-1; i>0; i--) {
|
2003-10-09 15:13:18 +05:30
|
|
|
sprintf(oldFile, "%s.%d", logFilePath, i-1);
|
|
|
|
sprintf(newFile, "%s.%d", logFilePath, i);
|
|
|
|
rename(oldFile, newFile);
|
|
|
|
}
|
|
|
|
sprintf(newFile, "%s.%d", logFilePath, 0);
|
|
|
|
fl.l_type = F_UNLCK;
|
2006-10-01 00:50:00 +05:30
|
|
|
fcntl(fd, F_SETLKW, &fl);
|
2003-10-09 15:13:18 +05:30
|
|
|
close(fd);
|
|
|
|
rename(logFilePath, newFile);
|
2006-10-01 00:50:00 +05:30
|
|
|
fd = device_open(logFilePath,
|
2003-10-09 15:13:18 +05:30
|
|
|
O_WRONLY | O_CREAT | O_NOCTTY | O_APPEND |
|
|
|
|
O_NONBLOCK);
|
|
|
|
fl.l_type = F_WRLCK;
|
2006-10-01 00:50:00 +05:30
|
|
|
fcntl(fd, F_SETLKW, &fl);
|
2003-10-09 15:13:18 +05:30
|
|
|
} else {
|
2006-10-01 00:50:00 +05:30
|
|
|
ftruncate(fd, 0);
|
2003-10-09 15:13:18 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-08-29 01:46:42 +05:30
|
|
|
#endif
|
2002-11-11 04:16:45 +05:30
|
|
|
va_start(arguments, fmt);
|
|
|
|
vdprintf(fd, fmt, arguments);
|
|
|
|
va_end(arguments);
|
2000-04-20 00:22:56 +05:30
|
|
|
fl.l_type = F_UNLCK;
|
2002-11-11 04:16:45 +05:30
|
|
|
fcntl(fd, F_SETLKW, &fl);
|
|
|
|
close(fd);
|
1999-11-25 13:00:46 +05:30
|
|
|
} else {
|
2000-02-09 01:28:47 +05:30
|
|
|
/* Always send console messages to /dev/console so people will see them. */
|
2006-09-08 23:01:55 +05:30
|
|
|
fd = device_open(_PATH_CONSOLE, O_WRONLY | O_NOCTTY | O_NONBLOCK);
|
|
|
|
if (fd >= 0) {
|
2002-11-11 04:16:45 +05:30
|
|
|
va_start(arguments, fmt);
|
|
|
|
vdprintf(fd, fmt, arguments);
|
|
|
|
va_end(arguments);
|
|
|
|
close(fd);
|
2000-02-09 01:28:47 +05:30
|
|
|
} else {
|
2002-11-11 04:16:45 +05:30
|
|
|
fprintf(stderr, "Bummer, can't print: ");
|
|
|
|
va_start(arguments, fmt);
|
|
|
|
vfprintf(stderr, fmt, arguments);
|
|
|
|
fflush(stderr);
|
|
|
|
va_end(arguments);
|
2000-02-09 01:28:47 +05:30
|
|
|
}
|
1999-11-25 13:00:46 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-11 04:16:45 +05:30
|
|
|
static void logMessage(int pri, char *msg)
|
1999-11-25 13:00:46 +05:30
|
|
|
{
|
2000-02-09 01:28:47 +05:30
|
|
|
time_t now;
|
|
|
|
char *timestamp;
|
- merge -r15463:15564 from busybox_scratch branch through these changesets:
------------------------------------------------------------------------
r15465 | aldot | 2006-06-21 20:48:06 +0200 (Wed, 21 Jun 2006) | 3 lines
- use CONFIG_BUSYBOX_EXEC_PATH as before it one was broken by a recent revert.
- use xchdir() since all is invain if it fails there anyways, supposedly
------------------------------------------------------------------------
r15466 | aldot | 2006-06-21 20:55:16 +0200 (Wed, 21 Jun 2006) | 2 lines
- adjust docs to take CONFIG_BUSYBOX_EXEC_PATH into account.
------------------------------------------------------------------------
r15467 | aldot | 2006-06-21 21:31:24 +0200 (Wed, 21 Jun 2006) | 18 lines
- partial fallout of my TREE_USED touchup against gcc-4.2: rip unused vars, save
s 144 bytes
text data bss dec hex filename
862434 10156 645924 1518514 172bb2 busybox.old
862322 10156 645892 1518370 172b22 busybox
function old new delta
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
new_text 70 60 -10
ipaddr_list_link 33 23 -10
gzip_main 898 822 -76
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 0/3 up/down: 0/-120) Total: -120 bytes
------------------------------------------------------------------------
r15468 | aldot | 2006-06-21 21:43:05 +0200 (Wed, 21 Jun 2006) | 19 lines
- remove useless global exports
function old new delta
rpm_main 940 1601 +661
rpm_getstring 107 112 +5
rpm_getint 148 153 +5
loop_through_files 103 106 +3
fileaction_dobackup 115 113 -2
fileaction_list 5 - -5
rpm_getcount 42 - -42
extract_cpio_gz 161 - -161
rpm_gettags 504 - -504
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/1 up/down: 674/-714) Total: -40 bytes
text data bss dec hex filename
862322 10156 645892 1518370 172b22 busybox.old
862290 10156 645892 1518338 172b02 busybox
------------------------------------------------------------------------
r15555 | aldot | 2006-06-30 14:10:11 +0200 (Fri, 30 Jun 2006) | 22 lines
- shrink syslog a little bit, move a big buffer (for 'line') off the bss, fold s
emaphore stuff into single caller manually.
stats:
function old new delta
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
small 1 - -1
local_logging 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
syslogd_main 1299 1285 -14
static.res 36 16 -20
.rodata 186650 186586 -64
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/5 grow/shrink: 2/3 up/down: 48/-1136) Total: -1088 bytes
cow@s37:~/src/busybox_scratch$ size sysklogd/syslogd.o{.orig,}
text data bss dec hex filename
3723 348 5242 9313 2461 sysklogd/syslogd.o.orig
3697 348 4188 8233 2029 sysklogd/syslogd.o
==============================================================================
Overall bloatcheck for the changeset mentioned above:
function old new delta
rpm_main 953 1608 +655
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
rpm_getstring 107 110 +3
rpm_getint 148 151 +3
loop_through_files 103 104 +1
small 1 - -1
fileaction_dobackup 115 113 -2
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
local_logging 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
fileaction_list 5 - -5
new_text 70 60 -10
ipaddr_list_link 33 23 -10
clear_bufs 31 21 -10
syslogd_main 1287 1273 -14
builtin_help 190 176 -14
static.res 36 16 -20
builtin_source 229 199 -30
rpm_getcount 42 - -42
gzip_main 842 786 -56
.rodata 227176 227112 -64
lash_main 609 527 -82
busy_loop 3883 3739 -144
extract_cpio_gz 155 - -155
rpm_gettags 501 - -501
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/15 grow/shrink: 6/12 up/down: 710/-2221) Total: -1511 bytes
2006-08-20 23:05:13 +05:30
|
|
|
char res[20];
|
2000-02-09 01:28:47 +05:30
|
|
|
CODE *c_pri, *c_fac;
|
|
|
|
|
2000-02-12 03:25:04 +05:30
|
|
|
if (pri != 0) {
|
2006-10-01 00:50:00 +05:30
|
|
|
c_fac = facilitynames;
|
|
|
|
while (c_fac->c_name && !(c_fac->c_val == LOG_FAC(pri) << 3))
|
|
|
|
c_fac++;
|
|
|
|
c_pri = prioritynames;
|
|
|
|
while (c_pri->c_name && !(c_pri->c_val == LOG_PRI(pri)))
|
|
|
|
c_pri++;
|
2002-11-11 04:16:45 +05:30
|
|
|
if (c_fac->c_name == NULL || c_pri->c_name == NULL) {
|
2000-02-12 03:25:04 +05:30
|
|
|
snprintf(res, sizeof(res), "<%d>", pri);
|
2002-11-11 04:16:45 +05:30
|
|
|
} else {
|
2000-02-12 03:25:04 +05:30
|
|
|
snprintf(res, sizeof(res), "%s.%s", c_fac->c_name, c_pri->c_name);
|
2002-11-11 04:16:45 +05:30
|
|
|
}
|
2000-02-12 03:25:04 +05:30
|
|
|
}
|
2000-02-09 01:28:47 +05:30
|
|
|
|
|
|
|
if (strlen(msg) < 16 || msg[3] != ' ' || msg[6] != ' ' ||
|
2002-11-11 04:16:45 +05:30
|
|
|
msg[9] != ':' || msg[12] != ':' || msg[15] != ' ') {
|
2000-02-09 01:28:47 +05:30
|
|
|
time(&now);
|
|
|
|
timestamp = ctime(&now) + 4;
|
|
|
|
timestamp[15] = '\0';
|
|
|
|
} else {
|
|
|
|
timestamp = msg;
|
|
|
|
timestamp[15] = '\0';
|
|
|
|
msg += 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* todo: supress duplicates */
|
|
|
|
|
2001-10-24 10:30:29 +05:30
|
|
|
#ifdef CONFIG_FEATURE_REMOTE_LOG
|
2006-10-06 15:19:47 +05:30
|
|
|
if (option_mask32 & OPT_remotelog) {
|
- merge -r15463:15564 from busybox_scratch branch through these changesets:
------------------------------------------------------------------------
r15465 | aldot | 2006-06-21 20:48:06 +0200 (Wed, 21 Jun 2006) | 3 lines
- use CONFIG_BUSYBOX_EXEC_PATH as before it one was broken by a recent revert.
- use xchdir() since all is invain if it fails there anyways, supposedly
------------------------------------------------------------------------
r15466 | aldot | 2006-06-21 20:55:16 +0200 (Wed, 21 Jun 2006) | 2 lines
- adjust docs to take CONFIG_BUSYBOX_EXEC_PATH into account.
------------------------------------------------------------------------
r15467 | aldot | 2006-06-21 21:31:24 +0200 (Wed, 21 Jun 2006) | 18 lines
- partial fallout of my TREE_USED touchup against gcc-4.2: rip unused vars, save
s 144 bytes
text data bss dec hex filename
862434 10156 645924 1518514 172bb2 busybox.old
862322 10156 645892 1518370 172b22 busybox
function old new delta
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
new_text 70 60 -10
ipaddr_list_link 33 23 -10
gzip_main 898 822 -76
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 0/3 up/down: 0/-120) Total: -120 bytes
------------------------------------------------------------------------
r15468 | aldot | 2006-06-21 21:43:05 +0200 (Wed, 21 Jun 2006) | 19 lines
- remove useless global exports
function old new delta
rpm_main 940 1601 +661
rpm_getstring 107 112 +5
rpm_getint 148 153 +5
loop_through_files 103 106 +3
fileaction_dobackup 115 113 -2
fileaction_list 5 - -5
rpm_getcount 42 - -42
extract_cpio_gz 161 - -161
rpm_gettags 504 - -504
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/1 up/down: 674/-714) Total: -40 bytes
text data bss dec hex filename
862322 10156 645892 1518370 172b22 busybox.old
862290 10156 645892 1518338 172b02 busybox
------------------------------------------------------------------------
r15555 | aldot | 2006-06-30 14:10:11 +0200 (Fri, 30 Jun 2006) | 22 lines
- shrink syslog a little bit, move a big buffer (for 'line') off the bss, fold s
emaphore stuff into single caller manually.
stats:
function old new delta
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
small 1 - -1
local_logging 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
syslogd_main 1299 1285 -14
static.res 36 16 -20
.rodata 186650 186586 -64
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/5 grow/shrink: 2/3 up/down: 48/-1136) Total: -1088 bytes
cow@s37:~/src/busybox_scratch$ size sysklogd/syslogd.o{.orig,}
text data bss dec hex filename
3723 348 5242 9313 2461 sysklogd/syslogd.o.orig
3697 348 4188 8233 2029 sysklogd/syslogd.o
==============================================================================
Overall bloatcheck for the changeset mentioned above:
function old new delta
rpm_main 953 1608 +655
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
rpm_getstring 107 110 +3
rpm_getint 148 151 +3
loop_through_files 103 104 +1
small 1 - -1
fileaction_dobackup 115 113 -2
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
local_logging 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
fileaction_list 5 - -5
new_text 70 60 -10
ipaddr_list_link 33 23 -10
clear_bufs 31 21 -10
syslogd_main 1287 1273 -14
builtin_help 190 176 -14
static.res 36 16 -20
builtin_source 229 199 -30
rpm_getcount 42 - -42
gzip_main 842 786 -56
.rodata 227176 227112 -64
lash_main 609 527 -82
busy_loop 3883 3739 -144
extract_cpio_gz 155 - -155
rpm_gettags 501 - -501
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/15 grow/shrink: 6/12 up/down: 710/-2221) Total: -1511 bytes
2006-08-20 23:05:13 +05:30
|
|
|
char line[MAXLINE + 1];
|
2004-09-14 23:42:13 +05:30
|
|
|
/* trying connect the socket */
|
|
|
|
if (-1 == remotefd) {
|
2006-10-01 00:51:24 +05:30
|
|
|
remotefd = socket(AF_INET, SOCK_DGRAM, 0);
|
2004-09-14 23:42:13 +05:30
|
|
|
}
|
|
|
|
/* if we have a valid socket, send the message */
|
|
|
|
if (-1 != remotefd) {
|
2005-07-20 23:32:11 +05:30
|
|
|
snprintf(line, sizeof(line), "<%d>%s", pri, msg);
|
2006-10-01 00:51:24 +05:30
|
|
|
/* send message to remote logger, ignore possible error */
|
|
|
|
sendto(remotefd, line, strlen(line), 0,
|
|
|
|
(struct sockaddr *) &remoteaddr, sizeof(remoteaddr));
|
2000-12-09 01:22:01 +05:30
|
|
|
}
|
|
|
|
}
|
2004-09-14 23:42:13 +05:30
|
|
|
|
2006-10-06 15:19:47 +05:30
|
|
|
if (option_mask32 & OPT_locallog)
|
2000-07-21 05:11:24 +05:30
|
|
|
#endif
|
2004-06-22 15:42:59 +05:30
|
|
|
{
|
2000-12-09 01:22:01 +05:30
|
|
|
/* now spew out the message to wherever it is supposed to go */
|
2006-10-01 00:47:40 +05:30
|
|
|
if (pri == 0 || LOG_PRI(pri) < logLevel) {
|
2006-10-06 15:19:47 +05:30
|
|
|
if (option_mask32 & OPT_small)
|
2006-10-01 00:47:40 +05:30
|
|
|
message("%s %s\n", timestamp, msg);
|
|
|
|
else
|
|
|
|
message("%s %s %s %s\n", timestamp, LocalHostName, res, msg);
|
|
|
|
}
|
2004-06-22 15:42:59 +05:30
|
|
|
}
|
1999-11-24 14:34:33 +05:30
|
|
|
}
|
|
|
|
|
1999-11-25 13:00:46 +05:30
|
|
|
static void quit_signal(int sig)
|
|
|
|
{
|
2001-05-07 23:25:05 +05:30
|
|
|
logMessage(LOG_SYSLOG | LOG_INFO, "System log daemon exiting.");
|
2000-04-04 23:44:25 +05:30
|
|
|
unlink(lfile);
|
- merge -r15463:15564 from busybox_scratch branch through these changesets:
------------------------------------------------------------------------
r15465 | aldot | 2006-06-21 20:48:06 +0200 (Wed, 21 Jun 2006) | 3 lines
- use CONFIG_BUSYBOX_EXEC_PATH as before it one was broken by a recent revert.
- use xchdir() since all is invain if it fails there anyways, supposedly
------------------------------------------------------------------------
r15466 | aldot | 2006-06-21 20:55:16 +0200 (Wed, 21 Jun 2006) | 2 lines
- adjust docs to take CONFIG_BUSYBOX_EXEC_PATH into account.
------------------------------------------------------------------------
r15467 | aldot | 2006-06-21 21:31:24 +0200 (Wed, 21 Jun 2006) | 18 lines
- partial fallout of my TREE_USED touchup against gcc-4.2: rip unused vars, save
s 144 bytes
text data bss dec hex filename
862434 10156 645924 1518514 172bb2 busybox.old
862322 10156 645892 1518370 172b22 busybox
function old new delta
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
new_text 70 60 -10
ipaddr_list_link 33 23 -10
gzip_main 898 822 -76
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 0/3 up/down: 0/-120) Total: -120 bytes
------------------------------------------------------------------------
r15468 | aldot | 2006-06-21 21:43:05 +0200 (Wed, 21 Jun 2006) | 19 lines
- remove useless global exports
function old new delta
rpm_main 940 1601 +661
rpm_getstring 107 112 +5
rpm_getint 148 153 +5
loop_through_files 103 106 +3
fileaction_dobackup 115 113 -2
fileaction_list 5 - -5
rpm_getcount 42 - -42
extract_cpio_gz 161 - -161
rpm_gettags 504 - -504
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/1 up/down: 674/-714) Total: -40 bytes
text data bss dec hex filename
862322 10156 645892 1518370 172b22 busybox.old
862290 10156 645892 1518338 172b02 busybox
------------------------------------------------------------------------
r15555 | aldot | 2006-06-30 14:10:11 +0200 (Fri, 30 Jun 2006) | 22 lines
- shrink syslog a little bit, move a big buffer (for 'line') off the bss, fold s
emaphore stuff into single caller manually.
stats:
function old new delta
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
small 1 - -1
local_logging 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
syslogd_main 1299 1285 -14
static.res 36 16 -20
.rodata 186650 186586 -64
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/5 grow/shrink: 2/3 up/down: 48/-1136) Total: -1088 bytes
cow@s37:~/src/busybox_scratch$ size sysklogd/syslogd.o{.orig,}
text data bss dec hex filename
3723 348 5242 9313 2461 sysklogd/syslogd.o.orig
3697 348 4188 8233 2029 sysklogd/syslogd.o
==============================================================================
Overall bloatcheck for the changeset mentioned above:
function old new delta
rpm_main 953 1608 +655
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
rpm_getstring 107 110 +3
rpm_getint 148 151 +3
loop_through_files 103 104 +1
small 1 - -1
fileaction_dobackup 115 113 -2
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
local_logging 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
fileaction_list 5 - -5
new_text 70 60 -10
ipaddr_list_link 33 23 -10
clear_bufs 31 21 -10
syslogd_main 1287 1273 -14
builtin_help 190 176 -14
static.res 36 16 -20
builtin_source 229 199 -30
rpm_getcount 42 - -42
gzip_main 842 786 -56
.rodata 227176 227112 -64
lash_main 609 527 -82
busy_loop 3883 3739 -144
extract_cpio_gz 155 - -155
rpm_gettags 501 - -501
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/15 grow/shrink: 6/12 up/down: 710/-2221) Total: -1511 bytes
2006-08-20 23:05:13 +05:30
|
|
|
if (ENABLE_FEATURE_IPC_SYSLOG)
|
|
|
|
ipcsyslog_cleanup();
|
2001-03-13 04:21:50 +05:30
|
|
|
|
2006-10-01 00:51:24 +05:30
|
|
|
exit(1);
|
1999-11-25 13:00:46 +05:30
|
|
|
}
|
1999-11-24 14:34:33 +05:30
|
|
|
|
1999-11-25 13:00:46 +05:30
|
|
|
static void domark(int sig)
|
|
|
|
{
|
2000-02-09 01:28:47 +05:30
|
|
|
if (MarkInterval > 0) {
|
|
|
|
logMessage(LOG_SYSLOG | LOG_INFO, "-- MARK --");
|
|
|
|
alarm(MarkInterval);
|
|
|
|
}
|
1999-11-25 13:00:46 +05:30
|
|
|
}
|
|
|
|
|
2003-07-23 03:45:21 +05:30
|
|
|
/* This must be a #define, since when CONFIG_DEBUG and BUFFERS_GO_IN_BSS are
|
2001-07-02 23:02:40 +05:30
|
|
|
* enabled, we otherwise get a "storage size isn't constant error. */
|
2002-11-11 04:16:45 +05:30
|
|
|
static int serveConnection(char *tmpbuf, int n_read)
|
2000-06-08 02:38:25 +05:30
|
|
|
{
|
2001-08-14 23:02:23 +05:30
|
|
|
char *p = tmpbuf;
|
2000-06-08 02:38:25 +05:30
|
|
|
|
2001-08-14 23:02:23 +05:30
|
|
|
while (p < tmpbuf + n_read) {
|
2000-06-08 02:38:25 +05:30
|
|
|
|
2002-11-11 04:16:45 +05:30
|
|
|
int pri = (LOG_USER | LOG_NOTICE);
|
2003-05-23 14:58:01 +05:30
|
|
|
int num_lt = 0;
|
2002-11-11 04:16:45 +05:30
|
|
|
char line[MAXLINE + 1];
|
2000-06-08 02:38:25 +05:30
|
|
|
unsigned char c;
|
2001-08-14 23:02:23 +05:30
|
|
|
char *q = line;
|
2000-06-08 02:38:25 +05:30
|
|
|
|
2002-11-11 04:16:45 +05:30
|
|
|
while ((c = *p) && q < &line[sizeof(line) - 1]) {
|
2003-05-23 14:58:01 +05:30
|
|
|
if (c == '<' && num_lt == 0) {
|
2002-11-11 04:16:45 +05:30
|
|
|
/* Parse the magic priority number. */
|
2003-05-23 14:58:01 +05:30
|
|
|
num_lt++;
|
2000-06-08 02:38:25 +05:30
|
|
|
pri = 0;
|
2002-11-11 04:16:45 +05:30
|
|
|
while (isdigit(*(++p))) {
|
2000-06-08 02:38:25 +05:30
|
|
|
pri = 10 * pri + (*p - '0');
|
|
|
|
}
|
2003-05-23 14:59:57 +05:30
|
|
|
if (pri & ~(LOG_FACMASK | LOG_PRIMASK)) {
|
2003-05-23 14:58:01 +05:30
|
|
|
pri = (LOG_USER | LOG_NOTICE);
|
2003-05-23 14:59:57 +05:30
|
|
|
}
|
2000-06-08 02:38:25 +05:30
|
|
|
} else if (c == '\n') {
|
|
|
|
*q++ = ' ';
|
2002-11-11 04:16:45 +05:30
|
|
|
} else if (iscntrl(c) && (c < 0177)) {
|
2000-06-08 02:38:25 +05:30
|
|
|
*q++ = '^';
|
|
|
|
*q++ = c ^ 0100;
|
|
|
|
} else {
|
|
|
|
*q++ = c;
|
|
|
|
}
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
*q = '\0';
|
2001-08-14 23:02:23 +05:30
|
|
|
p++;
|
2000-06-08 02:38:25 +05:30
|
|
|
/* Now log it */
|
2002-11-11 04:16:45 +05:30
|
|
|
logMessage(pri, line);
|
2000-06-08 02:38:25 +05:30
|
|
|
}
|
2001-03-28 01:47:58 +05:30
|
|
|
return n_read;
|
2000-06-08 02:38:25 +05:30
|
|
|
}
|
|
|
|
|
2006-01-23 04:25:11 +05:30
|
|
|
static void doSyslogd(void) ATTRIBUTE_NORETURN;
|
2002-11-11 04:16:45 +05:30
|
|
|
static void doSyslogd(void)
|
1999-11-25 13:00:46 +05:30
|
|
|
{
|
2000-02-09 01:28:47 +05:30
|
|
|
struct sockaddr_un sunx;
|
2000-04-21 06:56:49 +05:30
|
|
|
socklen_t addrLength;
|
|
|
|
|
2000-04-04 23:44:25 +05:30
|
|
|
int sock_fd;
|
2000-04-19 05:21:51 +05:30
|
|
|
fd_set fds;
|
|
|
|
|
|
|
|
/* Set up signal handlers. */
|
2002-11-11 04:16:45 +05:30
|
|
|
signal(SIGINT, quit_signal);
|
|
|
|
signal(SIGTERM, quit_signal);
|
|
|
|
signal(SIGQUIT, quit_signal);
|
|
|
|
signal(SIGHUP, SIG_IGN);
|
|
|
|
signal(SIGCHLD, SIG_IGN);
|
2000-09-13 19:44:29 +05:30
|
|
|
#ifdef SIGCLD
|
2002-11-11 04:16:45 +05:30
|
|
|
signal(SIGCLD, SIG_IGN);
|
2000-09-13 19:44:29 +05:30
|
|
|
#endif
|
2002-11-11 04:16:45 +05:30
|
|
|
signal(SIGALRM, domark);
|
|
|
|
alarm(MarkInterval);
|
2000-04-04 23:44:25 +05:30
|
|
|
|
2000-04-19 05:21:51 +05:30
|
|
|
/* Create the syslog file so realpath() can work. */
|
2002-11-11 04:16:45 +05:30
|
|
|
if (realpath(_PATH_LOG, lfile) != NULL) {
|
|
|
|
unlink(lfile);
|
|
|
|
}
|
2000-04-04 23:44:25 +05:30
|
|
|
|
2002-11-11 04:16:45 +05:30
|
|
|
memset(&sunx, 0, sizeof(sunx));
|
2000-04-04 23:44:25 +05:30
|
|
|
sunx.sun_family = AF_UNIX;
|
2002-11-11 04:16:45 +05:30
|
|
|
strncpy(sunx.sun_path, lfile, sizeof(sunx.sun_path));
|
2006-08-03 21:11:12 +05:30
|
|
|
sock_fd = xsocket(AF_UNIX, SOCK_DGRAM, 0);
|
2002-11-11 04:16:45 +05:30
|
|
|
addrLength = sizeof(sunx.sun_family) + strlen(sunx.sun_path);
|
|
|
|
if (bind(sock_fd, (struct sockaddr *) &sunx, addrLength) < 0) {
|
2006-10-01 00:50:00 +05:30
|
|
|
bb_perror_msg_and_die("cannot connect to socket %s", lfile);
|
2002-11-11 04:16:45 +05:30
|
|
|
}
|
2000-04-04 23:44:25 +05:30
|
|
|
|
2002-11-11 04:16:45 +05:30
|
|
|
if (chmod(lfile, 0666) < 0) {
|
2006-10-01 00:50:00 +05:30
|
|
|
bb_perror_msg_and_die("cannot set permission on %s", lfile);
|
2002-11-11 04:16:45 +05:30
|
|
|
}
|
2006-10-06 15:19:47 +05:30
|
|
|
if (ENABLE_FEATURE_IPC_SYSLOG && (option_mask32 & OPT_circularlog)) {
|
2002-11-11 04:16:45 +05:30
|
|
|
ipcsyslog_init();
|
2001-04-06 02:25:17 +05:30
|
|
|
}
|
|
|
|
|
2006-02-16 21:10:24 +05:30
|
|
|
logMessage(LOG_SYSLOG | LOG_INFO, "syslogd started: " "BusyBox v" BB_VER );
|
2000-04-04 23:44:25 +05:30
|
|
|
|
|
|
|
for (;;) {
|
2002-11-11 04:16:45 +05:30
|
|
|
FD_ZERO(&fds);
|
|
|
|
FD_SET(sock_fd, &fds);
|
2000-04-04 23:44:25 +05:30
|
|
|
|
2002-11-11 04:16:45 +05:30
|
|
|
if (select(sock_fd + 1, &fds, NULL, NULL, NULL) < 0) {
|
2002-09-18 01:36:29 +05:30
|
|
|
if (errno == EINTR) {
|
|
|
|
/* alarm may have happened. */
|
|
|
|
continue;
|
|
|
|
}
|
2006-10-01 00:50:00 +05:30
|
|
|
bb_perror_msg_and_die("select");
|
2000-04-04 23:44:25 +05:30
|
|
|
}
|
|
|
|
|
2002-11-11 04:16:45 +05:30
|
|
|
if (FD_ISSET(sock_fd, &fds)) {
|
|
|
|
int i;
|
2005-10-15 19:19:21 +05:30
|
|
|
#if MAXLINE > BUFSIZ
|
|
|
|
# define TMP_BUF_SZ BUFSIZ
|
|
|
|
#else
|
|
|
|
# define TMP_BUF_SZ MAXLINE
|
|
|
|
#endif
|
|
|
|
#define tmpbuf bb_common_bufsiz1
|
2002-11-11 04:16:45 +05:30
|
|
|
|
2005-10-15 19:19:21 +05:30
|
|
|
if ((i = recv(sock_fd, tmpbuf, TMP_BUF_SZ, 0)) > 0) {
|
|
|
|
tmpbuf[i] = '\0';
|
2002-11-11 04:16:45 +05:30
|
|
|
serveConnection(tmpbuf, i);
|
|
|
|
} else {
|
2003-03-19 14:43:01 +05:30
|
|
|
bb_perror_msg_and_die("UNIX socket error");
|
2002-11-11 04:16:45 +05:30
|
|
|
}
|
|
|
|
} /* FD_ISSET() */
|
|
|
|
} /* for main loop */
|
1999-11-24 14:34:33 +05:30
|
|
|
}
|
|
|
|
|
2006-10-01 00:50:00 +05:30
|
|
|
|
2006-03-07 02:17:33 +05:30
|
|
|
int syslogd_main(int argc, char **argv)
|
1999-11-25 13:00:46 +05:30
|
|
|
{
|
2006-10-01 00:50:00 +05:30
|
|
|
char OPTION_DECL;
|
2000-02-09 01:28:47 +05:30
|
|
|
char *p;
|
|
|
|
|
2000-12-11 22:18:50 +05:30
|
|
|
/* do normal option parsing */
|
2006-10-06 15:19:47 +05:30
|
|
|
getopt32(argc, argv, OPTION_STR, OPTION_PARAM);
|
2006-10-08 18:19:22 +05:30
|
|
|
if (option_mask32 & OPT_mark) MarkInterval = xatoul_range(opt_m, 0, INT_MAX/60) * 60; // -m
|
2006-10-06 15:19:47 +05:30
|
|
|
//if (option_mask32 & OPT_nofork) // -n
|
|
|
|
//if (option_mask32 & OPT_outfile) // -O
|
|
|
|
if (option_mask32 & OPT_loglevel) { // -l
|
2006-10-08 18:19:22 +05:30
|
|
|
logLevel = xatoi_u(opt_l);
|
2006-10-01 00:50:00 +05:30
|
|
|
/* Valid levels are between 1 and 8 */
|
|
|
|
if (logLevel < 1 || logLevel > 8)
|
|
|
|
bb_show_usage();
|
|
|
|
}
|
2006-10-06 15:19:47 +05:30
|
|
|
//if (option_mask32 & OPT_small) // -S
|
2006-10-01 00:50:00 +05:30
|
|
|
#if ENABLE_FEATURE_ROTATE_LOGFILE
|
2006-10-08 18:19:22 +05:30
|
|
|
if (option_mask32 & OPT_filesize) logFileSize = xatoul_range(opt_s, 0, INT_MAX/1024) * 1024; // -s
|
2006-10-06 15:19:47 +05:30
|
|
|
if (option_mask32 & OPT_rotatecnt) { // -b
|
2006-10-08 18:19:22 +05:30
|
|
|
logFileRotate = xatoi_u(opt_b);
|
2006-10-01 00:50:00 +05:30
|
|
|
if (logFileRotate > 99) logFileRotate = 99;
|
|
|
|
}
|
2001-03-13 04:21:50 +05:30
|
|
|
#endif
|
2006-10-01 00:50:00 +05:30
|
|
|
#if ENABLE_FEATURE_REMOTE_LOG
|
2006-10-06 15:19:47 +05:30
|
|
|
if (option_mask32 & OPT_remotelog) { // -R
|
2006-10-01 00:51:24 +05:30
|
|
|
int port = 514;
|
|
|
|
char *host = xstrdup(opt_R);
|
|
|
|
p = strchr(host, ':');
|
2006-10-01 00:50:00 +05:30
|
|
|
if (p) {
|
2006-10-08 18:19:22 +05:30
|
|
|
port = xatou16(p + 1);
|
2006-10-01 00:50:00 +05:30
|
|
|
*p = '\0';
|
|
|
|
}
|
2006-10-01 00:51:24 +05:30
|
|
|
remoteaddr.sin_family = AF_INET;
|
|
|
|
/* FIXME: looks ip4-specific. need to do better */
|
|
|
|
remoteaddr.sin_addr = *(struct in_addr *) *(xgethostbyname(host)->h_addr_list);
|
|
|
|
remoteaddr.sin_port = htons(port);
|
|
|
|
free(host);
|
2006-10-01 00:50:00 +05:30
|
|
|
}
|
2006-10-06 15:19:47 +05:30
|
|
|
//if (option_mask32 & OPT_locallog) // -L
|
2000-07-21 05:11:24 +05:30
|
|
|
#endif
|
2006-10-01 00:50:00 +05:30
|
|
|
#if ENABLE_FEATURE_IPC_SYSLOG
|
2006-10-06 15:19:47 +05:30
|
|
|
if (option_mask32 & OPT_circularlog) { // -C
|
2006-10-01 00:50:00 +05:30
|
|
|
if (opt_C) {
|
2006-10-08 18:19:22 +05:30
|
|
|
shm_size = xatoul_range(opt_C, 4, INT_MAX/1024) * 1024;
|
1999-11-25 13:00:46 +05:30
|
|
|
}
|
|
|
|
}
|
2006-10-01 00:50:00 +05:30
|
|
|
#endif
|
2000-02-09 01:28:47 +05:30
|
|
|
|
2000-12-12 00:58:29 +05:30
|
|
|
/* If they have not specified remote logging, then log locally */
|
2006-10-06 15:19:47 +05:30
|
|
|
if (ENABLE_FEATURE_REMOTE_LOG && !(option_mask32 & OPT_remotelog))
|
|
|
|
option_mask32 |= OPT_locallog;
|
2001-03-13 04:21:50 +05:30
|
|
|
|
2000-02-09 01:28:47 +05:30
|
|
|
/* Store away localhost's name before the fork */
|
|
|
|
gethostname(LocalHostName, sizeof(LocalHostName));
|
2006-10-01 00:50:00 +05:30
|
|
|
p = strchr(LocalHostName, '.');
|
|
|
|
if (p) {
|
2003-09-11 05:05:45 +05:30
|
|
|
*p = '\0';
|
2000-02-09 01:28:47 +05:30
|
|
|
}
|
|
|
|
|
2000-04-04 23:44:25 +05:30
|
|
|
umask(0);
|
|
|
|
|
2006-10-06 15:19:47 +05:30
|
|
|
if (!(option_mask32 & OPT_nofork)) {
|
2006-05-31 15:49:51 +05:30
|
|
|
#ifdef BB_NOMMU
|
2003-12-16 03:27:44 +05:30
|
|
|
vfork_daemon_rexec(0, 1, argc, argv, "-n");
|
2006-05-31 15:49:51 +05:30
|
|
|
#else
|
2006-08-03 21:11:12 +05:30
|
|
|
xdaemon(0, 1);
|
2006-05-31 15:49:51 +05:30
|
|
|
#endif
|
2003-07-28 13:10:39 +05:30
|
|
|
}
|
2001-03-30 03:28:33 +05:30
|
|
|
doSyslogd();
|
1999-12-03 14:49:54 +05:30
|
|
|
|
2000-12-01 08:25:13 +05:30
|
|
|
return EXIT_SUCCESS;
|
1999-11-25 13:00:46 +05:30
|
|
|
}
|