mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-04-06 15:00:40 +08:00
Add wait4/3 detection.
Modify slapd_tester to use pid_t and wait macros. May need to implement additional macros in ac/wait.h (in addition to WEXITSTATUS and WIFEXITED).
This commit is contained in:
parent
598b7473fe
commit
30f953160f
31
configure
vendored
31
configure
vendored
@ -10103,15 +10103,16 @@ for ac_func in \
|
||||
strspn \
|
||||
sysconf \
|
||||
waitpid \
|
||||
wait4 \
|
||||
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:10110: checking for $ac_func" >&5
|
||||
echo "configure:10111: checking for $ac_func" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 10115 "configure"
|
||||
#line 10116 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -10134,7 +10135,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:10138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:10139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
@ -10162,12 +10163,12 @@ done
|
||||
for ac_func in getopt tempnam
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:10166: checking for $ac_func" >&5
|
||||
echo "configure:10167: checking for $ac_func" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 10171 "configure"
|
||||
#line 10172 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -10190,7 +10191,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:10194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:10195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
@ -10220,13 +10221,13 @@ done
|
||||
# Check Configuration
|
||||
|
||||
echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
|
||||
echo "configure:10224: checking declaration of sys_errlist" >&5
|
||||
echo "configure:10225: checking declaration of sys_errlist" >&5
|
||||
if eval "test \"`echo '$''{'ol_cv_dcl_sys_errlist'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 10230 "configure"
|
||||
#line 10231 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@ -10236,7 +10237,7 @@ int main() {
|
||||
char *c = (char *) *sys_errlist
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:10240: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:10241: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
ol_cv_dcl_sys_errlist=yes
|
||||
else
|
||||
@ -10256,20 +10257,20 @@ if test $ol_cv_dcl_sys_errlist = no ; then
|
||||
EOF
|
||||
|
||||
echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
|
||||
echo "configure:10260: checking existence of sys_errlist" >&5
|
||||
echo "configure:10261: checking existence of sys_errlist" >&5
|
||||
if eval "test \"`echo '$''{'ol_cv_have_sys_errlist'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 10266 "configure"
|
||||
#line 10267 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <errno.h>
|
||||
int main() {
|
||||
char *c = (char *) *sys_errlist
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:10273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:10274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
ol_cv_have_sys_errlist=yes
|
||||
else
|
||||
@ -10293,13 +10294,13 @@ fi
|
||||
|
||||
|
||||
echo $ac_n "checking strdup declaration""... $ac_c" 1>&6
|
||||
echo "configure:10297: checking strdup declaration" >&5
|
||||
echo "configure:10298: checking strdup declaration" >&5
|
||||
if eval "test \"`echo '$''{'ol_cv_dcl_strdup'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 10303 "configure"
|
||||
#line 10304 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#include <string.h>
|
||||
@ -10307,7 +10308,7 @@ int main() {
|
||||
extern char *strdup();
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:10311: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:10312: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
ol_cv_dcl_strdup=yes
|
||||
else
|
||||
|
@ -1701,6 +1701,7 @@ AC_CHECK_FUNCS( \
|
||||
strspn \
|
||||
sysconf \
|
||||
waitpid \
|
||||
wait4 \
|
||||
)
|
||||
|
||||
dnl We actually may need to replace more than this.
|
||||
|
@ -339,6 +339,9 @@
|
||||
/* Define if you have the vsprintf function. */
|
||||
#undef HAVE_VSPRINTF
|
||||
|
||||
/* Define if you have the wait4 function. */
|
||||
#undef HAVE_WAIT4
|
||||
|
||||
/* Define if you have the waitpid function. */
|
||||
#undef HAVE_WAITPID
|
||||
|
||||
|
@ -3,14 +3,16 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ac/string.h>
|
||||
#include <ac/ctype.h>
|
||||
#include <ac/dirent.h>
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/unistd.h>
|
||||
#include <ac/wait.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#include "ldapconfig.h"
|
||||
|
||||
@ -305,7 +307,7 @@ get_read_entries( char *filename, char *entries[] )
|
||||
static void
|
||||
fork_child( char *prog, char *args[] )
|
||||
{
|
||||
int pid;
|
||||
pid_t pid;
|
||||
|
||||
wait4kids( maxkids );
|
||||
|
||||
@ -332,25 +334,33 @@ static void
|
||||
wait4kids( int nkidval )
|
||||
{
|
||||
int status;
|
||||
unsigned char *p;
|
||||
|
||||
while ( nkids >= nkidval ) {
|
||||
wait( &status );
|
||||
p = (unsigned char *) &status;
|
||||
if ( p[sizeof(int) - 1] == 0177 ) {
|
||||
|
||||
if ( WIFSTOPPED(status) ) {
|
||||
fprintf( stderr,
|
||||
"stopping: child stopped with signal %d\n",
|
||||
p[sizeof(int) - 2] );
|
||||
} else if ( p[sizeof(int) - 1] != 0 ) {
|
||||
(int) WSTOPSIG(status) );
|
||||
|
||||
} else if ( WIFSIGNALED(status) ) {
|
||||
fprintf( stderr,
|
||||
"stopping: child terminated with signal %d\n",
|
||||
p[sizeof(int) - 1] );
|
||||
exit( p[sizeof(int) - 1] );
|
||||
} else if ( p[sizeof(int) - 2] != 0 ) {
|
||||
"stopping: child terminated with signal %d%s\n",
|
||||
(int) WTERMSIG(status),
|
||||
#ifdef WCOREDUMP
|
||||
WCOREDUMP(status) ? ", core dumped" : ""
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
);
|
||||
exit( WEXITSTATUS(status) );
|
||||
|
||||
} else if ( WEXITSTATUS(status) != 0 ) {
|
||||
fprintf( stderr,
|
||||
"stopping: child exited with status %d\n",
|
||||
p[sizeof(int) - 2] );
|
||||
exit( p[sizeof(int) - 2] );
|
||||
(int) WEXITSTATUS(status) );
|
||||
exit( WEXITSTATUS(status) );
|
||||
|
||||
} else {
|
||||
nkids--;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user