crond: make it NOMMU-capable

function                                             old     new   delta
safe_setenv4                                           -      62     +62
ForkJob                                              472     511     +39
change_identity                                       21      57     +36
ParseField                                           564     571      +7
SynchronizeDir                                       178     176      -2
LogLevel                                               4       -      -4
LogFile                                                4       -      -4
FileBase                                               4       -      -4
DebugOpt                                               4       -      -4
CDir                                                   4       -      -4
DeleteFile                                           141     132      -9
packed_usage                                       24248   24228     -20
crondlog                                             157     113     -44
change_identity_e2str                                 54       -     -54
SynchronizeFile                                      729     671     -58
crond_main                                          1555    1404    -151
------------------------------------------------------------------------------
(add/remove: 1/6 grow/shrink: 3/6 up/down: 144/-358)         Total: -214 bytes
This commit is contained in:
Denis Vlasenko 2008-03-12 22:10:25 +00:00
parent 35e9c5d83a
commit 4e6c8120a5
6 changed files with 403 additions and 429 deletions

View File

@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Busybox version: 1.10.0.svn
# Tue Feb 19 15:07:07 2008
# Tue Mar 4 22:57:04 2008
#
CONFIG_HAVE_DOT_CONFIG=y
@ -73,11 +73,11 @@ CONFIG_PREFIX="./_install"
#
CONFIG_PASSWORD_MINLEN=6
CONFIG_MD5_SIZE_VS_SPEED=2
# CONFIG_FEATURE_FAST_TOP is not set
# CONFIG_FEATURE_ETC_NETWORKS is not set
CONFIG_FEATURE_FAST_TOP=y
CONFIG_FEATURE_ETC_NETWORKS=y
CONFIG_FEATURE_EDITING=y
CONFIG_FEATURE_EDITING_MAX_LEN=1024
# CONFIG_FEATURE_EDITING_VI is not set
CONFIG_FEATURE_EDITING_VI=y
CONFIG_FEATURE_EDITING_HISTORY=15
# CONFIG_FEATURE_EDITING_SAVEHISTORY is not set
CONFIG_FEATURE_TAB_COMPLETION=y
@ -102,7 +102,7 @@ CONFIG_BZIP2=y
CONFIG_CPIO=y
CONFIG_DPKG=y
CONFIG_DPKG_DEB=y
# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY=y
CONFIG_GUNZIP=y
CONFIG_FEATURE_GUNZIP_UNCOMPRESS=y
CONFIG_GZIP=y
@ -212,6 +212,7 @@ CONFIG_FEATURE_READLINK_FOLLOW=y
CONFIG_REALPATH=y
CONFIG_RM=y
CONFIG_RMDIR=y
CONFIG_FEATURE_RMDIR_LONG_OPTIONS=y
CONFIG_SEQ=y
CONFIG_SHA1SUM=y
CONFIG_SLEEP=y
@ -318,7 +319,7 @@ CONFIG_PATCH=y
CONFIG_SED=y
CONFIG_VI=y
CONFIG_FEATURE_VI_MAX_LEN=4096
# CONFIG_FEATURE_VI_8BIT is not set
CONFIG_FEATURE_VI_8BIT=y
CONFIG_FEATURE_VI_COLON=y
CONFIG_FEATURE_VI_YANKMARK=y
CONFIG_FEATURE_VI_SEARCH=y
@ -401,7 +402,7 @@ CONFIG_FEATURE_WTMP=y
CONFIG_LOGIN=y
# CONFIG_PAM is not set
CONFIG_LOGIN_SCRIPTS=y
# CONFIG_FEATURE_NOLOGIN is not set
CONFIG_FEATURE_NOLOGIN=y
CONFIG_FEATURE_SECURETTY=y
CONFIG_PASSWD=y
CONFIG_FEATURE_PASSWD_WEAK_CHECK=y
@ -559,10 +560,10 @@ CONFIG_FEATURE_CHAT_SEND_ESCAPES=y
CONFIG_FEATURE_CHAT_VAR_ABORT_LEN=y
CONFIG_FEATURE_CHAT_CLR_ABORT=y
CONFIG_CHRT=y
# CONFIG_CROND is not set
# CONFIG_DEBUG_CROND_OPTION is not set
# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
# CONFIG_CRONTAB is not set
CONFIG_CROND=y
CONFIG_DEBUG_CROND_OPTION=y
CONFIG_FEATURE_CROND_CALL_SENDMAIL=y
CONFIG_CRONTAB=y
CONFIG_DC=y
# CONFIG_DEVFSD is not set
# CONFIG_DEVFSD_MODLOAD is not set
@ -596,6 +597,7 @@ CONFIG_RAIDAUTORUN=y
CONFIG_READAHEAD=y
CONFIG_RUNLEVEL=y
CONFIG_RX=y
CONFIG_SCRIPT=y
CONFIG_STRINGS=y
CONFIG_SETSID=y
CONFIG_TASKSET=y
@ -641,6 +643,7 @@ CONFIG_FEATURE_IFCONFIG_SLIP=y
CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y
CONFIG_FEATURE_IFCONFIG_HW=y
CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y
CONFIG_IFENSLAVE=y
# CONFIG_IFUPDOWN is not set
CONFIG_IFUPDOWN_IFSTATE_PATH=""
# CONFIG_FEATURE_IFUPDOWN_IP is not set
@ -687,11 +690,7 @@ CONFIG_FEATURE_FANCY_PING=y
CONFIG_PSCAN=y
CONFIG_ROUTE=y
CONFIG_SENDMAIL=y
CONFIG_FEATURE_SENDMAIL_EHLO=y
CONFIG_FEATURE_SENDMAIL_BLOATY=y
CONFIG_FETCHMAIL=y
CONFIG_FEATURE_FETCHMAIL_APOP=y
CONFIG_FEATURE_FETCHMAIL_FILTER=y
CONFIG_SLATTACH=y
CONFIG_TELNET=y
CONFIG_FEATURE_TELNET_TTYPE=y
@ -702,7 +701,7 @@ CONFIG_TFTP=y
CONFIG_FEATURE_TFTP_GET=y
CONFIG_FEATURE_TFTP_PUT=y
CONFIG_FEATURE_TFTP_BLOCKSIZE=y
# CONFIG_DEBUG_TFTP is not set
CONFIG_DEBUG_TFTP=y
CONFIG_TRACEROUTE=y
CONFIG_FEATURE_TRACEROUTE_VERBOSE=y
CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE=y
@ -711,11 +710,13 @@ CONFIG_APP_UDHCPD=y
CONFIG_APP_DHCPRELAY=y
CONFIG_APP_DUMPLEASES=y
CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY=y
CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases"
CONFIG_APP_UDHCPC=y
CONFIG_FEATURE_UDHCPC_ARPING=y
CONFIG_FEATURE_UDHCP_PORT=y
CONFIG_FEATURE_UDHCP_DEBUG=y
CONFIG_FEATURE_RFC3397=y
CONFIG_DHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
CONFIG_VCONFIG=y
CONFIG_WGET=y
@ -777,7 +778,7 @@ CONFIG_FEATURE_SH_IS_NONE=y
CONFIG_HUSH=y
CONFIG_HUSH_HELP=y
CONFIG_HUSH_INTERACTIVE=y
# CONFIG_HUSH_JOB is not set
CONFIG_HUSH_JOB=y
CONFIG_HUSH_TICK=y
CONFIG_HUSH_IF=y
CONFIG_HUSH_LOOPS=y
@ -797,6 +798,7 @@ CONFIG_CTTYHACK=y
CONFIG_SYSLOGD=y
CONFIG_FEATURE_ROTATE_LOGFILE=y
CONFIG_FEATURE_REMOTE_LOG=y
CONFIG_FEATURE_SYSLOGD_DUP=y
CONFIG_FEATURE_IPC_SYSLOG=y
CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16
CONFIG_LOGREAD=y
@ -832,6 +834,13 @@ CONFIG_SOFTLIMIT=y
# CONFIG_SETSEBOOL is not set
# CONFIG_SESTATUS is not set
#
# print support
#
CONFIG_LPD=y
CONFIG_LPR=y
CONFIG_LPQ=y
#
# ipsvd utilities
#

