1 [[!meta title="Janovec Jiří"]]
4 **Project name and homepage:** [Example project](http://www.example.com)
5 **Busybox bug 8626 ** [busybox.net](http://busybox.net)
10 Add support -i option to command logger in busybox to log PID.
11 This can be done using [syslog](http://linux.die.net/man/3/syslog) man pages.
13 [BUG link](https://bugs.busybox.net/show_bug.cgi?id=8626)
17 3. ???send to developers
18 4. create presentation
26 Links documenting the results of my work
29 Here, I'll add links similar to the examples below and describe what
32 * [[Example] My communication with developers in a public mailing list archive](http://groups.google.com/group/comp.os.minix/browse_thread/thread/e3df794a2bce97da/2194d253268b0a1b?#2194d253268b0a1b)
33 * [[Example] Version control repository with the actual state of my work](http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=summary)
34 * [[Example] My commit in the project repository](http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ea90002b0fa7bdee86ec22eba1d951f30bf043a6)
35 * [[Example] Additional supporting material](http://lwn.net/Articles/385586/)
40 * [[Presentation of the aim of my work in PDF or OpenDocument format (upload it as an *Attachment* to this page)|prezentace1.pdf]]
41 * [[Presentation of the results of my work|prezentace2.pdf]]
46 Here, I'll fill in the HTML code of the [OpenHub widget][w] showing my KudoRank.
49 <a href='https://www.openhub.net/accounts/9897?ref=Detailed' target='_blank'>
50 <img alt='Ohloh profile for wentasah' border='0' height='35' src='https://www.openhub.net/accounts/9897/widgets/account_detailed.gif' width='230' />
53 [w]:https://www.openhub.net/accounts/janovji3/widgets
61 diff --git a/sysklogd/logger.c b/sysklogd/logger.c
62 index b3ca857..58f9374 100644
63 --- a/sysklogd/logger.c
64 +++ b/sysklogd/logger.c
65 @@ -103,10 +103,12 @@ int logger_main(int argc UNUSED_PARAM, char **argv)
66 str_t = uid2uname_utoa(geteuid());
68 /* Parse any options */
69 - opt = getopt32(argv, "p:st:", &str_p, &str_t);
70 + opt = getopt32(argv, "p:st:i", &str_p, &str_t);
72 if (opt & 0x2) /* -s */
74 + if (opt & 0x8) /* -i */
76 //if (opt & 0x4) /* -t */
78 i = LOG_USER | LOG_NOTICE;
83 diff --git a/sysklogd/logger.c b/sysklogd/logger.c
84 index b3ca857..25b82cc 100644
85 --- a/sysklogd/logger.c
86 +++ b/sysklogd/logger.c
88 //config: messages to the system log (i.e. the 'syslogd' utility) so
89 //config: they can be logged. This is generally used to help locate
90 //config: problems that occur within programs and scripts.
92 +//config:config FEATURE_LOG_PID
93 +//config: bool "Log PID of logger"
95 +//config: depends on LOGGER
97 +//config: This enables logger to log process id (PID).
99 //applet:IF_LOGGER(APPLET(logger, BB_DIR_USR_BIN, BB_SUID_DROP))
102 //usage: "[OPTIONS] [MESSAGE]"
103 //usage:#define logger_full_usage "\n\n"
104 //usage: "Write MESSAGE (or stdin) to syslog\n"
105 +//usage: IF_FEATURE_LOG_PID(
106 +//usage: "\n -i Log the process ID too"
108 //usage: "\n -s Log to stderr as well as the system log"
109 //usage: "\n -t TAG Log using the specified tag (defaults to user name)"
110 //usage: "\n -p PRIO Priority (numeric or facility.level pair)"
117 + OPTBIT_priority = 0, // -p
118 + OPTBIT_stderr, // -s
120 + IF_FEATURE_LOG_PID(OPTBIT_pid ,) // -i
122 + OPT_priority = 1 << OPTBIT_priority ,
123 + OPT_stderr = 1 << OPTBIT_stderr ,
124 + OPT_tag = 1 << OPTBIT_tag ,
125 + OPT_pid = IF_FEATURE_LOG_PID((1 << OPTBIT_pid )) + 0,
127 +#define OPTION_STR "p:st:" \
128 + IF_FEATURE_LOG_PID("i:" )
129 +#define OPTION_DECL *str_p, *str_t
130 +#define OPTION_PARAM &str_p, &str_t
132 /* Decode a symbolic name to a numeric value
133 * this function is based on code
134 * Copyright (c) 1983, 1993
135 @@ -95,7 +122,7 @@ static int pencode(char *s)
136 int logger_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
137 int logger_main(int argc UNUSED_PARAM, char **argv)
139 - char *str_p, *str_t;
144 @@ -103,14 +130,19 @@ int logger_main(int argc UNUSED_PARAM, char **argv)
145 str_t = uid2uname_utoa(geteuid());
147 /* Parse any options */
148 - opt = getopt32(argv, "p:st:", &str_p, &str_t);
149 + opt = getopt32(argv, OPTION_STR, OPTION_PARAM);
150 +getopt32(argv, "p:st:i", &str_p, &str_t);
152 - if (opt & 0x2) /* -s */
153 + if (opt & OPT_stderr) /* -s */
155 - //if (opt & 0x4) /* -t */
156 +#if ENABLE_FEATURE_LOG_PID
157 + if (opt & OPT_pid) /* -i */
160 + //if (opt & OPT_tag) /* -t */
161 openlog(str_t, i, 0);
162 i = LOG_USER | LOG_NOTICE;
163 - if (opt & 0x1) /* -p */
164 + if (opt & OPT_priority) /* -p */