summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-08-24 01:19:18 +0200
committerBruno Haible <bruno@clisp.org>2020-08-24 01:19:18 +0200
commitefe32f6a916b6addcfe60d2283cef4cebc6177ff (patch)
treebe3f4c25e6adff23e90415b9adbb659a5f302e97
parent064f12e7dcd83eebd7c9a7bbba15324a27bc87e7 (diff)
downloadgnulib-efe32f6a916b6addcfe60d2283cef4cebc6177ff.tar.gz
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.
-rw-r--r--ChangeLog15
-rw-r--r--m4/pid_t.m433
-rw-r--r--modules/dirent1
-rw-r--r--modules/fcntl-h1
-rw-r--r--modules/sched1
-rw-r--r--modules/signal-h1
-rw-r--r--modules/spawn1
-rw-r--r--modules/sys_stat1
-rw-r--r--modules/sys_types1
-rw-r--r--modules/sys_wait1
-rw-r--r--modules/termios1
-rw-r--r--modules/unistd1
12 files changed, 58 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index e54c89f982..9c2dcdca25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
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).
* m4/inttypes.m4 (gl_INTTYPES_PRI_SCN): Fix syntax error in test
program.
diff --git a/m4/pid_t.m4 b/m4/pid_t.m4
new file mode 100644
index 0000000000..321082d006
--- /dev/null
+++ b/m4/pid_t.m4
@@ -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])
+])
diff --git a/modules/dirent b/modules/dirent
index 6f615b496a..08a6326cf1 100644
--- a/modules/dirent
+++ b/modules/dirent
@@ -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
diff --git a/modules/fcntl-h b/modules/fcntl-h
index ff74dec09a..2ef0106f92 100644
--- a/modules/fcntl-h
+++ b/modules/fcntl-h
@@ -5,6 +5,7 @@ Files:
lib/fcntl.in.h
m4/fcntl_h.m4
m4/fcntl-o.m4
+m4/pid_t.m4
Depends-on:
extensions
diff --git a/modules/sched b/modules/sched
index 0b6bcae569..572c57b0c0 100644
--- a/modules/sched
+++ b/modules/sched
@@ -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
diff --git a/modules/signal-h b/modules/signal-h
index 810e2bf6da..2f38e9bf7d 100644
--- a/modules/signal-h
+++ b/modules/signal-h
@@ -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
diff --git a/modules/spawn b/modules/spawn
index 6e032943d1..f1b99cab6f 100644
--- a/modules/spawn
+++ b/modules/spawn
@@ -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
diff --git a/modules/sys_stat b/modules/sys_stat
index af276abb85..42ae93275d 100644
--- a/modules/sys_stat
+++ b/modules/sys_stat
@@ -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
diff --git a/modules/sys_types b/modules/sys_types
index 81a11aa4f3..c00862c9b1 100644
--- a/modules/sys_types
+++ b/modules/sys_types
@@ -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
diff --git a/modules/sys_wait b/modules/sys_wait
index bedd7e1c19..73ce50b6e7 100644
--- a/modules/sys_wait
+++ b/modules/sys_wait
@@ -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
diff --git a/modules/termios b/modules/termios
index 88056cc984..8cb73e4174 100644
--- a/modules/termios
+++ b/modules/termios
@@ -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
diff --git a/modules/unistd b/modules/unistd
index b14faaaf64..18b91c48c6 100644
--- a/modules/unistd
+++ b/modules/unistd
@@ -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