]> Savannah Git Hosting - gnulib.git/commitdiff
sys_types: Fix definition of pid_t on 64-bit MSVC.
authorBruno Haible <bruno@clisp.org>
Sun, 23 Aug 2020 23:19:18 +0000 (01:19 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 23 Aug 2020 23:19:18 +0000 (01:19 +0200)
* m4/pid_t.m4: New file.
* modules/sys_types (Files): Add it.
* modules/dirent (Files): Likewise.
* modules/fcntl-h (Files): Likewise.
* modules/sched (Files): Likewise.
* modules/signal-h (Files): Likewise.
* modules/spawn (Files): Likewise.
* modules/sys_stat (Files): Likewise.
* modules/sys_wait (Files): Likewise.
* modules/termios (Files): Likewise.
* modules/unistd (Files): Likewise.

12 files changed:
ChangeLog
m4/pid_t.m4 [new file with mode: 0644]
modules/dirent
modules/fcntl-h
modules/sched
modules/signal-h
modules/spawn
modules/sys_stat
modules/sys_types
modules/sys_wait
modules/termios
modules/unistd

index e54c89f982782430be0faa41fcb9a5b08316444e..9c2dcdca25a3b51e38ccf8299b23f6932dbe49d6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2020-08-23  Bruno Haible  <bruno@clisp.org>
+
+       sys_types: Fix definition of pid_t on 64-bit MSVC.
+       * m4/pid_t.m4: New file.
+       * modules/sys_types (Files): Add it.
+       * modules/dirent (Files): Likewise.
+       * modules/fcntl-h (Files): Likewise.
+       * modules/sched (Files): Likewise.
+       * modules/signal-h (Files): Likewise.
+       * modules/spawn (Files): Likewise.
+       * modules/sys_stat (Files): Likewise.
+       * modules/sys_wait (Files): Likewise.
+       * modules/termios (Files): Likewise.
+       * modules/unistd (Files): Likewise.
+
 2020-08-23  Bruno Haible  <bruno@clisp.org>
 
        inttypes: Fix {PRI,SCN}*PTR on 32-bit native Windows (regr. 2020-07-21).
diff --git a/m4/pid_t.m4 b/m4/pid_t.m4
new file mode 100644 (file)
index 0000000..321082d
--- /dev/null
@@ -0,0 +1,33 @@
+# pid_t.m4 serial 1
+dnl Copyright (C) 2020 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.
+
+dnl Define pid_t if the headers don't define it.
+AC_DEFUN([AC_TYPE_PID_T],
+[
+  AC_CHECK_TYPE([pid_t],
+    [],
+    [dnl On 64-bit native Windows, define it to the equivalent of 'intptr_t'
+     dnl (= 'long long' = '__int64'), because that is the return type
+     dnl of the _spawnv* functions
+     dnl <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/spawnvp-wspawnvp>
+     dnl and the argument type of the _cwait function
+     dnl <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/cwait>.
+     dnl Otherwise (on 32-bit Windows and on old Unix platforms), define it
+     dnl to 'int'.
+     AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[
+          #if defined _WIN64 && !defined __CYGWIN__
+          LLP64
+          #endif
+          ]])
+       ],
+       [gl_pid_type='int'],
+       [gl_pid_type='__int64'])
+     AC_DEFINE_UNQUOTED([pid_t], [$gl_pid_type],
+       [Define as a signed integer type capable of holding a process identifier.])
+    ],
+    [AC_INCLUDES_DEFAULT])
+])
index 6f615b496a22c936a2599a179784550d4d89be00..08a6326cf1a344f6143208a33ba4211f31035955 100644 (file)
@@ -5,6 +5,7 @@ Files:
 lib/dirent.in.h
 m4/dirent_h.m4
 m4/unistd_h.m4
+m4/pid_t.m4
 
 Depends-on:
 include_next
index ff74dec09a1e7535cafc13f39b7069b9aad4c192..2ef0106f92ad05b49a6673bfa6b3b89f4f92c935 100644 (file)
@@ -5,6 +5,7 @@ Files:
 lib/fcntl.in.h
 m4/fcntl_h.m4
 m4/fcntl-o.m4
+m4/pid_t.m4
 
 Depends-on:
 extensions
index 0b6bcae56911d8d070dbbdc0ec602528eae1c736..572c57b0c01007bacc5d92b8ea827a6273cd36dc 100644 (file)
@@ -4,6 +4,7 @@ A <sched.h> include file.
 Files:
 lib/sched.in.h
 m4/sched_h.m4
+m4/pid_t.m4
 
 Depends-on:
 include_next
index 810e2bf6da745bf33a0fa0a9202bf21713aa76e9..2f38e9bf7ddec61597e2827a53a0329c5c21f329 100644 (file)
@@ -4,6 +4,7 @@ A GNU-like <signal.h>.
 Files:
 lib/signal.in.h
 m4/signal_h.m4
+m4/pid_t.m4
 
 Depends-on:
 include_next
index 6e032943d12bff1827f09a5c70c37923b325508a..f1b99cab6fcb3de0c17dc01b55e07d112a4edae5 100644 (file)
@@ -4,6 +4,7 @@ A POSIX compliant <spawn.h>.
 Files:
 lib/spawn.in.h
 m4/spawn_h.m4
+m4/pid_t.m4
 
 Depends-on:
 include_next
index af276abb856f9e7bf7c619175ef4703a093b6fdb..42ae93275d410745c384ef4663ae904804668bcf 100644 (file)
@@ -5,6 +5,7 @@ Files:
 lib/sys_stat.in.h
 m4/sys_stat_h.m4
 m4/unistd_h.m4
+m4/pid_t.m4
 
 Depends-on:
 include_next
index 81a11aa4f36b138df403f3d9ddac4f35677eeaa0..c00862c9b1d97b7b769500c25edc23c94c7bf10e 100644 (file)
@@ -5,6 +5,7 @@ Files:
 lib/sys_types.in.h
 m4/sys_types_h.m4
 m4/off_t.m4
+m4/pid_t.m4
 
 Depends-on:
 include_next
index bedd7e1c19722f290a7c2ea4b6ee468feec23b24..73ce50b6e73c6d578cf05003eecce4ec20c2a12b 100644 (file)
@@ -4,6 +4,7 @@ A <sys/wait.h> for systems with missing declarations.
 Files:
 lib/sys_wait.in.h
 m4/sys_wait_h.m4
+m4/pid_t.m4
 
 Depends-on:
 include_next
index 88056cc984e72bf29cdb516616f6e00d642969d7..8cb73e417434e6e428cd4cf3fb765bd1e046e566 100644 (file)
@@ -4,6 +4,7 @@ A <termios.h> that works around platform issues.
 Files:
 lib/termios.in.h
 m4/termios_h.m4
+m4/pid_t.m4
 
 Depends-on:
 include_next
index b14faaaf6465218ce919d3be1252fa74e25cc449..18b91c48c668eaed8007a483481eaa6bd9affd85 100644 (file)
@@ -6,6 +6,7 @@ m4/unistd_h.m4
 lib/unistd.c
 lib/unistd.in.h
 m4/off_t.m4
+m4/pid_t.m4
 
 Depends-on:
 extern-inline