Thread: [Dhcp-agent-commits] dhcp-agent acconfig.h,1.5,1.6 acinclude.m4,1.5,1.6 aclocal.m4,1.5,1.6 config.h.
Status: Alpha
Brought to you by:
actmodern
From: <bk...@us...> - 2002-06-10 23:15:23
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv8642 Modified Files: acconfig.h acinclude.m4 aclocal.m4 config.h.in configure configure.in Log Message: Check for kill(pid, 0) behaviour. Index: acconfig.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/acconfig.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** acconfig.h 6 Jun 2002 23:59:00 -0000 1.5 --- acconfig.h 10 Jun 2002 23:15:20 -0000 1.6 *************** *** 13,14 **** --- 13,17 ---- /* have sig_atomic_t */ #undef HAVE_SIG_ATOMIC_T + + /* kill(pid, 0) can be used to detect a process we can signal */ + #undef KILL_SIGNAL_DETECT Index: acinclude.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/acinclude.m4,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** acinclude.m4 6 Jun 2002 03:25:04 -0000 1.5 --- acinclude.m4 10 Jun 2002 23:15:20 -0000 1.6 *************** *** 154,155 **** --- 154,204 ---- ], [ac_have_primacros_h="1"], AC_MSG_ERROR([I could not generate replacement C99 macros for stdint types! sorry I cannot carry on!]))]) + + AC_DEFUN(AC_WF_CHECK_KILL_SIGNAL_DETECT, + [AC_MSG_CHECKING(if kill can be used to detect a process that can be signaled) + AC_TRY_RUN([ + /* Check the behaviour of kill(pid, 0). + * We expect it to return 0 for an existing process that we can + * signal, and < 0 otherwise. + */ + + #include <stdlib.h> + #include <stdio.h> + + #include <sys/types.h> + #include <sys/wait.h> + #include <signal.h> + #include <unistd.h> + + int main(int argc, char *argv[]) + { + pid_t child_pid; + int kill_existing, kill_nonexisting; + int wait_status; + + child_pid = fork(); + + if (child_pid == -1) { + perror("fork"); + exit(1); + } else if (child_pid == 0) { + (void)sleep(3600); + _exit(0); + } + + kill_existing = kill(child_pid, 0); + + (void)kill(child_pid, SIGTERM); + (void)wait(&wait_status); + + kill_nonexisting = kill(child_pid, 0); + + if (kill_existing == 0 && kill_nonexisting < 0) + exit(0); /* the behaviour we expect */ + else + fprintf(stderr, "error: returned (%d,%d); expecting (0,-1)\n", + kill_existing, kill_nonexisting); + + exit(1); + } + ], [AC_DEFINE(KILL_SIGNAL_DETECT) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])]) Index: aclocal.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/aclocal.m4,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** aclocal.m4 6 Jun 2002 03:25:04 -0000 1.5 --- aclocal.m4 10 Jun 2002 23:15:20 -0000 1.6 *************** *** 1,5 **** ! dnl aclocal.m4 generated automatically by aclocal 1.4-p4 ! dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, --- 1,5 ---- ! dnl aclocal.m4 generated automatically by aclocal 1.4-p5 ! dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, *************** *** 167,170 **** --- 167,219 ---- AC_MSG_ERROR([I could not generate replacement C99 macros for stdint types! sorry I cannot carry on!]))]) + AC_DEFUN(AC_WF_CHECK_KILL_SIGNAL_DETECT, + [AC_MSG_CHECKING(if kill can be used to detect a process that can be signaled) + AC_TRY_RUN([ + /* Check the behaviour of kill(pid, 0). + * We expect it to return 0 for an existing process that we can + * signal, and < 0 otherwise. + */ + + #include <stdlib.h> + #include <stdio.h> + + #include <sys/types.h> + #include <sys/wait.h> + #include <signal.h> + #include <unistd.h> + + int main(int argc, char *argv[]) + { + pid_t child_pid; + int kill_existing, kill_nonexisting; + int wait_status; + + child_pid = fork(); + + if (child_pid == -1) { + perror("fork"); + exit(1); + } else if (child_pid == 0) { + (void)sleep(3600); + _exit(0); + } + + kill_existing = kill(child_pid, 0); + + (void)kill(child_pid, SIGTERM); + (void)wait(&wait_status); + + kill_nonexisting = kill(child_pid, 0); + + if (kill_existing == 0 && kill_nonexisting < 0) + exit(0); /* the behaviour we expect */ + else + fprintf(stderr, "error: returned (%d,%d); expecting (0,-1)\n", + kill_existing, kill_nonexisting); + + exit(1); + } + ], [AC_DEFINE(KILL_SIGNAL_DETECT) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])]) + # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. *************** *** 176,180 **** dnl AM_INIT_AUTOMAKE(package,version, [no-define]) ! AC_DEFUN(AM_INIT_AUTOMAKE, [AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] --- 225,229 ---- dnl AM_INIT_AUTOMAKE(package,version, [no-define]) ! AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] *************** *** 204,208 **** # ! AC_DEFUN(AM_SANITY_CHECK, [AC_MSG_CHECKING([whether build environment is sane]) # Just in case --- 253,257 ---- # ! AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case *************** *** 245,249 **** dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. ! AC_DEFUN(AM_MISSING_PROG, [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if --- 294,298 ---- dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. ! AC_DEFUN([AM_MISSING_PROG], [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if *************** *** 261,265 **** # Like AC_CONFIG_HEADER, but automatically create stamp file. ! AC_DEFUN(AM_CONFIG_HEADER, [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) --- 310,314 ---- # Like AC_CONFIG_HEADER, but automatically create stamp file. ! AC_DEFUN([AM_CONFIG_HEADER], [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) Index: config.h.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/config.h.in,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** config.h.in 7 Jun 2002 00:04:37 -0000 1.10 --- config.h.in 10 Jun 2002 23:15:20 -0000 1.11 *************** *** 15,18 **** --- 15,21 ---- #undef HAVE_SIG_ATOMIC_T + /* kill(pid, 0) can be used to detect a process we can signal */ + #undef KILL_SIGNAL_DETECT + /* default client work directory */ #undef CLIENT_WORK_DIR Index: configure =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** configure 7 Jun 2002 12:51:12 -0000 1.18 --- configure 10 Jun 2002 23:15:20 -0000 1.19 *************** *** 1,5 **** #! /bin/sh # Guess values for system-dependent variables and create Makefiles. ! # Generated by Autoconf 2.50 for dhcp-agent 0.36. # # Report bugs to <tm...@wh...>. --- 1,5 ---- #! /bin/sh # Guess values for system-dependent variables and create Makefiles. ! # Generated by Autoconf 2.52 for dhcp-agent 0.36. # [...3165 lines suppressed...] { (exit 1); exit 1; }; } --- 3868,3872 ---- else # /dev/null tree ! { { echo "$as_me:3870: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3840,3844 **** if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3842: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else --- 3985,3989 ---- if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3987: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else Index: configure.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.in,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** configure.in 7 Jun 2002 12:51:13 -0000 1.18 --- configure.in 10 Jun 2002 23:15:20 -0000 1.19 *************** *** 47,50 **** --- 47,54 ---- AC_SUBST(DHCP_SNPRINTF) + dnl check if kill(pid, 0) can be used to detect a process we can signal + + AC_WF_CHECK_KILL_SIGNAL_DETECT + dnl check for types |