aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--winsup/cygserver/client.cc1
-rw-r--r--winsup/cygserver/cygserver.cc1
-rw-r--r--winsup/cygserver/process.cc1
-rw-r--r--winsup/cygserver/transport_pipes.cc1
-rw-r--r--winsup/cygwin/ChangeLog24
-rw-r--r--winsup/cygwin/cygerrno.h8
-rw-r--r--winsup/cygwin/cygheap.cc1
-rwxr-xr-xwinsup/cygwin/cygserver.cc1
-rwxr-xr-xwinsup/cygwin/cygserver_client.cc1
-rwxr-xr-xwinsup/cygwin/cygserver_process.cc1
-rwxr-xr-xwinsup/cygwin/cygserver_transport_pipes.cc1
-rw-r--r--winsup/cygwin/cygthread.cc1
-rw-r--r--winsup/cygwin/cygwin.din1
-rw-r--r--winsup/cygwin/dcrt0.cc1
-rw-r--r--winsup/cygwin/debug.cc3
-rw-r--r--winsup/cygwin/dir.cc1
-rw-r--r--winsup/cygwin/dll_init.cc1
-rw-r--r--winsup/cygwin/dtable.cc1
-rw-r--r--winsup/cygwin/environ.cc1
-rw-r--r--winsup/cygwin/errno.cc2
-rw-r--r--winsup/cygwin/exceptions.cc1
-rw-r--r--winsup/cygwin/exec.cc1
-rw-r--r--winsup/cygwin/external.cc1
-rw-r--r--winsup/cygwin/fcntl.cc1
-rw-r--r--winsup/cygwin/fhandler.cc1
-rw-r--r--winsup/cygwin/fhandler_clipboard.cc1
-rw-r--r--winsup/cygwin/fhandler_console.cc1
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc1
-rw-r--r--winsup/cygwin/fhandler_dsp.cc1
-rw-r--r--winsup/cygwin/fhandler_floppy.cc1
-rw-r--r--winsup/cygwin/fhandler_mem.cc1
-rw-r--r--winsup/cygwin/fhandler_proc.cc1
-rw-r--r--winsup/cygwin/fhandler_process.cc1
-rw-r--r--winsup/cygwin/fhandler_random.cc1
-rw-r--r--winsup/cygwin/fhandler_raw.cc1
-rw-r--r--winsup/cygwin/fhandler_registry.cc1
-rw-r--r--winsup/cygwin/fhandler_serial.cc1
-rw-r--r--winsup/cygwin/fhandler_socket.cc1
-rw-r--r--winsup/cygwin/fhandler_tape.cc1
-rw-r--r--winsup/cygwin/fhandler_termios.cc1
-rw-r--r--winsup/cygwin/fhandler_tty.cc1
-rw-r--r--winsup/cygwin/fhandler_virtual.cc1
-rw-r--r--winsup/cygwin/fhandler_windows.cc1
-rw-r--r--winsup/cygwin/fork.cc1
-rw-r--r--winsup/cygwin/grp.cc1
-rw-r--r--winsup/cygwin/heap.cc1
-rw-r--r--winsup/cygwin/include/cygwin/config.h1
-rw-r--r--winsup/cygwin/include/cygwin/version.h3
-rw-r--r--winsup/cygwin/ioctl.cc1
-rw-r--r--winsup/cygwin/malloc_wrapper.cc1
-rw-r--r--winsup/cygwin/mmap.cc1
-rw-r--r--winsup/cygwin/msg.cc1
-rw-r--r--winsup/cygwin/net.cc1
-rw-r--r--winsup/cygwin/passwd.cc1
-rw-r--r--winsup/cygwin/path.cc1
-rw-r--r--winsup/cygwin/pinfo.cc1
-rw-r--r--winsup/cygwin/pipe.cc1
-rw-r--r--winsup/cygwin/poll.cc1
-rw-r--r--winsup/cygwin/resource.cc1
-rw-r--r--winsup/cygwin/scandir.cc1
-rw-r--r--winsup/cygwin/sched.cc1
-rw-r--r--winsup/cygwin/sec_acl.cc1
-rw-r--r--winsup/cygwin/sec_helper.cc1
-rw-r--r--winsup/cygwin/security.cc1
-rw-r--r--winsup/cygwin/select.cc1
-rw-r--r--winsup/cygwin/sem.cc1
-rw-r--r--winsup/cygwin/shared.cc1
-rw-r--r--winsup/cygwin/shm.cc1
-rw-r--r--winsup/cygwin/signal.cc5
-rw-r--r--winsup/cygwin/sigproc.cc1
-rw-r--r--winsup/cygwin/spawn.cc1
-rw-r--r--winsup/cygwin/strace.cc1
-rw-r--r--winsup/cygwin/syscalls.cc1
-rw-r--r--winsup/cygwin/sysconf.cc1
-rw-r--r--winsup/cygwin/syslog.cc1
-rw-r--r--winsup/cygwin/termios.cc1
-rw-r--r--winsup/cygwin/thread.cc35
-rw-r--r--winsup/cygwin/thread.h1
-rw-r--r--winsup/cygwin/times.cc1
-rw-r--r--winsup/cygwin/tty.cc1
-rw-r--r--winsup/cygwin/uinfo.cc1
-rw-r--r--winsup/cygwin/wait.cc1
-rw-r--r--winsup/cygwin/window.cc1
83 files changed, 65 insertions, 91 deletions
diff --git a/winsup/cygserver/client.cc b/winsup/cygserver/client.cc
index 138c9dd..f668318 100644
--- a/winsup/cygserver/client.cc
+++ b/winsup/cygserver/client.cc
@@ -18,7 +18,6 @@ details. */
#endif
#include <assert.h>
-#include <errno.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/winsup/cygserver/cygserver.cc b/winsup/cygserver/cygserver.cc
index 0c07403..137730f 100644
--- a/winsup/cygserver/cygserver.cc
+++ b/winsup/cygserver/cygserver.cc
@@ -16,7 +16,6 @@ details. */
#include <assert.h>
#include <ctype.h>
-#include <errno.h>
#include <getopt.h>
#include <signal.h>
#include <stdio.h>
diff --git a/winsup/cygserver/process.cc b/winsup/cygserver/process.cc
index 7118bbc..2cc7be1 100644
--- a/winsup/cygserver/process.cc
+++ b/winsup/cygserver/process.cc
@@ -15,7 +15,6 @@ details. */
#include <sys/types.h>
#include <assert.h>
-#include <errno.h>
#include <stdlib.h>
#include "cygerrno.h"
diff --git a/winsup/cygserver/transport_pipes.cc b/winsup/cygserver/transport_pipes.cc
index 495d804..6d80def 100644
--- a/winsup/cygserver/transport_pipes.cc
+++ b/winsup/cygserver/transport_pipes.cc
@@ -20,7 +20,6 @@ details. */
#include <sys/types.h>
#include <assert.h>
-#include <errno.h>
#include <netdb.h>
#include <pthread.h>
#include <unistd.h>
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 94c5b06..441da04 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,27 @@
+2003-06-15 Christopher Faylor <cgf@redhat.com>
+
+ Throughout, remove "include <errno.h>" from files which already include
+ cygerrno.h.
+
+2003-06-15 Thomas Pfaff <tpfaff@gmx.net>
+
+ * include/cygwin/config.h (__DYNAMIC_REENT__): Define.
+ * include/cygwin/version.h: Bump API minor version.
+ * cygwin.din: Export __getreent
+ * cygerrno.h: Include errno.h. Fix places where _impure_ptr is used
+ directly to store the errno value.
+ * debug.cc (__set_errno): Ditto.
+ * errno.cc: Remove _RRENT_ONLY define to get errno.cc compiled.
+ * signal.cc: Rename _reent_clib to _REENT throughout.
+ * thread.h (reent_clib): Remove prototype.
+ * thread.cc (reent_clib): Rename reent_clib to __getreent. Return
+ _impure_ptr until MTinterface is initialized.
+ (reent_winsup): Fix a possible SEGV when _r == NULL. Return NULL
+ instead.
+ * MTinterface::fixup_after_fork: Switch reent back to _impure_ptr to
+ keep signal handling running when fork is called from a thread other
+ than the mainthread.
+
2003-06-12 Thomas Pfaff <tpfaff@gmx.net>
* thread.cc (pthread_attr_init): Revert change from 2003-06-11
diff --git a/winsup/cygwin/cygerrno.h b/winsup/cygwin/cygerrno.h
index 0c1513f..fb00f3f 100644
--- a/winsup/cygwin/cygerrno.h
+++ b/winsup/cygwin/cygerrno.h
@@ -1,6 +1,6 @@
/* cygerrno.h: main Cygwin header file.
- Copyright 2000 Red Hat, Inc.
+ Copyright 2000, 2001, 2002, 2003 Red Hat, Inc.
This file is part of Cygwin.
@@ -8,6 +8,8 @@ This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
+#include <errno.h>
+
void __stdcall seterrno_from_win_error (const char *file, int line, DWORD code) __attribute__ ((regparm(3)));
void __stdcall seterrno (const char *, int line) __attribute__ ((regparm(2)));
int __stdcall geterrno_from_win_error (DWORD code, int deferrno) __attribute__ ((regparm(2)));
@@ -16,12 +18,12 @@ int __stdcall geterrno_from_win_error (DWORD code, int deferrno) __attribute__ (
#define __seterrno_from_win_error(val) seterrno_from_win_error (__FILE__, __LINE__, val)
#ifndef DEBUGGING
-#define set_errno(val) (_impure_ptr->_errno = (val))
+#define set_errno(val) (errno = (val))
#else
int __stdcall __set_errno (const char *ln, int ln, int val) __attribute ((regparm(3)));
#define set_errno(val) __set_errno (__PRETTY_FUNCTION__, __LINE__, (val))
#endif
-#define get_errno() (_impure_ptr->_errno)
+#define get_errno() (errno)
extern "C" void __stdcall set_sig_errno (int e);
class save_errno
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index 1b4096a..aa213cc 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -10,7 +10,6 @@
#include "winsup.h"
#include <string.h>
-#include <errno.h>
#include <assert.h>
#include <stdlib.h>
#include "security.h"
diff --git a/winsup/cygwin/cygserver.cc b/winsup/cygwin/cygserver.cc
index 0c07403..137730f 100755
--- a/winsup/cygwin/cygserver.cc
+++ b/winsup/cygwin/cygserver.cc
@@ -16,7 +16,6 @@ details. */
#include <assert.h>
#include <ctype.h>
-#include <errno.h>
#include <getopt.h>
#include <signal.h>
#include <stdio.h>
diff --git a/winsup/cygwin/cygserver_client.cc b/winsup/cygwin/cygserver_client.cc
index 138c9dd..f668318 100755
--- a/winsup/cygwin/cygserver_client.cc
+++ b/winsup/cygwin/cygserver_client.cc
@@ -18,7 +18,6 @@ details. */
#endif
#include <assert.h>
-#include <errno.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/winsup/cygwin/cygserver_process.cc b/winsup/cygwin/cygserver_process.cc
index 7118bbc..2cc7be1 100755
--- a/winsup/cygwin/cygserver_process.cc
+++ b/winsup/cygwin/cygserver_process.cc
@@ -15,7 +15,6 @@ details. */
#include <sys/types.h>
#include <assert.h>
-#include <errno.h>
#include <stdlib.h>
#include "cygerrno.h"
diff --git a/winsup/cygwin/cygserver_transport_pipes.cc b/winsup/cygwin/cygserver_transport_pipes.cc
index 495d804..6d80def 100755
--- a/winsup/cygwin/cygserver_transport_pipes.cc
+++ b/winsup/cygwin/cygserver_transport_pipes.cc
@@ -20,7 +20,6 @@ details. */
#include <sys/types.h>
#include <assert.h>
-#include <errno.h>
#include <netdb.h>
#include <pthread.h>
#include <unistd.h>
diff --git a/winsup/cygwin/cygthread.cc b/winsup/cygwin/cygthread.cc
index 2d45f29..c4c871c 100644
--- a/winsup/cygwin/cygthread.cc
+++ b/winsup/cygwin/cygthread.cc
@@ -9,7 +9,6 @@ details. */
#include "winsup.h"
#include <windows.h>
#include <stdlib.h>
-#include <errno.h>
#include "exceptions.h"
#include "security.h"
#include "cygthread.h"
diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din
index 4deddb8..336d469 100644
--- a/winsup/cygwin/cygwin.din
+++ b/winsup/cygwin/cygwin.din
@@ -26,6 +26,7 @@ __eprintf
__errno
__fpclassifyd
__fpclassifyf
+__getreent
__infinity
__main
__signbitd
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index a11b342..34141c5 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -17,7 +17,6 @@ details. */
#include <limits.h>
#include <wingdi.h>
#include <winuser.h>
-#include <errno.h>
#include "sigproc.h"
#include "pinfo.h"
#include "cygerrno.h"
diff --git a/winsup/cygwin/debug.cc b/winsup/cygwin/debug.cc
index 3513a67..9628784 100644
--- a/winsup/cygwin/debug.cc
+++ b/winsup/cygwin/debug.cc
@@ -15,7 +15,6 @@ details. */
#include "security.h"
#include "cygerrno.h"
#ifdef DEBUGGING
-#include <errno.h>
#include "fhandler.h"
#include "path.h"
#include "dtable.h"
@@ -222,6 +221,6 @@ int __stdcall
__set_errno (const char *func, int ln, int val)
{
debug_printf ("%s:%d val %d", func, ln, val);
- return _impure_ptr->_errno = val;
+ return errno = val;
}
#endif /*DEBUGGING*/
diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc
index 9c50bda..d5b8dc5 100644
--- a/winsup/cygwin/dir.cc
+++ b/winsup/cygwin/dir.cc
@@ -12,7 +12,6 @@ details. */
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
-#include <errno.h>
#define _COMPILING_NEWLIB
#include <dirent.h>
diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc
index 15d50b2..c5932f4 100644
--- a/winsup/cygwin/dll_init.cc
+++ b/winsup/cygwin/dll_init.cc
@@ -8,7 +8,6 @@ details. */
#include "winsup.h"
#include <stdlib.h>
-#include <errno.h>
#include "cygerrno.h"
#include "perprocess.h"
#include "dll_init.h"
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 3b114a7..315505b 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -11,7 +11,6 @@ details. */
#define __INSIDE_CYGWIN_NET__
#include "winsup.h"
-#include <errno.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <stdio.h>
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index e4bbabc..d476435 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -8,7 +8,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
-#include <errno.h>
#include <stdlib.h>
#include <stddef.h>
#include <ctype.h>
diff --git a/winsup/cygwin/errno.cc b/winsup/cygwin/errno.cc
index 53aae6d..127eff9 100644
--- a/winsup/cygwin/errno.cc
+++ b/winsup/cygwin/errno.cc
@@ -12,9 +12,7 @@ details. */
#define sys_nerr FOOsys_nerr
#define _sys_errlist FOO_sys_errlist
#include "winsup.h"
-#define _REENT_ONLY
#include <stdio.h>
-#include <errno.h>
#include "cygerrno.h"
#include "thread.h"
#undef _sys_nerr
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index a602041..3c8bf39 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -10,7 +10,6 @@ details. */
#include "winsup.h"
#include <imagehlp.h>
-#include <errno.h>
#include <stdlib.h>
#include "exceptions.h"
diff --git a/winsup/cygwin/exec.cc b/winsup/cygwin/exec.cc
index f0288dc..6c52533 100644
--- a/winsup/cygwin/exec.cc
+++ b/winsup/cygwin/exec.cc
@@ -12,7 +12,6 @@ details. */
#include "winsup.h"
#include <unistd.h>
#include <stdlib.h>
-#include <errno.h>
#include <process.h>
#include "perprocess.h"
#include "security.h"
diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc
index 3accc63..0bca0e5 100644
--- a/winsup/cygwin/external.cc
+++ b/winsup/cygwin/external.cc
@@ -11,7 +11,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
-#include <errno.h>
#include "security.h"
#include "fhandler.h"
#include "sigproc.h"
diff --git a/winsup/cygwin/fcntl.cc b/winsup/cygwin/fcntl.cc
index f67f43f..d7055f4 100644
--- a/winsup/cygwin/fcntl.cc
+++ b/winsup/cygwin/fcntl.cc
@@ -10,7 +10,6 @@ details. */
#include "winsup.h"
#include <stdarg.h>
-#include <errno.h>
#include <unistd.h>
#include "security.h"
#include "fhandler.h"
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 8142cfa..69fd48a 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -9,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
-#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/cygwin.h>
diff --git a/winsup/cygwin/fhandler_clipboard.cc b/winsup/cygwin/fhandler_clipboard.cc
index 616adf4..23d97d8 100644
--- a/winsup/cygwin/fhandler_clipboard.cc
+++ b/winsup/cygwin/fhandler_clipboard.cc
@@ -13,7 +13,6 @@ details. */
#include "winsup.h"
#include <stdio.h>
#include <stdlib.h>
-#include <errno.h>
#include <unistd.h>
#include <windows.h>
#include <wingdi.h>
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 26fa64d..0d70152 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -12,7 +12,6 @@ details. */
#include <sys/termios.h>
#include <stdio.h>
#include <stdlib.h>
-#include <errno.h>
#include <unistd.h>
#include <wingdi.h>
#include <winuser.h>
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index c9570b8..48778f4 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -9,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
-#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/cygwin.h>
diff --git a/winsup/cygwin/fhandler_dsp.cc b/winsup/cygwin/fhandler_dsp.cc
index 2ca44e3..cda7ebe 100644
--- a/winsup/cygwin/fhandler_dsp.cc
+++ b/winsup/cygwin/fhandler_dsp.cc
@@ -12,7 +12,6 @@ details. */
#include "winsup.h"
#include <stdio.h>
-#include <errno.h>
#include <windows.h>
#include <sys/soundcard.h>
#include <mmsystem.h>
diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc
index 83d41ea..be9798c 100644
--- a/winsup/cygwin/fhandler_floppy.cc
+++ b/winsup/cygwin/fhandler_floppy.cc
@@ -11,7 +11,6 @@ details. */
#include "winsup.h"
#include <sys/termios.h>
-#include <errno.h>
#include <unistd.h>
#include <winioctl.h>
#include <asm/socket.h>
diff --git a/winsup/cygwin/fhandler_mem.cc b/winsup/cygwin/fhandler_mem.cc
index ea6fb43..c57ff49 100644
--- a/winsup/cygwin/fhandler_mem.cc
+++ b/winsup/cygwin/fhandler_mem.cc
@@ -9,7 +9,6 @@
details. */
#include "winsup.h"
-#include <errno.h>
#include <unistd.h>
#include <sys/mman.h>
#include <ntdef.h>
diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc
index f9b866d..286a8a2 100644
--- a/winsup/cygwin/fhandler_proc.cc
+++ b/winsup/cygwin/fhandler_proc.cc
@@ -11,7 +11,6 @@ details. */
#define _WIN32_WINNT 0x0501
#include "winsup.h"
-#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/cygwin.h>
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index f8631b4..0d26d2c 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -9,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
-#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/cygwin.h>
diff --git a/winsup/cygwin/fhandler_random.cc b/winsup/cygwin/fhandler_random.cc
index 5069316..e7c694f 100644
--- a/winsup/cygwin/fhandler_random.cc
+++ b/winsup/cygwin/fhandler_random.cc
@@ -11,7 +11,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
-#include <errno.h>
#include <limits.h>
#include "cygerrno.h"
#include "security.h"
diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc
index 45ce414..ebd8ef0 100644
--- a/winsup/cygwin/fhandler_raw.cc
+++ b/winsup/cygwin/fhandler_raw.cc
@@ -10,7 +10,6 @@
#include "winsup.h"
#include <sys/termios.h>
-#include <errno.h>
#include <unistd.h>
#include <cygwin/rdevio.h>
diff --git a/winsup/cygwin/fhandler_registry.cc b/winsup/cygwin/fhandler_registry.cc
index 7f2cc5f..85ea02f 100644
--- a/winsup/cygwin/fhandler_registry.cc
+++ b/winsup/cygwin/fhandler_registry.cc
@@ -11,7 +11,6 @@ details. */
/* FIXME: Access permissions are ignored at the moment. */
#include "winsup.h"
-#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/cygwin.h>
diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc
index 3c99b4a..3bc92ed 100644
--- a/winsup/cygwin/fhandler_serial.cc
+++ b/winsup/cygwin/fhandler_serial.cc
@@ -9,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
-#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include "cygerrno.h"
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index 3dd8d67..18cc018 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -13,7 +13,6 @@
#define __INSIDE_CYGWIN_NET__
#include "winsup.h"
-#include <errno.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/uio.h>
diff --git a/winsup/cygwin/fhandler_tape.cc b/winsup/cygwin/fhandler_tape.cc
index c37aefc..d6aceff 100644
--- a/winsup/cygwin/fhandler_tape.cc
+++ b/winsup/cygwin/fhandler_tape.cc
@@ -11,7 +11,6 @@ details. */
#include "winsup.h"
#include <sys/termios.h>
-#include <errno.h>
#include <unistd.h>
#include <sys/mtio.h>
#include "cygerrno.h"
diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc
index f284811..49dbb33 100644
--- a/winsup/cygwin/fhandler_termios.cc
+++ b/winsup/cygwin/fhandler_termios.cc
@@ -12,7 +12,6 @@ details. */
#include <sys/termios.h>
#include <stdlib.h>
#include <unistd.h>
-#include <errno.h>
#include <ctype.h>
#include "cygerrno.h"
#include "security.h"
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 6409090..cc60235 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -14,7 +14,6 @@ details. */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
-#include <errno.h>
#include <ctype.h>
#include <limits.h>
#include "cygerrno.h"
diff --git a/winsup/cygwin/fhandler_virtual.cc b/winsup/cygwin/fhandler_virtual.cc
index a29e7e4..b5ecb54 100644
--- a/winsup/cygwin/fhandler_virtual.cc
+++ b/winsup/cygwin/fhandler_virtual.cc
@@ -9,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
-#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/cygwin.h>
diff --git a/winsup/cygwin/fhandler_windows.cc b/winsup/cygwin/fhandler_windows.cc
index 9d3e07e..b989288 100644
--- a/winsup/cygwin/fhandler_windows.cc
+++ b/winsup/cygwin/fhandler_windows.cc
@@ -12,7 +12,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
-#include <errno.h>
#include <wingdi.h>
#include <winuser.h>
#include "cygerrno.h"
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
index 2435d95..184e566 100644
--- a/winsup/cygwin/fork.cc
+++ b/winsup/cygwin/fork.cc
@@ -13,7 +13,6 @@ details. */
#include <unistd.h>
#include <stdlib.h>
#include <stdarg.h>
-#include <errno.h>
#include "security.h"
#include "fhandler.h"
#include "path.h"
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc
index 73a2b89..19b7fe9 100644
--- a/winsup/cygwin/grp.cc
+++ b/winsup/cygwin/grp.cc
@@ -16,7 +16,6 @@ details. */
#include <wininet.h>
#include <stdio.h>
#include <stdlib.h>
-#include <errno.h>
#include "pinfo.h"
#include "security.h"
#include "fhandler.h"
diff --git a/winsup/cygwin/heap.cc b/winsup/cygwin/heap.cc
index fb1e37c..8e0a04e 100644
--- a/winsup/cygwin/heap.cc
+++ b/winsup/cygwin/heap.cc
@@ -9,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
-#include <errno.h>
#include "cygerrno.h"
#include "sigproc.h"
#include "pinfo.h"
diff --git a/winsup/cygwin/include/cygwin/config.h b/winsup/cygwin/include/cygwin/config.h
index 77815a0..e3e09f0 100644
--- a/winsup/cygwin/include/cygwin/config.h
+++ b/winsup/cygwin/include/cygwin/config.h
@@ -19,6 +19,7 @@ extern "C" {
#endif
#define _CYGWIN_CONFIG_H
+#define __DYNAMIC_REENT__
#define __FILENAME_MAX__ (260 - 1 /* NUL */)
#define _READ_WRITE_RETURN_TYPE _ssize_t
#define __LARGE64_FILES 1
diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h
index 6caafea..13657a0 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -207,12 +207,13 @@ details. */
exported symbols like fopen64, which might confuse configure.
86: Export ftok
87: Export vsyslog
+ 88: Export _getreent
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 87
+#define CYGWIN_VERSION_API_MINOR 88
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible
diff --git a/winsup/cygwin/ioctl.cc b/winsup/cygwin/ioctl.cc
index 9f219ec..0b11b28 100644
--- a/winsup/cygwin/ioctl.cc
+++ b/winsup/cygwin/ioctl.cc
@@ -13,7 +13,6 @@ details. */
#include "winsup.h"
#include <sys/ioctl.h>
-#include <errno.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
diff --git a/winsup/cygwin/malloc_wrapper.cc b/winsup/cygwin/malloc_wrapper.cc
index 14db2fd..b2729fb 100644
--- a/winsup/cygwin/malloc_wrapper.cc
+++ b/winsup/cygwin/malloc_wrapper.cc
@@ -18,7 +18,6 @@ details. */
#include "fhandler.h"
#include "path.h"
#include "dtable.h"
-#include <errno.h>
#include "cygerrno.h"
#include "cygheap.h"
#include "heap.h"
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc
index e423156..1724680 100644
--- a/winsup/cygwin/mmap.cc
+++ b/winsup/cygwin/mmap.cc
@@ -13,7 +13,6 @@ details. */
#include <stdlib.h>
#include <stddef.h>
#include <sys/mman.h>
-#include <errno.h>
#include "security.h"
#include "fhandler.h"
#include "path.h"
diff --git a/winsup/cygwin/msg.cc b/winsup/cygwin/msg.cc
index c76fd8e..fecaa06 100644
--- a/winsup/cygwin/msg.cc
+++ b/winsup/cygwin/msg.cc
@@ -15,7 +15,6 @@ details. */
#include <sys/types.h>
#include <cygwin/msg.h>
-#include <errno.h>
#include "cygerrno.h"
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 7890c9b..c5a2a3e 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -13,7 +13,6 @@ details. */
#define __INSIDE_CYGWIN_NET__
#include "winsup.h"
-#include <errno.h>
#include <ctype.h>
#include <sys/socket.h>
#include <sys/un.h>
diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc
index cdb73b0..2db275e 100644
--- a/winsup/cygwin/passwd.cc
+++ b/winsup/cygwin/passwd.cc
@@ -12,7 +12,6 @@ details. */
#include <stdlib.h>
#include <pwd.h>
#include <stdio.h>
-#include <errno.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 3973a32..3f6c1e7 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -53,7 +53,6 @@ details. */
#include <sys/mount.h>
#include <mntent.h>
#include <unistd.h>
-#include <errno.h>
#include <ctype.h>
#include <winioctl.h>
#include <wingdi.h>
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 74e14f3..6f1c3e9 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -11,7 +11,6 @@ details. */
#include "winsup.h"
#include <stdlib.h>
#include <time.h>
-#include <errno.h>
#include <limits.h>
#include "security.h"
#include "fhandler.h"
diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc
index df8fbaf..45bb984 100644
--- a/winsup/cygwin/pipe.cc
+++ b/winsup/cygwin/pipe.cc
@@ -12,7 +12,6 @@ details. */
#include "winsup.h"
#include <unistd.h>
-#include <errno.h>
#include <sys/socket.h>
#include "cygerrno.h"
#include "security.h"
diff --git a/winsup/cygwin/poll.cc b/winsup/cygwin/poll.cc
index 44d00b9..3c39f06 100644
--- a/winsup/cygwin/poll.cc
+++ b/winsup/cygwin/poll.cc
@@ -15,7 +15,6 @@
#include <sys/time.h>
#include <sys/poll.h>
#include <sys/socket.h>
-#include <errno.h>
#include <stdlib.h>
#define USE_SYS_TYPES_FD_SET
#include <winsock2.h>
diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc
index 01e065b..e87702b 100644
--- a/winsup/cygwin/resource.cc
+++ b/winsup/cygwin/resource.cc
@@ -13,7 +13,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
-#include <errno.h>
#include <unistd.h>
#include <limits.h>
#include "cygerrno.h"
diff --git a/winsup/cygwin/scandir.cc b/winsup/cygwin/scandir.cc
index 52a36ea..a2f682a 100644
--- a/winsup/cygwin/scandir.cc
+++ b/winsup/cygwin/scandir.cc
@@ -13,7 +13,6 @@
#include "winsup.h"
#include <dirent.h>
#include <stdlib.h>
-#include <errno.h>
#include "cygerrno.h"
extern "C" int
diff --git a/winsup/cygwin/sched.cc b/winsup/cygwin/sched.cc
index 99c7391..b29d7a4 100644
--- a/winsup/cygwin/sched.cc
+++ b/winsup/cygwin/sched.cc
@@ -16,7 +16,6 @@
#include "winsup.h"
#include <limits.h>
-#include <errno.h>
#include "cygerrno.h"
#include <assert.h>
#include <stdlib.h>
diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc
index c8f3266..fbc4989 100644
--- a/winsup/cygwin/sec_acl.cc
+++ b/winsup/cygwin/sec_acl.cc
@@ -15,7 +15,6 @@ details. */
#include <pwd.h>
#include <unistd.h>
#include <stdlib.h>
-#include <errno.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/winsup/cygwin/sec_helper.cc b/winsup/cygwin/sec_helper.cc
index c2e8c5e..c8c627a 100644
--- a/winsup/cygwin/sec_helper.cc
+++ b/winsup/cygwin/sec_helper.cc
@@ -15,7 +15,6 @@ details. */
#include <pwd.h>
#include <unistd.h>
#include <stdlib.h>
-#include <errno.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc
index 8bfb7d5..7bae8f4 100644
--- a/winsup/cygwin/security.cc
+++ b/winsup/cygwin/security.cc
@@ -16,7 +16,6 @@ details. */
#include <pwd.h>
#include <unistd.h>
#include <stdlib.h>
-#include <errno.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 100d6f2..545cece 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -20,7 +20,6 @@ details. */
#define __INSIDE_CYGWIN_NET__
#include "winsup.h"
-#include <errno.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <sys/time.h>
diff --git a/winsup/cygwin/sem.cc b/winsup/cygwin/sem.cc
index 63aba8e..97d91a3 100644
--- a/winsup/cygwin/sem.cc
+++ b/winsup/cygwin/sem.cc
@@ -15,7 +15,6 @@ details. */
#include <sys/types.h>
#include <cygwin/sem.h>
-#include <errno.h>
#include "cygerrno.h"
diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc
index 30c4582..8bcf2b7 100644
--- a/winsup/cygwin/shared.cc
+++ b/winsup/cygwin/shared.cc
@@ -14,7 +14,6 @@ details. */
#include <stdlib.h>
#include <grp.h>
#include <pwd.h>
-#include <errno.h>
#include "pinfo.h"
#include "security.h"
#include "fhandler.h"
diff --git a/winsup/cygwin/shm.cc b/winsup/cygwin/shm.cc
index 618cac1..fa0375d 100644
--- a/winsup/cygwin/shm.cc
+++ b/winsup/cygwin/shm.cc
@@ -16,7 +16,6 @@ details. */
#include <sys/types.h>
#include <assert.h>
-#include <errno.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
index 547a128..0530fcf 100644
--- a/winsup/cygwin/signal.cc
+++ b/winsup/cygwin/signal.cc
@@ -12,7 +12,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
-#include <errno.h>
#include <stdlib.h>
#include "cygerrno.h"
#include <sys/cygwin.h>
@@ -297,8 +296,8 @@ abort (void)
be flushed.
However this is the way FreeBSD does it, and it is much easier to
do things this way, so... */
- if (_reent_clib ()->__cleanup)
- _reent_clib ()->__cleanup (_reent_clib ());
+ if (_REENT->__cleanup)
+ _REENT->__cleanup (_REENT);
/* Ensure that SIGABRT can be caught regardless of blockage. */
sigset_t sig_mask;
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 5d3b2e2..34492a9 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -14,7 +14,6 @@ details. */
#include <stdlib.h>
#include <time.h>
#include <sys/wait.h>
-#include <errno.h>
#include <stdlib.h>
#include <sys/cygwin.h>
#include <assert.h>
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index e7b04ad..eeee13c 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -14,7 +14,6 @@ details. */
#include <unistd.h>
#include <process.h>
#include <sys/wait.h>
-#include <errno.h>
#include <limits.h>
#include <wingdi.h>
#include <winuser.h>
diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc
index 38cf259..f88cdf0 100644
--- a/winsup/cygwin/strace.cc
+++ b/winsup/cygwin/strace.cc
@@ -14,7 +14,6 @@ details. */
#include <wingdi.h>
#include <winuser.h>
#include <ctype.h>
-#include <errno.h>
#include "pinfo.h"
#include "perprocess.h"
#include "cygwin_version.h"
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 8922f94..ad6a66f 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -29,7 +29,6 @@ details. */
#include <process.h>
#include <utmp.h>
#include <sys/uio.h>
-#include <errno.h>
#include <limits.h>
#include <unistd.h>
#include <setjmp.h>
diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc
index cc5fc24..678d978 100644
--- a/winsup/cygwin/sysconf.cc
+++ b/winsup/cygwin/sysconf.cc
@@ -10,7 +10,6 @@ details. */
#include "winsup.h"
#include <unistd.h>
-#include <errno.h>
#include <time.h>
#include <limits.h>
#include <ntdef.h>
diff --git a/winsup/cygwin/syslog.cc b/winsup/cygwin/syslog.cc
index b87ff66..a21a8cb 100644
--- a/winsup/cygwin/syslog.cc
+++ b/winsup/cygwin/syslog.cc
@@ -14,7 +14,6 @@ details. */
#include <syslog.h>
#include <stdarg.h>
#include <unistd.h>
-#include <errno.h>
#include "security.h"
#include "fhandler.h"
#include "path.h"
diff --git a/winsup/cygwin/termios.cc b/winsup/cygwin/termios.cc
index c7dd20d..60ef964 100644
--- a/winsup/cygwin/termios.cc
+++ b/winsup/cygwin/termios.cc
@@ -12,7 +12,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
-#include <errno.h>
#include <signal.h>
#include <stdlib.h>
#include "cygerrno.h"
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index ac7d4b8..60e94e7 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -45,16 +45,21 @@ details. */
extern int threadsafe;
-struct _reent *
-_reent_clib ()
+extern "C" struct _reent *
+__getreent ()
{
struct __reent_t *_r =
(struct __reent_t *) MT_INTERFACE->reent_key.get ();
-#ifdef _CYG_THREAD_FAILSAFE
if (_r == 0)
- system_printf ("local thread storage not inited");
+ {
+#ifdef _CYG_THREAD_FAILSAFE
+ system_printf ("local thread storage not inited");
#endif
+ /* Return _impure_ptr as long as MTinterface is not initialized */
+ return _impure_ptr;
+ }
+
return _r->_clib;
}
@@ -64,10 +69,14 @@ _reent_winsup ()
struct __reent_t *_r =
(struct __reent_t *) MT_INTERFACE->reent_key.get ();
-#ifdef _CYG_THREAD_FAILSAFE
if (_r == 0)
- system_printf ("local thread storage not inited");
+ {
+#ifdef _CYG_THREAD_FAILSAFE
+ system_printf ("local thread storage not inited");
#endif
+ return NULL;
+ }
+
return _r->_winsup;
}
@@ -212,6 +221,20 @@ MTinterface::fixup_after_fork (void)
{
pthread_key::fixup_after_fork ();
+#ifndef __SIGNALS_ARE_MULTITHREADED__
+ /* As long as the signal handling not multithreaded
+ switch reents storage back to _impure_ptr for the mainthread
+ to support fork from threads other than the mainthread */
+ struct _reent *reent_old = __getreent ();
+
+ if (reent_old && _impure_ptr != reent_old)
+ *_impure_ptr = *reent_old;
+ reents._clib = _impure_ptr;
+ reents._winsup = &winsup_reent;
+ winsup_reent._process_logmask = LOG_UPTO (LOG_DEBUG);
+ reent_key.set (&reents);
+#endif
+
threadcount = 1;
pthread::init_mainthread ();
diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h
index 55d9415..e89640e 100644
--- a/winsup/cygwin/thread.h
+++ b/winsup/cygwin/thread.h
@@ -110,7 +110,6 @@ struct __reent_t
struct _winsup_t *_winsup;
};
-_reent *_reent_clib ();
_winsup_t *_reent_winsup ();
void SetResourceLock (int, int, const char *) __attribute__ ((regparm (3)));
void ReleaseResourceLock (int, int, const char *)
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc
index d56dbab..e2524b1 100644
--- a/winsup/cygwin/times.cc
+++ b/winsup/cygwin/times.cc
@@ -15,7 +15,6 @@ details. */
#include <utime.h>
#include <stdio.h>
#include <stdlib.h>
-#include <errno.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc
index ef3252b..23e6f62 100644
--- a/winsup/cygwin/tty.cc
+++ b/winsup/cygwin/tty.cc
@@ -9,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
-#include <errno.h>
#include <unistd.h>
#include <utmp.h>
#include <wingdi.h>
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index 7c76722..4e688a3 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -17,7 +17,6 @@ details. */
#include <limits.h>
#include <stdlib.h>
#include <lm.h>
-#include <errno.h>
#include <sys/cygwin.h>
#include "pinfo.h"
#include "security.h"
diff --git a/winsup/cygwin/wait.cc b/winsup/cygwin/wait.cc
index 3b6427a..fd78278 100644
--- a/winsup/cygwin/wait.cc
+++ b/winsup/cygwin/wait.cc
@@ -11,7 +11,6 @@ details. */
#include "winsup.h"
#include <sys/wait.h>
#include <stdlib.h>
-#include <errno.h>
#include "cygerrno.h"
#include "sigproc.h"
#include "perthread.h"
diff --git a/winsup/cygwin/window.cc b/winsup/cygwin/window.cc
index bdcb450..ea9ed6e 100644
--- a/winsup/cygwin/window.cc
+++ b/winsup/cygwin/window.cc
@@ -13,7 +13,6 @@ details. */
#include "winsup.h"
#include <sys/time.h>
#include <stdlib.h>
-#include <errno.h>
#include <signal.h>
#include <limits.h>
#include <wingdi.h>