View File

@ -912,7 +912,6 @@ char *bb_simplify_path(const char *path);
#define FAIL_DELAY 3
extern void bb_do_delay(int seconds);
extern void change_identity(const struct passwd *pw);
extern const char *change_identity_e2str(const struct passwd *pw);
extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args) ATTRIBUTE_NORETURN;
extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args);
#if ENABLE_SELINUX

View File

@ -507,16 +507,17 @@ USE_FEATURE_BRCTL_FANCY("\n" \
" F Input from file"
#define crond_trivial_usage \
"-d[#] -c crondir -f -b"
"-fbS -l N " USE_DEBUG_CROND_OPTION("-d N ") "-L LOGFILE -c DIR"
#define crond_full_usage \
" -d [#] -l [#] -S -L logfile -f -b -c dir\n" \
" -d num Debug level\n" \
" -l num Log level (8 - default)\n" \
" -f Foreground\n" \
" -b Background (default)\n" \
" -S Log to syslog (default)\n" \
" -L file Log to file\n" \
" -f Run in foreground\n" \
" -b Run in background (default)\n" \
" -c dir Working dir"
" -l Set log level. 0 is the most verbose, default 8\n" \
USE_DEBUG_CROND_OPTION( \
" -d Set log level, log to stderr\n" \
) \
" -L Log to file\n" \
" -c Working dir"
#define crontab_trivial_usage \
"[-c DIR] [-u USER] [-ler]|[FILE]"

View File

@ -30,22 +30,12 @@
#include "libbb.h"
/* Become the user and group(s) specified by PW. */
const char *change_identity_e2str(const struct passwd *pw)
void change_identity(const struct passwd *pw)
{
if (initgroups(pw->pw_name, pw->pw_gid) == -1)
return "cannot set groups";
bb_perror_msg_and_die("can't set groups");
endgrent(); /* ?? */
xsetgid(pw->pw_gid);
xsetuid(pw->pw_uid);
return NULL;
}
void change_identity(const struct passwd *pw)
{
const char *err_msg = change_identity_e2str(pw);
if (err_msg)
bb_simple_perror_msg_and_die(err_msg);
}

View File

@ -106,15 +106,13 @@ config CROND
$ cat /var/spool/cron/crontabs/root
# Run daily cron jobs at 4:40 every day:
40 4 * * * /etc/cron/daily > /dev/null 2>&1
Note that Busybox binary must be setuid root for this applet to
work properly.
config DEBUG_CROND_OPTION
bool "Support debug option -d"
bool "Support option -d to redirect output to stderr"
depends on CROND
default n
help
Support option -d to enter debug mode.
-d sets loglevel to 0 (most verbose) and directs all output to stderr.
config FEATURE_CROND_CALL_SENDMAIL
bool "Using /usr/sbin/sendmail?"
@ -130,6 +128,8 @@ config CRONTAB
help
Crontab manipulates the crontab for a particular user. Only
the superuser may specify a different user and/or crontab directory.
Note that Busybox binary must be setuid root for this applet to
work properly.
config DC
bool "dc"

File diff suppressed because it is too large Load Diff