aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-12-03 10:46:12 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-12-03 10:46:12 +0000
commit6ebb2f56d57ee2e900954d2264b605353cf44ca2 (patch)
tree5276c764e098351cbb2bebe9862dbc8ed6955a5b
parentf8535ccd65d21db9762be8715a6107889a50977f (diff)
downloadbusybox-6ebb2f56d57ee2e900954d2264b605353cf44ca2.tar.gz
crond: use bb_setpgrp, not setpgrp
platform.h: make a bit more readable
-rw-r--r--include/platform.h46
-rw-r--r--miscutils/crond.c4
2 files changed, 26 insertions, 24 deletions
diff --git a/include/platform.h b/include/platform.h
index 8657ba478..b8c85dba0 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -78,7 +78,7 @@
//__attribute__ ((__externally_visible__))
#else
# define EXTERNALLY_VISIBLE
-#endif /* GNUC >= 4.1 */
+#endif
/* We use __extension__ in some places to suppress -pedantic warnings
about GCC extensions. This feature didn't work properly before
@@ -185,7 +185,7 @@ typedef int socklen_t;
* until userspace is widely fixed. */
#if (defined __INTEL_COMPILER && !defined __GNUC__) || \
(defined __GNUC__ && defined __STRICT_ANSI__)
-__extension__ typedef __signed__ long long __s64;
+__extension__ typedef long long __s64;
__extension__ typedef unsigned long long __u64;
#endif
@@ -296,30 +296,32 @@ static ALWAYS_INLINE char* strchrnul(const char *s, char c)
#endif
#if (defined __digital__ && defined __unix__)
-#include <standards.h>
-#define HAVE_STANDARDS_H
-#include <inttypes.h>
-#define HAVE_INTTYPES_H
-#define PRIu32 "u"
+# include <standards.h>
+# define HAVE_STANDARDS_H
+# include <inttypes.h>
+# define HAVE_INTTYPES_H
+# define PRIu32 "u"
/* use legacy setpgrp(pid_t,pid_t) for now. move to platform.c */
-#define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me,__me); } while (0)
+# define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me,__me); } while (0)
-#if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET
-#define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET)
-#endif
-#if !defined ADJ_FREQUENCY && defined MOD_FREQUENCY
-#define ADJ_FREQUENCY MOD_FREQUENCY
-#endif
-#if !defined ADJ_TIMECONST && defined MOD_TIMECONST
-#define ADJ_TIMECONST MOD_TIMECONST
-#endif
-#if !defined ADJ_TICK && defined MOD_CLKB
-#define ADJ_TICK MOD_CLKB
-#endif
+# if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET
+# define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET)
+# endif
+# if !defined ADJ_FREQUENCY && defined MOD_FREQUENCY
+# define ADJ_FREQUENCY MOD_FREQUENCY
+# endif
+# if !defined ADJ_TIMECONST && defined MOD_TIMECONST
+# define ADJ_TIMECONST MOD_TIMECONST
+# endif
+# if !defined ADJ_TICK && defined MOD_CLKB
+# define ADJ_TICK MOD_CLKB
+# endif
+
+#else /* !__digital__ */
+
+# define bb_setpgrp() setpgrp()
-#else
-#define bb_setpgrp() setpgrp()
#endif
#if defined(__linux__)
diff --git a/miscutils/crond.c b/miscutils/crond.c
index 1960a2c35..d2eb115bc 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -780,7 +780,7 @@ ForkJob(const char *user, CronLine *line, int mailFd,
dup2(1, 2);
}
/* "standard" cron puts tasks in separate process groups */
- setpgrp();
+ bb_setpgrp();
execlp(prog, prog, cmd, arg, NULL);
crondlog(ERR20 "can't exec, user %s cmd %s %s %s", user, prog, cmd, arg);
if (mail_filename) {
@@ -917,7 +917,7 @@ static void RunJob(const char *user, CronLine *line)
crondlog(LVL5 "child running %s", DEFAULT_SHELL);
}
/* "standard" cron puts tasks in separate process groups */
- setpgrp();
+ bb_setpgrp();
execl(DEFAULT_SHELL, DEFAULT_SHELL, "-c", line->cl_Shell, NULL);
crondlog(ERR20 "can't exec, user %s cmd %s %s %s", user,
DEFAULT_SHELL, "-c", line->cl_Shell);