Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog11
-rw-r--r--winsup/cygwin/Makefile.in2
-rw-r--r--winsup/cygwin/dcrt0.cc2
-rw-r--r--winsup/cygwin/dir.cc2
-rw-r--r--winsup/cygwin/dlfcn.cc2
-rw-r--r--winsup/cygwin/dll_init.cc2
-rw-r--r--winsup/cygwin/dtable.cc4
-rw-r--r--winsup/cygwin/environ.cc20
-rw-r--r--winsup/cygwin/errno.cc2
-rw-r--r--winsup/cygwin/exceptions.cc4
-rw-r--r--winsup/cygwin/exec.cc14
-rw-r--r--winsup/cygwin/fcntl.cc2
-rw-r--r--winsup/cygwin/fhandler.cc2
-rw-r--r--winsup/cygwin/fhandler_console.cc2
-rw-r--r--winsup/cygwin/fhandler_floppy.cc2
-rw-r--r--winsup/cygwin/fhandler_random.cc2
-rw-r--r--winsup/cygwin/fhandler_raw.cc2
-rw-r--r--winsup/cygwin/fhandler_serial.cc2
-rw-r--r--winsup/cygwin/fhandler_tape.cc2
-rw-r--r--winsup/cygwin/fhandler_termios.cc2
-rw-r--r--winsup/cygwin/fhandler_tty.cc2
-rw-r--r--winsup/cygwin/fhandler_windows.cc2
-rw-r--r--winsup/cygwin/fhandler_zero.cc2
-rw-r--r--winsup/cygwin/fork.cc2
-rw-r--r--winsup/cygwin/glob.c2
-rw-r--r--winsup/cygwin/grp.cc2
-rw-r--r--winsup/cygwin/heap.cc2
-rw-r--r--winsup/cygwin/init.cc2
-rw-r--r--winsup/cygwin/ioctl.cc2
-rw-r--r--winsup/cygwin/localtime.c1
-rw-r--r--winsup/cygwin/mmap.cc2
-rw-r--r--winsup/cygwin/net.cc5
-rw-r--r--winsup/cygwin/passwd.cc2
-rw-r--r--winsup/cygwin/path.cc2
-rw-r--r--winsup/cygwin/pinfo.cc2
-rw-r--r--winsup/cygwin/pipe.cc2
-rw-r--r--winsup/cygwin/poll.cc2
-rw-r--r--winsup/cygwin/resource.cc2
-rw-r--r--winsup/cygwin/scandir.cc2
-rw-r--r--winsup/cygwin/security.cc2
-rw-r--r--winsup/cygwin/select.cc6
-rw-r--r--winsup/cygwin/shared.cc2
-rw-r--r--winsup/cygwin/signal.cc2
-rw-r--r--winsup/cygwin/sigproc.cc2
-rw-r--r--winsup/cygwin/smallprint.c1
-rw-r--r--winsup/cygwin/spawn.cc10
-rw-r--r--winsup/cygwin/strace.cc2
-rw-r--r--winsup/cygwin/sync.cc2
-rw-r--r--winsup/cygwin/syscalls.cc2
-rw-r--r--winsup/cygwin/sysconf.cc2
-rw-r--r--winsup/cygwin/syslog.cc2
-rw-r--r--winsup/cygwin/termios.cc2
-rw-r--r--winsup/cygwin/thread.cc2
-rw-r--r--winsup/cygwin/times.cc10
-rw-r--r--winsup/cygwin/tty.cc2
-rw-r--r--winsup/cygwin/uinfo.cc2
-rw-r--r--winsup/cygwin/uname.cc2
-rw-r--r--winsup/cygwin/wait.cc2
-rw-r--r--winsup/cygwin/window.cc2
-rw-r--r--winsup/cygwin/winsup.h8
60 files changed, 98 insertions, 92 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 516aeb081..9cd0269ee 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 10f3067c5..82a83fea0 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 43385287d..f84a164a5 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 7323cb388..89d85be3f 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 cb89edf42..010281a3a 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 fc1b291e2..1cbc2ce82 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 32c4a4347..ad6ec5dc7 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 d834160a9..c081b7025 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 44cc60a39..681dfe7ed 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 c6cad810c..373ebac28 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 d54937850..ee40d16a9 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 a82a10521..3b609442a 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 fc1451c68..5e96c2518 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 4c0bb5fa0..564e4e29b 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 93e8435b8..44a15d873 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 9991c3b7e..a577c4846 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 f46e1c8b7..579fe1dfc 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 de4c7fedd..96d7793b2 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 cf142e076..4860faeb1 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 d5213c3f2..410a936ce 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 5f1fc6fe1..f08bbc6b2 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 b68bb7056..7d63344e7 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 29f01ab49..9b4212c15 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 06cd1ff65..7eb43b6be 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 543e4cb5f..f793f86d0 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 1d52c0295..f7f86de96 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 ce1cab5c4..b3dc488d4 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 5c65d55ac..5b6e2aa1c 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 1fb5f3b59..77f075eb1 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 50747dfcf..e4cc766fd 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 9cbf5005d..44e4ba3c7 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 afb09d822..77b201112 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 c2d0bbd42..ee4fd4a65 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 469de5e94..fe1c3852c 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 e2956ee89..ad6f08ad0 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 decd1bd6c..b601bf690 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 c2f9cf9bd..649adf783 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 9f1f46c1c..a456f24b8 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 6f9e30f95..0f2bfd07e 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 d640ac4a3..dae7b06b6 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 951d80dd2..90302179f 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 aa3868c79..a73494baa 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 02870a637..332034fd3 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 fc7839f80..aba39d6ac 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 3bfbda2da..ea5bf8743 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 3c12b7057..7d3063c31 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 a23ab5023..0f11f1b16 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 5036c3d1d..70f798550 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 154c05a1f..ed20df418 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 6dcb08afc..1d89c0b7e 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 2c0290c4e..f1e3fd86d 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 69aaf1943..c2274b999 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 5c4b40275..c08ea8564 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 738d84f82..28763e180 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 5a19958af..615cb2352 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 3aa25ba5c..592ef36e9 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 576c9c04a..0db7c3949 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 63ad06783..91b8e5cd4 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 bd468d1aa..98e6b6d03 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 4b61c4bbf..9a92df214 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 */