From: Mike Frysinger Date: Sat, 29 May 2021 18:14:59 +0000 (-0400) Subject: gnulib: import sys_wait X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e994f4ef451c83cd6c851c015433daa23566e2d9;p=binutils-gdb.git gnulib: import sys_wait A few sims use this to emulate process syscalls. Gdb builds seem to still be fine. --- diff --git a/gnulib/Makefile.in b/gnulib/Makefile.in index e1b9b34a794..af264c3c12d 100644 --- a/gnulib/Makefile.in +++ b/gnulib/Makefile.in @@ -265,6 +265,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/sys_time_h.m4 \ $(top_srcdir)/import/m4/sys_types_h.m4 \ $(top_srcdir)/import/m4/sys_uio_h.m4 \ + $(top_srcdir)/import/m4/sys_wait_h.m4 \ $(top_srcdir)/import/m4/tempname.m4 \ $(top_srcdir)/import/m4/threadlib.m4 \ $(top_srcdir)/import/m4/time_h.m4 \ @@ -813,6 +814,7 @@ GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ GNULIB_VSCANF = @GNULIB_VSCANF@ GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ +GNULIB_WAITPID = @GNULIB_WAITPID@ GNULIB_WCPCPY = @GNULIB_WCPCPY@ GNULIB_WCPNCPY = @GNULIB_WCPNCPY@ GNULIB_WCRTOMB = @GNULIB_WCRTOMB@ @@ -1307,6 +1309,7 @@ NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H@ +NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ @@ -1338,6 +1341,7 @@ NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ NEXT_SYS_TYPES_H = @NEXT_SYS_TYPES_H@ NEXT_SYS_UIO_H = @NEXT_SYS_UIO_H@ +NEXT_SYS_WAIT_H = @NEXT_SYS_WAIT_H@ NEXT_TIME_H = @NEXT_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NEXT_WCHAR_H = @NEXT_WCHAR_H@ diff --git a/gnulib/aclocal.m4 b/gnulib/aclocal.m4 index 83780b641ac..c03dc8bcafa 100644 --- a/gnulib/aclocal.m4 +++ b/gnulib/aclocal.m4 @@ -1338,6 +1338,7 @@ m4_include([import/m4/sys_stat_h.m4]) m4_include([import/m4/sys_time_h.m4]) m4_include([import/m4/sys_types_h.m4]) m4_include([import/m4/sys_uio_h.m4]) +m4_include([import/m4/sys_wait_h.m4]) m4_include([import/m4/tempname.m4]) m4_include([import/m4/threadlib.m4]) m4_include([import/m4/time_h.m4]) diff --git a/gnulib/config.in b/gnulib/config.in index a90ddd61182..db04597320e 100644 --- a/gnulib/config.in +++ b/gnulib/config.in @@ -901,6 +901,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_UIO_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_WAIT_H + /* Define to 1 if you have the `thrd_create' function. */ #undef HAVE_THRD_CREATE diff --git a/gnulib/configure b/gnulib/configure index 73a38082960..c212281bca5 100644 --- a/gnulib/configure +++ b/gnulib/configure @@ -732,6 +732,9 @@ GNULIB_NANOSLEEP GNULIB_LOCALTIME GNULIB_MKTIME GNULIB_CTIME +NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H +NEXT_SYS_WAIT_H +GNULIB_WAITPID HAVE_SYS_UIO_H NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H NEXT_SYS_UIO_H @@ -3802,6 +3805,7 @@ as_fn_append ac_func_list " snprintf" as_fn_append ac_header_list " strings.h" as_fn_append ac_header_list " sys/random.h" as_fn_append ac_header_list " sys/uio.h" +as_fn_append ac_header_list " sys/wait.h" as_fn_append ac_func_list " localtime_r" as_fn_append ac_header_list " crtdefs.h" as_fn_append ac_func_list " iswcntrl" @@ -6865,6 +6869,7 @@ fi # Code from module sys_time: # Code from module sys_types: # Code from module sys_uio: + # Code from module sys_wait: # Code from module tempname: # Code from module threadlib: @@ -17767,6 +17772,11 @@ $as_echo "$gl_cv_next_sys_types_h" >&6; } + GNULIB_WAITPID=0; + + + + GNULIB_CTIME=0; GNULIB_MKTIME=0; GNULIB_LOCALTIME=0; @@ -30722,6 +30732,95 @@ $as_echo "$gl_cv_next_sys_uio_h" >&6; } + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_sys_wait_h='<'sys/wait.h'>' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if ${gl_cv_next_sys_wait_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_sys_wait_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'sys/wait.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_sys_wait_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_sys_wait_h + gl_cv_next_sys_wait_h='"'$gl_header'"' + else + gl_cv_next_sys_wait_h='<'sys/wait.h'>' + fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_wait_h" >&5 +$as_echo "$gl_cv_next_sys_wait_h" >&6; } + fi + NEXT_SYS_WAIT_H=$gl_cv_next_sys_wait_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'sys/wait.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_sys_wait_h + fi + NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H=$gl_next_as_first_directive + + + + + + + + + + + + + + : diff --git a/gnulib/import/Makefile.am b/gnulib/import/Makefile.am index 1ae25ac2805..dafe63d4c8a 100644 --- a/gnulib/import/Makefile.am +++ b/gnulib/import/Makefile.am @@ -71,6 +71,7 @@ # strstr \ # strtok_r \ # sys_stat \ +# sys_wait \ # time_r \ # unistd \ # unsetenv \ @@ -2755,6 +2756,34 @@ EXTRA_DIST += sys_uio.in.h ## end gnulib module sys_uio +## begin gnulib module sys_wait + +BUILT_SOURCES += sys/wait.h + +# We need the following in order to create when the system +# has one that is incomplete. +sys/wait.h: sys_wait.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) + $(AM_V_at)$(MKDIR_P) sys + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_SYS_WAIT_H''@|$(NEXT_SYS_WAIT_H)|g' \ + -e 's/@''GNULIB_WAITPID''@/$(GNULIB_WAITPID)/g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/sys_wait.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += sys/wait.h sys/wait.h-t +MOSTLYCLEANDIRS += sys + +EXTRA_DIST += sys_wait.in.h + +## end gnulib module sys_wait + ## begin gnulib module tempname libgnu_a_SOURCES += tempname.c diff --git a/gnulib/import/Makefile.in b/gnulib/import/Makefile.in index e9b52a7d4fc..aae97115409 100644 --- a/gnulib/import/Makefile.in +++ b/gnulib/import/Makefile.in @@ -85,6 +85,7 @@ # strstr \ # strtok_r \ # sys_stat \ +# sys_wait \ # time_r \ # unistd \ # unsetenv \ @@ -329,6 +330,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/sys_time_h.m4 \ $(top_srcdir)/import/m4/sys_types_h.m4 \ $(top_srcdir)/import/m4/sys_uio_h.m4 \ + $(top_srcdir)/import/m4/sys_wait_h.m4 \ $(top_srcdir)/import/m4/tempname.m4 \ $(top_srcdir)/import/m4/threadlib.m4 \ $(top_srcdir)/import/m4/time_h.m4 \ @@ -915,6 +917,7 @@ GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ GNULIB_VSCANF = @GNULIB_VSCANF@ GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ +GNULIB_WAITPID = @GNULIB_WAITPID@ GNULIB_WCPCPY = @GNULIB_WCPCPY@ GNULIB_WCPNCPY = @GNULIB_WCPNCPY@ GNULIB_WCRTOMB = @GNULIB_WCRTOMB@ @@ -1409,6 +1412,7 @@ NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H@ +NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ @@ -1440,6 +1444,7 @@ NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ NEXT_SYS_TYPES_H = @NEXT_SYS_TYPES_H@ NEXT_SYS_UIO_H = @NEXT_SYS_UIO_H@ +NEXT_SYS_WAIT_H = @NEXT_SYS_WAIT_H@ NEXT_TIME_H = @NEXT_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NEXT_WCHAR_H = @NEXT_WCHAR_H@ @@ -1856,8 +1861,8 @@ EXTRA_DIST = m4/gnulib-cache.m4 alloca.c alloca.in.h arpa_inet.in.h \ string.in.h strings.in.h strnlen.c strstr.c str-two-way.h \ strstr.c strtok_r.c sys_random.in.h sys_select.in.h \ sys_socket.in.h sys_stat.in.h sys_time.in.h sys_types.in.h \ - sys_uio.in.h tempname.h time.in.h time_r.c unistd.in.h \ - unistd--.h unistd-safer.h unsetenv.c \ + sys_uio.in.h sys_wait.in.h tempname.h time.in.h time_r.c \ + unistd.in.h unistd--.h unistd-safer.h unsetenv.c \ $(top_srcdir)/import/extra/update-copyright verify.h \ wchar.in.h wctype.in.h windows-initguard.h windows-mutex.c \ windows-mutex.h windows-once.c windows-once.h \ @@ -1870,7 +1875,7 @@ BUILT_SOURCES = $(ALLOCA_H) arpa/inet.h ctype.h dirent.h $(ERRNO_H) \ $(STDALIGN_H) $(STDBOOL_H) $(STDDEF_H) $(STDINT_H) stdio.h \ stdlib.h string.h strings.h sys/random.h sys/select.h \ sys/socket.h sys/stat.h sys/time.h sys/types.h sys/uio.h \ - time.h unistd.h wchar.h wctype.h + sys/wait.h time.h unistd.h wchar.h wctype.h SUFFIXES = MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t arpa/inet.h \ arpa/inet.h-t ctype.h ctype.h-t dirent.h dirent.h-t errno.h \ @@ -1884,9 +1889,9 @@ MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t arpa/inet.h \ sys/random.h sys/random.h-t sys/select.h sys/select.h-t \ sys/socket.h sys/socket.h-t sys/stat.h sys/stat.h-t sys/time.h \ sys/time.h-t sys/types.h sys/types.h-t sys/uio.h sys/uio.h-t \ - time.h time.h-t unistd.h unistd.h-t wchar.h wchar.h-t wctype.h \ - wctype.h-t -MOSTLYCLEANDIRS = arpa netinet sys sys sys sys sys + sys/wait.h sys/wait.h-t time.h time.h-t unistd.h unistd.h-t \ + wchar.h wchar.h-t wctype.h wctype.h-t +MOSTLYCLEANDIRS = arpa netinet sys sys sys sys sys sys CLEANFILES = DISTCLEANFILES = MAINTAINERCLEANFILES = @@ -3744,6 +3749,24 @@ sys/uio.h: sys_uio.in.h $(top_builddir)/config.status } > $@-t && \ mv -f $@-t $@ +# We need the following in order to create when the system +# has one that is incomplete. +sys/wait.h: sys_wait.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) + $(AM_V_at)$(MKDIR_P) sys + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_SYS_WAIT_H''@|$(NEXT_SYS_WAIT_H)|g' \ + -e 's/@''GNULIB_WAITPID''@/$(GNULIB_WAITPID)/g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/sys_wait.in.h; \ + } > $@-t && \ + mv $@-t $@ + # We need the following in order to create when the system # doesn't have one that works with the given compiler. time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) diff --git a/gnulib/import/m4/gnulib-cache.m4 b/gnulib/import/m4/gnulib-cache.m4 index 689ebd3e5ba..53968404dca 100644 --- a/gnulib/import/m4/gnulib-cache.m4 +++ b/gnulib/import/m4/gnulib-cache.m4 @@ -76,6 +76,7 @@ # strstr \ # strtok_r \ # sys_stat \ +# sys_wait \ # time_r \ # unistd \ # unsetenv \ @@ -124,6 +125,7 @@ gl_MODULES([ strstr strtok_r sys_stat + sys_wait time_r unistd unsetenv diff --git a/gnulib/import/m4/gnulib-comp.m4 b/gnulib/import/m4/gnulib-comp.m4 index 03eff90b6b2..54ae5bbbcf2 100644 --- a/gnulib/import/m4/gnulib-comp.m4 +++ b/gnulib/import/m4/gnulib-comp.m4 @@ -213,6 +213,7 @@ AC_DEFUN([gl_EARLY], # Code from module sys_time: # Code from module sys_types: # Code from module sys_uio: + # Code from module sys_wait: # Code from module tempname: # Code from module threadlib: gl_THREADLIB_EARLY @@ -777,6 +778,8 @@ AC_DEFUN([gl_INIT], AC_PROG_MKDIR_P gl_HEADER_SYS_UIO AC_PROG_MKDIR_P + gl_SYS_WAIT_H + AC_PROG_MKDIR_P gl_FUNC_GEN_TEMPNAME gl_MODULE_INDICATOR([tempname]) AC_REQUIRE([gl_THREADLIB]) @@ -1184,6 +1187,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/sys_time.in.h lib/sys_types.in.h lib/sys_uio.in.h + lib/sys_wait.in.h lib/tempname.c lib/tempname.h lib/time.in.h @@ -1365,6 +1369,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/sys_time_h.m4 m4/sys_types_h.m4 m4/sys_uio_h.m4 + m4/sys_wait_h.m4 m4/tempname.m4 m4/threadlib.m4 m4/time_h.m4 diff --git a/gnulib/import/m4/sys_wait_h.m4 b/gnulib/import/m4/sys_wait_h.m4 new file mode 100644 index 00000000000..96e9ba2b124 --- /dev/null +++ b/gnulib/import/m4/sys_wait_h.m4 @@ -0,0 +1,36 @@ +# sys_wait_h.m4 serial 6 +dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_SYS_WAIT_H], +[ + AC_REQUIRE([gl_SYS_WAIT_H_DEFAULTS]) + + dnl is always overridden, because of GNULIB_POSIXCHECK. + gl_CHECK_NEXT_HEADERS([sys/wait.h]) + + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include ]], + [waitpid]) +]) + +AC_DEFUN([gl_SYS_WAIT_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_SYS_WAIT_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_SYS_WAIT_H_DEFAULTS], +[ + GNULIB_WAITPID=0; AC_SUBST([GNULIB_WAITPID]) + dnl Assume proper GNU behavior unless another module says otherwise. +]) diff --git a/gnulib/import/sys_wait.in.h b/gnulib/import/sys_wait.in.h new file mode 100644 index 00000000000..25d25a0ae1b --- /dev/null +++ b/gnulib/import/sys_wait.in.h @@ -0,0 +1,131 @@ +/* A POSIX-like . + Copyright (C) 2001-2003, 2005-2021 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . */ + + +#ifndef _@GUARD_PREFIX@_SYS_WAIT_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* The include_next requires a split double-inclusion guard. */ +#if !(defined _WIN32 && ! defined __CYGWIN__) +# @INCLUDE_NEXT@ @NEXT_SYS_WAIT_H@ +#endif + +#ifndef _@GUARD_PREFIX@_SYS_WAIT_H +#define _@GUARD_PREFIX@_SYS_WAIT_H + +/* Get pid_t. */ +#include + + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + +#if !(defined _WIN32 && ! defined __CYGWIN__) +/* Unix API. */ + +/* The following macros apply to an argument x, that is a status of a process, + as returned by waitpid(). + On nearly all systems, including Linux/x86, WEXITSTATUS are bits 15..8 and + WTERMSIG are bits 7..0, while BeOS uses the opposite. Therefore programs + have to use the abstract macros. */ + +/* For valid x, exactly one of WIFSIGNALED(x), WIFEXITED(x), WIFSTOPPED(x) + is true. */ +# ifndef WIFSIGNALED +# define WIFSIGNALED(x) (WTERMSIG (x) != 0 && WTERMSIG(x) != 0x7f) +# endif +# ifndef WIFEXITED +# define WIFEXITED(x) (WTERMSIG (x) == 0) +# endif +# ifndef WIFSTOPPED +# define WIFSTOPPED(x) (WTERMSIG (x) == 0x7f) +# endif + +/* The termination signal. Only to be accessed if WIFSIGNALED(x) is true. */ +# ifndef WTERMSIG +# define WTERMSIG(x) ((x) & 0x7f) +# endif + +/* The exit status. Only to be accessed if WIFEXITED(x) is true. */ +# ifndef WEXITSTATUS +# define WEXITSTATUS(x) (((x) >> 8) & 0xff) +# endif + +/* The stopping signal. Only to be accessed if WIFSTOPPED(x) is true. */ +# ifndef WSTOPSIG +# define WSTOPSIG(x) (((x) >> 8) & 0x7f) +# endif + +/* True if the process dumped core. Not standardized by POSIX. */ +# ifndef WCOREDUMP +# define WCOREDUMP(x) ((x) & 0x80) +# endif + +#else +/* Native Windows API. */ + +# include /* for SIGTERM */ + +/* The following macros apply to an argument x, that is a status of a process, + as returned by waitpid() or, equivalently, _cwait() or GetExitCodeProcess(). + This value is simply an 'int', not composed of bit fields. */ + +/* When an unhandled fatal signal terminates a process, the exit code is 3. */ +# define WIFSIGNALED(x) ((x) == 3) +# define WIFEXITED(x) ((x) != 3) +# define WIFSTOPPED(x) 0 + +/* The signal that terminated a process is not known posthum. */ +# define WTERMSIG(x) SIGTERM + +# define WEXITSTATUS(x) (x) + +/* There are no stopping signals. */ +# define WSTOPSIG(x) 0 + +/* There are no core dumps. */ +# define WCOREDUMP(x) 0 + +#endif + + +/* Declarations of functions. */ + +#if @GNULIB_WAITPID@ +# if defined _WIN32 && ! defined __CYGWIN__ +_GL_FUNCDECL_SYS (waitpid, pid_t, (pid_t pid, int *statusp, int options)); +# endif +/* Need to cast, because on Cygwin, the second parameter is + __wait_status_ptr_t statusp. */ +_GL_CXXALIAS_SYS_CAST (waitpid, pid_t, (pid_t pid, int *statusp, int options)); +_GL_CXXALIASWARN (waitpid); +#elif defined GNULIB_POSIXCHECK +# undef waitpid +# if HAVE_RAW_DECL_WAITPID +_GL_WARN_ON_USE (waitpid, "waitpid is unportable - " + "use gnulib module sys_wait for portability"); +# endif +#endif + + +#endif /* _@GUARD_PREFIX@_SYS_WAIT_H */ +#endif /* _@GUARD_PREFIX@_SYS_WAIT_H */ diff --git a/gnulib/update-gnulib.sh b/gnulib/update-gnulib.sh index 08c43fcfc14..e5c6fd90dd7 100755 --- a/gnulib/update-gnulib.sh +++ b/gnulib/update-gnulib.sh @@ -68,6 +68,7 @@ IMPORTED_GNULIB_MODULES="\ strstr \ strtok_r \ sys_stat \ + sys_wait \ time_r \ unistd \ unsetenv \