mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05: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
4 changed files with 44 additions and 29 deletions
31
configure
vendored
31
configure
vendored
|
|
@ -10103,15 +10103,16 @@ for ac_func in \
|
||||||
strspn \
|
strspn \
|
||||||
sysconf \
|
sysconf \
|
||||||
waitpid \
|
waitpid \
|
||||||
|
wait4 \
|
||||||
|
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
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
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 10115 "configure"
|
#line 10116 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
|
@ -10134,7 +10135,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
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*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
|
@ -10162,12 +10163,12 @@ done
|
||||||
for ac_func in getopt tempnam
|
for ac_func in getopt tempnam
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
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
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 10171 "configure"
|
#line 10172 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
|
@ -10190,7 +10191,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
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*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
|
@ -10220,13 +10221,13 @@ done
|
||||||
# Check Configuration
|
# Check Configuration
|
||||||
|
|
||||||
echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
|
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
|
if eval "test \"`echo '$''{'ol_cv_dcl_sys_errlist'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
|
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 10230 "configure"
|
#line 10231 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -10236,7 +10237,7 @@ int main() {
|
||||||
char *c = (char *) *sys_errlist
|
char *c = (char *) *sys_errlist
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
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*
|
rm -rf conftest*
|
||||||
ol_cv_dcl_sys_errlist=yes
|
ol_cv_dcl_sys_errlist=yes
|
||||||
else
|
else
|
||||||
|
|
@ -10256,20 +10257,20 @@ if test $ol_cv_dcl_sys_errlist = no ; then
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
|
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
|
if eval "test \"`echo '$''{'ol_cv_have_sys_errlist'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
|
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 10266 "configure"
|
#line 10267 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
int main() {
|
int main() {
|
||||||
char *c = (char *) *sys_errlist
|
char *c = (char *) *sys_errlist
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
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*
|
rm -rf conftest*
|
||||||
ol_cv_have_sys_errlist=yes
|
ol_cv_have_sys_errlist=yes
|
||||||
else
|
else
|
||||||
|
|
@ -10293,13 +10294,13 @@ fi
|
||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking strdup declaration""... $ac_c" 1>&6
|
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
|
if eval "test \"`echo '$''{'ol_cv_dcl_strdup'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
|
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 10303 "configure"
|
#line 10304 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -10307,7 +10308,7 @@ int main() {
|
||||||
extern char *strdup();
|
extern char *strdup();
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
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*
|
rm -rf conftest*
|
||||||
ol_cv_dcl_strdup=yes
|
ol_cv_dcl_strdup=yes
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1701,6 +1701,7 @@ AC_CHECK_FUNCS( \
|
||||||
strspn \
|
strspn \
|
||||||
sysconf \
|
sysconf \
|
||||||
waitpid \
|
waitpid \
|
||||||
|
wait4 \
|
||||||
)
|
)
|
||||||
|
|
||||||
dnl We actually may need to replace more than this.
|
dnl We actually may need to replace more than this.
|
||||||
|
|
|
||||||
|
|
@ -339,6 +339,9 @@
|
||||||
/* Define if you have the vsprintf function. */
|
/* Define if you have the vsprintf function. */
|
||||||
#undef HAVE_VSPRINTF
|
#undef HAVE_VSPRINTF
|
||||||
|
|
||||||
|
/* Define if you have the wait4 function. */
|
||||||
|
#undef HAVE_WAIT4
|
||||||
|
|
||||||
/* Define if you have the waitpid function. */
|
/* Define if you have the waitpid function. */
|
||||||
#undef HAVE_WAITPID
|
#undef HAVE_WAITPID
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,16 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <ac/string.h>
|
|
||||||
#include <ac/ctype.h>
|
#include <ac/ctype.h>
|
||||||
|
#include <ac/dirent.h>
|
||||||
#include <ac/socket.h>
|
#include <ac/socket.h>
|
||||||
|
#include <ac/string.h>
|
||||||
#include <ac/unistd.h>
|
#include <ac/unistd.h>
|
||||||
#include <ac/wait.h>
|
#include <ac/wait.h>
|
||||||
#include <dirent.h>
|
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_PARAM_H
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "ldapconfig.h"
|
#include "ldapconfig.h"
|
||||||
|
|
||||||
|
|
@ -305,7 +307,7 @@ get_read_entries( char *filename, char *entries[] )
|
||||||
static void
|
static void
|
||||||
fork_child( char *prog, char *args[] )
|
fork_child( char *prog, char *args[] )
|
||||||
{
|
{
|
||||||
int pid;
|
pid_t pid;
|
||||||
|
|
||||||
wait4kids( maxkids );
|
wait4kids( maxkids );
|
||||||
|
|
||||||
|
|
@ -332,25 +334,33 @@ static void
|
||||||
wait4kids( int nkidval )
|
wait4kids( int nkidval )
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
unsigned char *p;
|
|
||||||
|
|
||||||
while ( nkids >= nkidval ) {
|
while ( nkids >= nkidval ) {
|
||||||
wait( &status );
|
wait( &status );
|
||||||
p = (unsigned char *) &status;
|
|
||||||
if ( p[sizeof(int) - 1] == 0177 ) {
|
if ( WIFSTOPPED(status) ) {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"stopping: child stopped with signal %d\n",
|
"stopping: child stopped with signal %d\n",
|
||||||
p[sizeof(int) - 2] );
|
(int) WSTOPSIG(status) );
|
||||||
} else if ( p[sizeof(int) - 1] != 0 ) {
|
|
||||||
|
} else if ( WIFSIGNALED(status) ) {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"stopping: child terminated with signal %d\n",
|
"stopping: child terminated with signal %d%s\n",
|
||||||
p[sizeof(int) - 1] );
|
(int) WTERMSIG(status),
|
||||||
exit( p[sizeof(int) - 1] );
|
#ifdef WCOREDUMP
|
||||||
} else if ( p[sizeof(int) - 2] != 0 ) {
|
WCOREDUMP(status) ? ", core dumped" : ""
|
||||||
|
#else
|
||||||
|
""
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
exit( WEXITSTATUS(status) );
|
||||||
|
|
||||||
|
} else if ( WEXITSTATUS(status) != 0 ) {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"stopping: child exited with status %d\n",
|
"stopping: child exited with status %d\n",
|
||||||
p[sizeof(int) - 2] );
|
(int) WEXITSTATUS(status) );
|
||||||
exit( p[sizeof(int) - 2] );
|
exit( WEXITSTATUS(status) );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
nkids--;
|
nkids--;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue