diff options
author | DJ Delorie <dj@redhat.com> | 2000-08-02 16:28:18 +0000 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 2000-08-02 16:28:18 +0000 |
commit | 4c8d72ded51ac22172d4f2d0250ada6b0dd624ff (patch) | |
tree | 4573a70b613646456bd4fed93293c6355566c678 /winsup | |
parent | ad8dea13f05b51769c9bef7e414f654588971c10 (diff) | |
download | newlib-4c8d72ded51ac22172d4f2d0250ada6b0dd624ff.zip newlib-4c8d72ded51ac22172d4f2d0250ada6b0dd624ff.tar.gz newlib-4c8d72ded51ac22172d4f2d0250ada6b0dd624ff.tar.bz2 |
* winsup.h: take out protections of environ, errno, allow C use
* *.cc: put winsup.h before other headers (for __INSIDE_CYGWIN__);
use cur_environ() instead of just environ
* times.cc: remove import protections
* glob.c: add winsup.h
* localtime.c: ditto
* smallprint.c: ditto
* Makefile.in: don't __INSIDE_CYGWIN__ as it messes up profiling.
Diffstat (limited to 'winsup')
60 files changed, 98 insertions, 92 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 516aeb0..9cd0269 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +2000-08-02 DJ Delorie <dj@redhat.com> + + * winsup.h: take out protections of environ, errno, allow C use + * *.cc: put winsup.h before other headers (for __INSIDE_CYGWIN__); + use cur_environ() instead of just environ + * times.cc: remove import protections + * glob.c: add winsup.h + * localtime.c: ditto + * smallprint.c: ditto + * Makefile.in: don't __INSIDE_CYGWIN__ as it messes up profiling. + Wed Aug 2 11:22:53 2000 Christopher Faylor <cgf@cygnus.com> * include/sys/strace.h: Fix strace definition. diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index 10f3067..82a83fe 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -71,8 +71,6 @@ include $(srcdir)/../Makefile.common INSTALL_DATA:=$(SHELL) $(updir1)/install-sh -c -COMPILE_CC+=-D__INSIDE_CYGWIN__ - @SET_MAKE@ # Setup the testing framework, if you have one diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 4338528..f84a164 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -8,9 +8,9 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <unistd.h> #include <stdlib.h> -#include "winsup.h" #include "glob.h" #include "exceptions.h" #include "dll_init.h" diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index 7323cb3..89d85be 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -8,11 +8,11 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <unistd.h> #include <stdlib.h> #include <sys/stat.h> #include <errno.h> -#include "winsup.h" #define _COMPILING_NEWLIB #include "dirent.h" diff --git a/winsup/cygwin/dlfcn.cc b/winsup/cygwin/dlfcn.cc index cb89edf..010281a 100644 --- a/winsup/cygwin/dlfcn.cc +++ b/winsup/cygwin/dlfcn.cc @@ -8,10 +8,10 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include "winsup.h" #include <ctype.h> #include "dlfcn.h" #include "dll_init.h" diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc index fc1b291..1cbc2ce 100644 --- a/winsup/cygwin/dll_init.cc +++ b/winsup/cygwin/dll_init.cc @@ -6,8 +6,8 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ -#include <stdlib.h> #include "winsup.h" +#include <stdlib.h> #include "exceptions.h" #include "dll_init.h" diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index 32c4a43..ad6ec5d 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -10,6 +10,8 @@ details. */ #define __INSIDE_CYGWIN_NET__ +#define Win32_Winsock +#include "winsup.h" #include <errno.h> #include <sys/socket.h> #include <stdlib.h> @@ -17,8 +19,6 @@ details. */ #include <unistd.h> #include <fcntl.h> -#define Win32_Winsock -#include "winsup.h" #include <winsock.h> hinfo dtable; diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index d834160..c081b70 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -7,9 +7,9 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <errno.h> #include <stdlib.h> -#include "winsup.h" #include <stddef.h> #include <ctype.h> #include <fcntl.h> @@ -83,7 +83,7 @@ getwinenv (const char *env, const char *in_posix) { win_env *we = conv_envvars + i; const char *val; - if (!environ || !(val = in_posix ?: getenv(we->name))) + if (!cur_environ () || !(val = in_posix ?: getenv(we->name))) debug_printf ("can't set native for %s since no environ yet", we->name); else if (!envcache || !we->posix || strcmp (val, we->posix)) @@ -146,11 +146,11 @@ my_findenv (const char *name, int *offset) len++; } - for (p = environ; *p; ++p) + for (p = cur_environ (); *p; ++p) if (!strncmp (*p, name, len)) if (*(c = *p + len) == '=') { - *offset = p - environ; + *offset = p - cur_environ (); return (char *) (++c); } return NULL; @@ -199,13 +199,13 @@ _addenv (const char *name, const char *value, int overwrite) char **env; /* Search for the end of the environment. */ - for (env = environ; *env; env++) + for (env = cur_environ (); *env; env++) continue; - offset = env - environ; /* Number of elements currently in environ. */ + offset = env - cur_environ (); /* Number of elements currently in environ. */ /* Allocate space for additional element plus terminating NULL. */ - __cygwin_environ = (char **) realloc (environ, (sizeof (char *) * + __cygwin_environ = (char **) realloc (cur_environ (), (sizeof (char *) * (offset + 2))); if (!__cygwin_environ) return -1; /* Oops. No more memory. */ @@ -216,7 +216,7 @@ _addenv (const char *name, const char *value, int overwrite) char *envhere; if (!issetenv) - envhere = environ[offset] = (char *) name; /* Not setenv. Just + envhere = cur_environ ()[offset] = (char *) name; /* Not setenv. Just overwrite existing. */ else { /* setenv */ @@ -226,7 +226,7 @@ _addenv (const char *name, const char *value, int overwrite) int namelen = p - name; /* Length of name. */ /* Allocate enough space for name + '=' + value + '\0' */ - envhere = environ[offset] = (char *) malloc (namelen + valuelen + 2); + envhere = cur_environ ()[offset] = (char *) malloc (namelen + valuelen + 2); if (!envhere) return -1; /* Oops. No more memory. */ @@ -308,7 +308,7 @@ unsetenv (const char *name) while (my_findenv (name, &offset)) /* if set multiple times */ /* Move up the rest of the array */ - for (e = environ + offset; ; e++) + for (e = cur_environ () + offset; ; e++) if (!(*e = *(e + 1))) break; } diff --git a/winsup/cygwin/errno.cc b/winsup/cygwin/errno.cc index 44cc60a..681dfe7 100644 --- a/winsup/cygwin/errno.cc +++ b/winsup/cygwin/errno.cc @@ -8,9 +8,9 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #define _REENT_ONLY #include <stdio.h> -#include "winsup.h" #include <errno.h> /* Table to map Windows error codes to Errno values. */ diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index c6cad81..373ebac 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -8,11 +8,11 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#define Win32_Winsock +#include "winsup.h" #include <stdio.h> #include <errno.h> -#define Win32_Winsock -#include "winsup.h" #include "exceptions.h" #include <imagehlp.h> diff --git a/winsup/cygwin/exec.cc b/winsup/cygwin/exec.cc index d549378..ee40d16 100644 --- a/winsup/cygwin/exec.cc +++ b/winsup/cygwin/exec.cc @@ -8,11 +8,11 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <unistd.h> #include <stdlib.h> #include <errno.h> #include <process.h> -#include "winsup.h" /* This is called _execve and not execve because the real execve is defined in libc/posix/execve.c. It calls us. */ @@ -44,7 +44,7 @@ execl (const char *path, const char *arg0, ...) while (argv[i++] != NULL); va_end (args); MALLOC_CHECK; - return _execve (path, (char * const *) argv, environ); + return _execve (path, (char * const *) argv, cur_environ ()); } extern "C" @@ -52,7 +52,7 @@ int execv (const char *path, char * const *argv) { MALLOC_CHECK; - return _execve (path, (char * const *) argv, environ); + return _execve (path, (char * const *) argv, cur_environ ()); } /* the same as a standard exec() calls family, but with NT security support */ @@ -85,7 +85,7 @@ sexecl (HANDLE hToken, const char *path, const char *arg0, ...) va_end (args); MALLOC_CHECK; - return sexecve (hToken, path, (char * const *) argv, environ); + return sexecve (hToken, path, (char * const *) argv, cur_environ ()); } extern "C" @@ -131,7 +131,7 @@ sexeclp (HANDLE hToken, const char *path, const char *arg0, ...) va_end (args); MALLOC_CHECK; - return sexecvpe (hToken, path, (const char * const *) argv, environ); + return sexecvpe (hToken, path, (const char * const *) argv, cur_environ ()); } extern "C" @@ -163,7 +163,7 @@ int sexecv (HANDLE hToken, const char *path, const char * const *argv) { MALLOC_CHECK; - return sexecve (hToken, path, argv, environ); + return sexecve (hToken, path, argv, cur_environ ()); } extern "C" @@ -171,7 +171,7 @@ int sexecp (HANDLE hToken, const char *path, const char * const *argv) { MALLOC_CHECK; - return sexecvpe (hToken, path, argv, environ); + return sexecvpe (hToken, path, argv, cur_environ ()); } /* diff --git a/winsup/cygwin/fcntl.cc b/winsup/cygwin/fcntl.cc index a82a105..3b60944 100644 --- a/winsup/cygwin/fcntl.cc +++ b/winsup/cygwin/fcntl.cc @@ -8,11 +8,11 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <fcntl.h> #include <stdarg.h> #include <errno.h> #include <unistd.h> -#include "winsup.h" extern "C" int diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index fc1451c..5e96c25 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -8,11 +8,11 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <sys/fcntl.h> #include <errno.h> #include <unistd.h> #include <stdlib.h> -#include "winsup.h" static NO_COPY const int CHUNK_SIZE = 1024; /* Used for crlf conversions */ diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 4c0bb5f..564e4e2 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -12,13 +12,13 @@ details. */ Should the constructor call tcinit() explicitly rather than having it sprinkled throughout here? */ +#include "winsup.h" #include <sys/termios.h> #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> -#include "winsup.h" #include <wingdi.h> #include <winuser.h> #include <ctype.h> diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc index 93e8435..44a15d8 100644 --- a/winsup/cygwin/fhandler_floppy.cc +++ b/winsup/cygwin/fhandler_floppy.cc @@ -9,11 +9,11 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <sys/termios.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> -#include "winsup.h" /**********************************************************************/ /* fhandler_dev_floppy */ diff --git a/winsup/cygwin/fhandler_random.cc b/winsup/cygwin/fhandler_random.cc index 9991c3b..a577c48 100644 --- a/winsup/cygwin/fhandler_random.cc +++ b/winsup/cygwin/fhandler_random.cc @@ -10,9 +10,9 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <errno.h> #include <limits.h> -#include "winsup.h" #define RANDOM 8 #define URANDOM 9 diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc index f46e1c8..579fe1d 100644 --- a/winsup/cygwin/fhandler_raw.cc +++ b/winsup/cygwin/fhandler_raw.cc @@ -8,11 +8,11 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <sys/termios.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> -#include "winsup.h" #include <cygwin/rdevio.h> #include <sys/mtio.h> diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc index de4c7fe..96d7793 100644 --- a/winsup/cygwin/fhandler_serial.cc +++ b/winsup/cygwin/fhandler_serial.cc @@ -8,11 +8,11 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <fcntl.h> #include <errno.h> #include <unistd.h> #include <stdlib.h> -#include "winsup.h" /**********************************************************************/ /* fhandler_serial */ diff --git a/winsup/cygwin/fhandler_tape.cc b/winsup/cygwin/fhandler_tape.cc index cf142e0..4860fae 100644 --- a/winsup/cygwin/fhandler_tape.cc +++ b/winsup/cygwin/fhandler_tape.cc @@ -9,11 +9,11 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <sys/termios.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> -#include "winsup.h" #include <sys/mtio.h> diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc index d5213c3..410a936 100644 --- a/winsup/cygwin/fhandler_termios.cc +++ b/winsup/cygwin/fhandler_termios.cc @@ -8,11 +8,11 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> -#include "winsup.h" #include <ctype.h> /* Common functions shared by tty/console */ diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 5f1fc6f..f08bbc6 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -8,12 +8,12 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <errno.h> -#include "winsup.h" #include <ctype.h> #include <limits.h> diff --git a/winsup/cygwin/fhandler_windows.cc b/winsup/cygwin/fhandler_windows.cc index b68bb70..7d63344 100644 --- a/winsup/cygwin/fhandler_windows.cc +++ b/winsup/cygwin/fhandler_windows.cc @@ -11,8 +11,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> #include "winsup.h" +#include <errno.h> #include <wingdi.h> #include <winuser.h> diff --git a/winsup/cygwin/fhandler_zero.cc b/winsup/cygwin/fhandler_zero.cc index 29f01ab..9b4212c 100644 --- a/winsup/cygwin/fhandler_zero.cc +++ b/winsup/cygwin/fhandler_zero.cc @@ -10,8 +10,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> #include "winsup.h" +#include <errno.h> fhandler_dev_zero::fhandler_dev_zero (const char *name) : fhandler_base (FH_ZERO, name) diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 06cd1ff..7eb43b6 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -8,13 +8,13 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <fcntl.h> #include <stdarg.h> #include <errno.h> -#include "winsup.h" #include "dll_init.h" DWORD NO_COPY chunksize = 0; diff --git a/winsup/cygwin/glob.c b/winsup/cygwin/glob.c index 543e4cb..f793f86 100644 --- a/winsup/cygwin/glob.c +++ b/winsup/cygwin/glob.c @@ -67,6 +67,8 @@ /* #include "namespace.h" */ /* end CYGNUS LOCAL */ +#include "winsup.h" + #include <sys/param.h> #include <sys/stat.h> diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index 1d52c02..f7f86de 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -11,10 +11,10 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <grp.h> #include <stdio.h> #include <stdlib.h> -#include "winsup.h" /* Read /etc/group only once for better performance. This is done on the first call that needs information from it. */ diff --git a/winsup/cygwin/heap.cc b/winsup/cygwin/heap.cc index ce1cab5..b3dc488 100644 --- a/winsup/cygwin/heap.cc +++ b/winsup/cygwin/heap.cc @@ -8,8 +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> #include "winsup.h" +#include <errno.h> #define brksize ((char *) user_data->heaptop - (char *) user_data->heapbase) #define brk (user_data->heapptr) diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc index 5c65d55..5b6e2aa 100644 --- a/winsup/cygwin/init.cc +++ b/winsup/cygwin/init.cc @@ -8,8 +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 <stdlib.h> #include "winsup.h" +#include <stdlib.h> extern HMODULE cygwin_hmodule; diff --git a/winsup/cygwin/ioctl.cc b/winsup/cygwin/ioctl.cc index 1fb5f3b..77f075e 100644 --- a/winsup/cygwin/ioctl.cc +++ b/winsup/cygwin/ioctl.cc @@ -11,9 +11,9 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <sys/ioctl.h> #include <errno.h> -#include "winsup.h" extern "C" int diff --git a/winsup/cygwin/localtime.c b/winsup/cygwin/localtime.c index 50747df..e4cc766 100644 --- a/winsup/cygwin/localtime.c +++ b/winsup/cygwin/localtime.c @@ -5,6 +5,7 @@ /* Temporarily merged private.h and tzfile.h for ease of management - DJ */ /* CYGNUS LOCAL */ +#include "winsup.h" #define lint #include <windows.h> diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 9cbf500..44e4ba3 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -8,12 +8,12 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <stdlib.h> #include <stddef.h> #include <sys/mman.h> #include <errno.h> -#include "winsup.h" /* * Simple class used to keep a record of all current diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index afb09d8..77b2011 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -12,14 +12,13 @@ details. */ #define __INSIDE_CYGWIN_NET__ +#define Win32_Winsock +#include "winsup.h" #include <errno.h> #include <sys/socket.h> #include <sys/un.h> #include <unistd.h> - -#define Win32_Winsock -#include "winsup.h" #include <netdb.h> #include <fcntl.h> #include "autoload.h" diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index c2d0bbd..ee4fd4a 100644 --- a/winsup/cygwin/passwd.cc +++ b/winsup/cygwin/passwd.cc @@ -8,11 +8,11 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <stdlib.h> #include <pwd.h> #include <stdio.h> #include <errno.h> -#include "winsup.h" /* Read /etc/passwd only once for better performance. This is done on the first call that needs information from it. */ diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 469de5e..fe1c385 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -71,6 +71,7 @@ details. */ c: means c:\. */ +#include "winsup.h" #include <stdio.h> #include <stdlib.h> #include <sys/mount.h> @@ -78,7 +79,6 @@ details. */ #include <fcntl.h> #include <unistd.h> #include <errno.h> -#include "winsup.h" #include <ctype.h> #include <winioctl.h> diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index e2956ee..ad6f08a 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -8,11 +8,11 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <stdlib.h> #include <time.h> #include <errno.h> #include <limits.h> -#include "winsup.h" static char NO_COPY pinfo_dummy[sizeof(pinfo)] = {0}; diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc index decd1bd..b601bf6 100644 --- a/winsup/cygwin/pipe.cc +++ b/winsup/cygwin/pipe.cc @@ -8,10 +8,10 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <unistd.h> #include <sys/fcntl.h> #include <errno.h> -#include "winsup.h" static int make_pipe (int fildes[2], unsigned int psize, int mode) diff --git a/winsup/cygwin/poll.cc b/winsup/cygwin/poll.cc index c2f9cf9..649adf7 100644 --- a/winsup/cygwin/poll.cc +++ b/winsup/cygwin/poll.cc @@ -8,8 +8,8 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ -#include <sys/poll.h> #include "winsup.h" +#include <sys/poll.h> extern "C" int diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc index 9f1f46c..a456f24 100644 --- a/winsup/cygwin/resource.cc +++ b/winsup/cygwin/resource.cc @@ -12,8 +12,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> #include "winsup.h" +#include <errno.h> /* add timeval values */ static void diff --git a/winsup/cygwin/scandir.cc b/winsup/cygwin/scandir.cc index 6f9e30f..0f2bfd0 100644 --- a/winsup/cygwin/scandir.cc +++ b/winsup/cygwin/scandir.cc @@ -10,10 +10,10 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <dirent.h> #include <stdlib.h> #include <errno.h> -#include "winsup.h" extern "C" int diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index d640ac4..dae7b06 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -11,6 +11,7 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <grp.h> #include <pwd.h> #include <unistd.h> @@ -20,7 +21,6 @@ details. */ #include <sys/types.h> #include <sys/stat.h> #include <sys/acl.h> -#include "winsup.h" #include <ctype.h> extern BOOL allow_ntea; diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 951d80d..9030217 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -20,17 +20,17 @@ details. */ #define __INSIDE_CYGWIN_NET__ #define Win32_Winsock +#include "winsup.h" #include <errno.h> #include <sys/socket.h> #include <stdlib.h> #include <sys/time.h> +#include <wingdi.h> +#include <winuser.h> #include <netdb.h> #include <unistd.h> #include <stdio.h> -#include "winsup.h" -#include <wingdi.h> -#include <winuser.h> #include <winsock.h> #include "select.h" diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index aa3868c..a73494b 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -8,12 +8,12 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <grp.h> #include <pwd.h> -#include "winsup.h" #define SHAREDVER (unsigned)(cygwin_version.api_major << 16 | \ cygwin_version.api_minor) diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 02870a6..332034f 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -11,8 +11,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> #include "winsup.h" +#include <errno.h> extern "C" _sig_func_ptr diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index fc7839f..aba39d6 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -10,12 +10,12 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <stdlib.h> #include <time.h> #include <sys/wait.h> #include <errno.h> #include <stdlib.h> -#include "winsup.h" extern BOOL allow_ntsec; diff --git a/winsup/cygwin/smallprint.c b/winsup/cygwin/smallprint.c index 3bfbda2..ea5bf87 100644 --- a/winsup/cygwin/smallprint.c +++ b/winsup/cygwin/smallprint.c @@ -8,6 +8,7 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <stdarg.h> #include <string.h> #include <stdlib.h> diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 3c12b70..7d3063c 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -8,6 +8,7 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <stdlib.h> #include <stdarg.h> #include <unistd.h> @@ -15,7 +16,6 @@ details. */ #include <sys/wait.h> #include <errno.h> #include <limits.h> -#include "winsup.h" #include <wingdi.h> #include <winuser.h> #include <ctype.h> @@ -921,7 +921,7 @@ spawnl (int mode, const char *path, const char *arg0, ...) va_end (args); - return _spawnve (NULL, mode, path, (char * const *) argv, environ); + return _spawnve (NULL, mode, path, (char * const *) argv, cur_environ ()); } extern "C" @@ -966,7 +966,7 @@ spawnlp (int mode, const char *path, const char *arg0, ...) va_end (args); - return spawnvpe (mode, path, (char * const *) argv, environ); + return spawnvpe (mode, path, (char * const *) argv, cur_environ ()); } extern "C" @@ -996,7 +996,7 @@ extern "C" int spawnv (int mode, const char *path, const char * const *argv) { - return _spawnve (NULL, mode, path, argv, environ); + return _spawnve (NULL, mode, path, argv, cur_environ ()); } extern "C" @@ -1011,7 +1011,7 @@ extern "C" int spawnvp (int mode, const char *path, const char * const *argv) { - return spawnvpe (mode, path, argv, environ); + return spawnvpe (mode, path, argv, cur_environ ()); } extern "C" diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc index a23ab50..0f11f1b 100644 --- a/winsup/cygwin/strace.cc +++ b/winsup/cygwin/strace.cc @@ -8,9 +8,9 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <stdlib.h> #include <time.h> -#include "winsup.h" #include <wingdi.h> #include <winuser.h> diff --git a/winsup/cygwin/sync.cc b/winsup/cygwin/sync.cc index 5036c3d..70f7985 100644 --- a/winsup/cygwin/sync.cc +++ b/winsup/cygwin/sync.cc @@ -14,12 +14,12 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <stdlib.h> #include <time.h> #include <sys/wait.h> #include <errno.h> #include <stdlib.h> -#include "winsup.h" muto NO_COPY muto_start; diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 154c05a..ed20df4 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -8,6 +8,7 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <sys/stat.h> #include <sys/vfs.h> /* needed for statfs */ #include <fcntl.h> @@ -20,7 +21,6 @@ details. */ #include <sys/uio.h> #include <errno.h> #include <limits.h> -#include "winsup.h" #include <unistd.h> #include <winnls.h> #include <lmcons.h> /* for UNLEN */ diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc index 6dcb08a..1d89c0b 100644 --- a/winsup/cygwin/sysconf.cc +++ b/winsup/cygwin/sysconf.cc @@ -8,11 +8,11 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <unistd.h> #include <errno.h> #include <time.h> #include <limits.h> -#include "winsup.h" /* sysconf: POSIX 4.8.1.1 */ /* Allows a portable app to determine quantities of resources or diff --git a/winsup/cygwin/syslog.cc b/winsup/cygwin/syslog.cc index 2c0290c..f1e3fd8 100644 --- a/winsup/cygwin/syslog.cc +++ b/winsup/cygwin/syslog.cc @@ -8,12 +8,12 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <stdlib.h> #include <stdio.h> #include <syslog.h> #include <stdarg.h> #include <unistd.h> -#include "winsup.h" /* FIXME: These should probably be in the registry. */ /* FIXME: The Win95 path should be whatever slash is */ diff --git a/winsup/cygwin/termios.cc b/winsup/cygwin/termios.cc index 69aaf19..c2274b9 100644 --- a/winsup/cygwin/termios.cc +++ b/winsup/cygwin/termios.cc @@ -11,8 +11,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> #include "winsup.h" +#include <errno.h> /* tcsendbreak: POSIX 7.2.2.1 */ extern "C" diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 5c4b402..c08ea85 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -15,8 +15,8 @@ details. */ #endif #ifdef _MT_SAFE -#include <errno.h> #include "winsup.h" +#include <errno.h> #include <assert.h> #include <stdlib.h> diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index 738d84f..28763e1 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -8,10 +8,7 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ -/* Hide definitions from the library since they contain the - "dllimport" attribute. */ -#define _timezone dummy_timezone -#define _daylight dummy_daylight +#include "winsup.h" #include <time.h> #include <sys/times.h> #include <sys/timeb.h> @@ -19,12 +16,7 @@ details. */ #include <stdio.h> #include <stdlib.h> #include <errno.h> -#include "winsup.h" -#undef _timezone -#undef _daylight -extern time_t _timezone; -extern int _daylight; #define FACTOR (0x19db1ded53ea710LL) #define NSPERSEC 10000000LL diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc index 5a19958..615cb23 100644 --- a/winsup/cygwin/tty.cc +++ b/winsup/cygwin/tty.cc @@ -8,10 +8,10 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <errno.h> #include <unistd.h> #include <utmp.h> -#include "winsup.h" #include <wingdi.h> #include <winuser.h> diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index 3aa25ba..592ef36 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -8,8 +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 <pwd.h> #include "winsup.h" +#include <pwd.h> #include <unistd.h> #include <winnls.h> #include <utmp.h> diff --git a/winsup/cygwin/uname.cc b/winsup/cygwin/uname.cc index 576c9c0..0db7c39 100644 --- a/winsup/cygwin/uname.cc +++ b/winsup/cygwin/uname.cc @@ -10,9 +10,9 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <stdio.h> #include <sys/utsname.h> -#include "winsup.h" /* uname: POSIX 4.4.1.1 */ extern "C" int diff --git a/winsup/cygwin/wait.cc b/winsup/cygwin/wait.cc index 63ad067..91b8e5c 100644 --- a/winsup/cygwin/wait.cc +++ b/winsup/cygwin/wait.cc @@ -8,10 +8,10 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <sys/wait.h> #include <stdlib.h> #include <errno.h> -#include "winsup.h" /* This is called _wait and not wait because the real wait is defined in libc/syscalls/syswait.c. It calls us. */ diff --git a/winsup/cygwin/window.cc b/winsup/cygwin/window.cc index bd468d1..98e6b6d 100644 --- a/winsup/cygwin/window.cc +++ b/winsup/cygwin/window.cc @@ -10,11 +10,11 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" #include <sys/time.h> #include <stdlib.h> #include <errno.h> #include <limits.h> -#include "winsup.h" #include <wingdi.h> #include <winuser.h> diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 4b61c4b..9a92df2 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -14,6 +14,8 @@ details. */ #define __INSIDE_CYGWIN__ +#ifdef __cplusplus + #define alloca(x) __builtin_alloca (x) #define strlen __builtin_strlen #define strcpy __builtin_strcpy @@ -502,7 +504,6 @@ void __stdcall update_envptrs (); char * __stdcall winenv (const char * const *, int); extern char **__cygwin_environ, ***main_environ; extern "C" char __stdcall **cur_environ (); -#define environ (cur_environ ()) /* The title on program start. */ extern char *old_title; @@ -516,8 +517,7 @@ void seterrno (const char *, int line); #define __seterrno() seterrno (__FILE__, __LINE__) #define __seterrno_from_win_error(val) seterrno_from_win_error (__FILE__, __LINE__, val) -#undef errno -#define errno dont_use_this_since_were_in_a_shared library + #define set_errno(val) (_impure_ptr->_errno = (val)) #define get_errno() (_impure_ptr->_errno) extern "C" void __stdcall set_sig_errno (int e); @@ -535,3 +535,5 @@ class save_errno extern const char *__sp_fn; extern int __sp_ln; + +#endif /* defined __cplusplus */ |