As part of this, switch from the deprecated wait3() to waitpid().
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
-/* Define as the return type of signal handlers (int or void). */
-#undef RETSIGTYPE
-
/* Define if your struct nlist has an n_un member. */
#undef NLIST_NAME_UNION
/* Define if you have the strftime function. */
#undef HAVE_STRFTIME
-/* Define if you have the wait3 system call. */
-#undef HAVE_WAIT3
-
/* ****************************************************************** */
/* *** Headers *** */
dnl Initial settings
dnl ---------------------------------------------------------------------
-AC_INIT(allow.c)
-AC_CONFIG_HEADER(config.h)
-AC_PREREQ(2.57)
+AC_INIT
+AC_CONFIG_SRCDIR([allow.c])
+AC_CONFIG_HEADERS([config.h])
+AC_PREREQ([2.71])
m4_include([m4/ax_lib_readline.m4])
vers="3.3.2"
dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDBOOL
-AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h sys/file.h sys/ioctl.h sys/time.h syslog.h unistd.h)
AC_CHECK_HEADERS(errno.h sys/fcntl.h getopt.h limits.h)
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
-AC_HEADER_TIME
+AC_CHECK_HEADERS_ONCE([sys/time.h])
+
AC_STRUCT_TM
AC_TYPE_UID_T
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
-AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
-AC_FUNC_WAIT3
AC_CHECK_LIB(xnet, shutdown)
AC_CHECK_LIB(selinux, getcon, [selinuxavail=1], [selinuxavail=0])
AC_CHECK_LIB(audit, audit_open, [auditavail=1], [auditavail=0])
dnl Check for post-Reno style struct sockaddr
AC_CACHE_CHECK([for sa_len],
ac_cv_sa_len,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/socket.h>], [int main(void) {
- struct sockaddr t;t.sa_len = 0;}],
- ac_cv_sa_len=yes,ac_cv_sa_len=no)])
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#include <sys/socket.h>]], [[int main(void) {
+ struct sockaddr t;t.sa_len = 0;}]])],[ac_cv_sa_len=yes],[ac_cv_sa_len=no])])
if test $ac_cv_sa_len = yes; then
AC_DEFINE(HAVE_SA_LEN)
fi
dnl ---------------------------------------------------------------------
-AC_OUTPUT(Makefile doc/Makefile test/Makefile doc/stylesheets/fcron-doc.dsl)
+AC_CONFIG_FILES([Makefile doc/Makefile test/Makefile doc/stylesheets/fcron-doc.dsl])
+AC_OUTPUT
dnl ---------------------------------------------------------------------
/* debug("wait_chld"); */
/* // */
- while ((pid = wait3(NULL, WNOHANG, NULL)) > 0) {
+ while ((pid = waitpid(-1, NULL, WNOHANG)) > 0) {
for (e = exe_list_first(exe_list); e != NULL;
e = exe_list_next(exe_list)) {
debug("Waiting for all jobs");
- while ((*counter > 0) && (pid = wait3(NULL, 0, NULL)) > 0) {
+ while ((*counter > 0) && (pid = waitpid(-1, NULL, 0)) > 0) {
for (e = exe_list_first(exe_list); e != NULL;
e = exe_list_next(exe_list)) {
if (pid == e->e_ctrl_pid) {
void info(void);
void usage(void);
void print_schedule(void);
-RETSIGTYPE sighup_handler(int x);
-RETSIGTYPE sigterm_handler(int x);
-RETSIGTYPE sigchild_handler(int x);
-RETSIGTYPE sigusr1_handler(int x);
-RETSIGTYPE sigusr2_handler(int x);
-RETSIGTYPE sigcont_handler(int x);
+void sighup_handler(int x);
+void sigterm_handler(int x);
+void sigchild_handler(int x);
+void sigusr1_handler(int x);
+void sigusr2_handler(int x);
+void sigcont_handler(int x);
int parseopt(int argc, char *argv[]);
void get_lock(void);
int is_system_reboot(void);
}
-RETSIGTYPE
+void
sigterm_handler(int x)
/* exit safely */
{
xexit(EXIT_OK);
}
-RETSIGTYPE
+void
sighup_handler(int x)
/* update configuration */
{
sig_conf = 1;
}
-RETSIGTYPE
+void
sigchild_handler(int x)
/* call wait_chld() to take care of finished jobs */
{
}
-RETSIGTYPE
+void
sigusr1_handler(int x)
/* reload all configurations */
{
}
-RETSIGTYPE
+void
sigusr2_handler(int x)
/* print schedule and switch on/off debug mode */
{
sig_debug = 1;
}
-RETSIGTYPE
+void
sigcont_handler(int x)
/* used to notify fcron of a system resume after suspend.
* However this signal could also be received in other cases. */
void info(void);
void usage(void);
void xexit(int exit_val);
-RETSIGTYPE sigpipe_handler(int x);
+void sigpipe_handler(int x);
int interactive_mode(int fd);
/* returned by parse_cmd() and/or talk_fcron() */
#define QUIT_CMD 1
exit(EXIT_ERR);
}
-RETSIGTYPE
+void
sigpipe_handler(int x)
/* handle broken pipes ... */
{
#include <syslog.h>
#endif
-#ifdef TIME_WITH_SYS_TIME
#include <time.h>
-#elif HAVE_SYS_TIME_H
+#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
xclose_check(&(pipe_pid_fd[1]), "child's pipe_pid_fd[1]");
/* we use a while because of a possible interruption by a signal */
- while ((pid = wait3(&status, 0, NULL)) > 0) {
+ while ((pid = waitpid(-1, &status, 0)) > 0) {
#ifdef CHECKRUNJOB
debug("run_job(): child: ending job pid %d", pid);
#endif /* CHECKRUNJOB */