OSDN Git Service

* winsup.h: Eliminate inclusion of most of the cygwin .h files. Use .h files
authorcgf <cgf>
Tue, 22 Aug 2000 05:10:20 +0000 (05:10 +0000)
committercgf <cgf>
Tue, 22 Aug 2000 05:10:20 +0000 (05:10 +0000)
only in sources which require them.
* Makefile.in: Generate dependencies with -MD option.

63 files changed:
winsup/cygwin/ChangeLog
winsup/cygwin/Makefile.in
winsup/cygwin/dcrt0.cc
winsup/cygwin/debug.cc
winsup/cygwin/dir.cc
winsup/cygwin/dlfcn.cc
winsup/cygwin/dtable.cc
winsup/cygwin/environ.cc
winsup/cygwin/errno.cc
winsup/cygwin/exceptions.cc
winsup/cygwin/exec.cc
winsup/cygwin/external.cc
winsup/cygwin/fcntl.cc
winsup/cygwin/fhandler.cc
winsup/cygwin/fhandler_console.cc
winsup/cygwin/fhandler_floppy.cc
winsup/cygwin/fhandler_random.cc
winsup/cygwin/fhandler_raw.cc
winsup/cygwin/fhandler_serial.cc
winsup/cygwin/fhandler_tape.cc
winsup/cygwin/fhandler_termios.cc
winsup/cygwin/fhandler_tty.cc
winsup/cygwin/fhandler_windows.cc
winsup/cygwin/fhandler_zero.cc
winsup/cygwin/fork.cc
winsup/cygwin/grp.cc
winsup/cygwin/heap.cc
winsup/cygwin/init.cc
winsup/cygwin/ioctl.cc
winsup/cygwin/malloc_wrapper.cc
winsup/cygwin/mmap.cc
winsup/cygwin/net.cc
winsup/cygwin/passwd.cc
winsup/cygwin/path.cc
winsup/cygwin/path.h
winsup/cygwin/perthread.h
winsup/cygwin/pinfo.cc
winsup/cygwin/pinfo.h
winsup/cygwin/pipe.cc
winsup/cygwin/poll.cc
winsup/cygwin/pthread.cc
winsup/cygwin/resource.cc
winsup/cygwin/security.cc
winsup/cygwin/select.cc
winsup/cygwin/shared.cc
winsup/cygwin/shared.h
winsup/cygwin/signal.cc
winsup/cygwin/sigproc.cc
winsup/cygwin/sigproc.h
winsup/cygwin/spawn.cc
winsup/cygwin/strace.cc
winsup/cygwin/sync.cc
winsup/cygwin/syscalls.cc
winsup/cygwin/sysconf.cc
winsup/cygwin/syslog.cc
winsup/cygwin/termios.cc
winsup/cygwin/thread.cc
winsup/cygwin/thread.h
winsup/cygwin/times.cc
winsup/cygwin/tty.cc
winsup/cygwin/uinfo.cc
winsup/cygwin/wait.cc
winsup/cygwin/winsup.h

index 1d3217e..538d218 100644 (file)
@@ -1,3 +1,9 @@
+Tue Aug 22 01:08:01 2000  Christopher Faylor <cgf@cygnus.com>
+
+       * winsup.h: Eliminate inclusion of most of the cygwin .h files.  Use .h
+       files only in sources which require them.
+       * Makefile.in: Generate dependencies with -MD option.
+
 Mon Aug 21 23:49:05 2000  Christopher Faylor <cgf@cygnus.com>
 
        * cygerrno.h: New file.  Use this throughout whenever errno
index 9efa984..8a6575b 100644 (file)
@@ -47,7 +47,7 @@ INSTALL_PROGRAM:=@INSTALL_PROGRAM@
 MT_SAFE = @MT_SAFE@
 DEFS = @DEFS@
 
-CC:=@CC@
+CC:=@CC@ -MD
 # FIXME: Which is it, CC or CC_FOR_TARGET?
 CC_FOR_TARGET:=$(CC)
 CFLAGS:=@CFLAGS@
@@ -282,77 +282,5 @@ WINSUP_H:=winsup.h fhandler.h path.h shared.h \
          $(MT_SAFE_HEADERS)
 
 winsup.h: config.h
-assert.o: $(WINSUP_H)
-dcrt0.o: $(WINSUP_H) include/exceptions.h include/glob.h dll_init.h autoload.h
-debug.o: $(WINSUP_H) debug.h sync.h
-delqueue.o: $(WINSUP_H)
-dir.o: $(WINSUP_H)
-dlfcn.o: $(WINSUP_H) dll_init.h
-dll_entry.o: $(WINSUP_H) include/cygwin/cygwin_dll.h
-dll_init.o: $(WINSUP_H) include/exceptions.h dll_init.h
-dll_main.o:
-environ.o: $(WINSUP_H)
-errno.o: $(WINSUP_H)
-exceptions.o: $(WINSUP_H) include/exceptions.h sync.h
-exec.o: $(WINSUP_H)
-external.o: $(WINSUP_H)
-fcntl.o: $(WINSUP_H)
-fhandler.o: $(WINSUP_H)
-fhandler_console.o: $(WINSUP_H)
-fhandler_serial.o: $(WINSUP_H)
-fhandler_termios.o: $(WINSUP_H)
-fhandler_tty.o: $(WINSUP_H)
-fhandler_windows.o: $(WINSUP_H)
-fhandler_raw.o: $(WINSUP_H)
-fhandler_floppy.o: $(WINSUP_H)
-fhandler_tape.o: $(WINSUP_H)
-fhandler_zero.o: $(WINSUP_H)
-fhandler_random.o: $(WINSUP_H)
-fork.o: $(WINSUP_H) dll_init.h
-glob.o: include/glob.h
-gmon.o: profil.h gmon.h
-grp.o: $(WINSUP_H)
-heap.o: $(WINSUP_H)
-dtable.o: $(WINSUP_H)
-init.o: $(WINSUP_H)
-ioctl.o: $(WINSUP_H)
-libccrt0.o: $(WINSUP_H)
-libcmain.o: $(WINSUP_H)
-localtime.o: tz_posixrules.h
-malloc.o: $(WINSUP_H) sync.h
-mcount.o: gmon.h
-mmap.o: $(WINSUP_H)
-net.o: $(WINSUP_H) autoload.h
-ntea.o:
-passwd.o: $(WINSUP_H)
-path.o: $(WINSUP_H)
-pinfo.o: $(WINSUP_H)
-pipe.o: $(WINSUP_H)
-poll.o: $(WINSUP_H)
-profile.o: profil.h
-pthread.o: $(WINSUP_H)
-registry.o: $(WINSUP_H)
-resource.o: $(WINSUP_H)
-scandir.o:
-security.o: $(WINSUP_H)
-select.o: $(WINSUP_H) select.h
-shared.o: $(WINSUP_H)
-signal.o: $(WINSUP_H)
-sigproc.o: $(WINSUP_H) sync.h
-smallprint.o: $(WINSUP_H)
-spawn.o: $(WINSUP_H)
-strace.o: $(WINSUP_H)
-strsep.o:
-sync.o: $(WINSUP_H) sync.h
-syscalls.o: $(WINSUP_H)
-sysconf.o: $(WINSUP_H)
-syslog.o: $(WINSUP_H)
-termios.o: $(WINSUP_H)
-test.o: $(WINSUP_H)
-times.o: $(WINSUP_H)
-tty.o: $(WINSUP_H)
-uinfo.o: $(WINSUP_H) autoload.h
-uname.o: $(WINSUP_H)
-wait.o: $(WINSUP_H)
-window.o: $(WINSUP_H)
-thread.o: $(WINSUP_H)
+
+include *.d
index f6b2bfc..fa0f4dd 100644 (file)
@@ -16,9 +16,15 @@ details. */
 #include "dll_init.h"
 #include "autoload.h"
 #include <ctype.h>
-#include "dtable.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "perthread.h"
 #include "pinfo.h"
 #include "cygerrno.h"
+#include "fhandler.h"
+#include "path.h"
+#include "dtable.h"
+#include "thread.h"
 
 #define MAX_AT_FILE_LEVEL 10
 
index e83b13a..050619b 100644 (file)
@@ -9,8 +9,10 @@ details. */
 #define NO_DEBUG_DEFINES
 #include "winsup.h"
 #include "exceptions.h"
-#include "perthread.h"
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
+#include "perthread.h"
 
 static muto NO_COPY *threadname_lock = NULL;
 #define lock_threadname() \
index 612d9e0..96ca52d 100644 (file)
@@ -13,11 +13,16 @@ details. */
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <errno.h>
-#include "pinfo.h"
-#include "cygerrno.h"
 
 #define _COMPILING_NEWLIB
-#include "dirent.h"
+#include <dirent.h>
+
+#include "sync.h"
+#include "sigproc.h"
+#include "pinfo.h"
+#include "cygerrno.h"
+#include "fhandler.h"
+#include "path.h"
 
 /* Cygwin internal */
 /* Return whether the directory of a file is writable.  Return 1 if it
index 010281a..4484154 100644 (file)
@@ -15,6 +15,9 @@ details. */
 #include <ctype.h>
 #include "dlfcn.h"
 #include "dll_init.h"
+#include "fhandler.h"
+#include "path.h"
+#include "thread.h"
 
 #define _dl_error _reent_winsup()->_dl_error
 #define _dl_buffer _reent_winsup()->_dl_buffer
index c405d92..05b767f 100644 (file)
@@ -20,9 +20,14 @@ details. */
 #include <fcntl.h>
 
 #include <winsock.h>
-#include "dtable.h"
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
 #include "cygerrno.h"
+#include "fhandler.h"
+#include "path.h"
+#include "dtable.h"
+#include "thread.h"
 
 dtable fdtab;
 
index 7ae95b5..fc497a3 100644 (file)
@@ -13,7 +13,11 @@ details. */
 #include <stddef.h>
 #include <ctype.h>
 #include <fcntl.h>
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
+#include "fhandler.h"
+#include "path.h"
 #include "cygerrno.h"
 
 extern BOOL allow_glob;
index 25dcf70..8e88cd5 100644 (file)
@@ -13,6 +13,7 @@ details. */
 #include <stdio.h>
 #include <errno.h>
 #include "cygerrno.h"
+#include "thread.h"
 
 /* Table to map Windows error codes to Errno values.  */
 /* FIXME: Doing things this way is a little slow.  It's trivial to change
index 39ae079..18af64d 100644 (file)
@@ -10,13 +10,16 @@ details. */
 
 #define Win32_Winsock
 #include "winsup.h"
-#include <stdio.h>
+#include <imagehlp.h>
 #include <errno.h>
 
 #include "exceptions.h"
-#include <imagehlp.h>
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
 #include "cygerrno.h"
+#include "thread.h"
+#include "perthread.h"
 
 char debugger_command[2 * MAX_PATH + 20];
 
index ee40d16..e6765e8 100644 (file)
@@ -13,6 +13,8 @@ details. */
 #include <stdlib.h>
 #include <errno.h>
 #include <process.h>
+#include "fhandler.h"
+#include "path.h"
 
 /* This is called _execve and not execve because the real execve is defined
    in libc/posix/execve.c.  It calls us.  */
index 0d08011..1ecbf14 100644 (file)
@@ -11,6 +11,9 @@ Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 details. */
 
 #include "winsup.h"
+#include "fhandler.h"
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
 
 static external_pinfo *
index da73911..f4d1b44 100644 (file)
@@ -13,8 +13,10 @@ details. */
 #include <stdarg.h>
 #include <errno.h>
 #include <unistd.h>
+#include "fhandler.h"
 #include "dtable.h"
 #include "cygerrno.h"
+#include "thread.h"
 
 extern "C"
 int
index 4b62095..fb6065f 100644 (file)
@@ -15,6 +15,8 @@ details. */
 #include <stdlib.h>
 #include <string.h>
 #include "cygerrno.h"
+#include "fhandler.h"
+#include "path.h"
 
 static NO_COPY const int CHUNK_SIZE = 1024; /* Used for crlf conversions */
 
index 92e695b..38580d3 100644 (file)
@@ -22,8 +22,11 @@ details. */
 #include <wingdi.h>
 #include <winuser.h>
 #include <ctype.h>
-#include "pinfo.h"
 #include "cygerrno.h"
+#include "fhandler.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "pinfo.h"
 
 /*
  * Scroll the screen context.
index 44a15d8..ec48c91 100644 (file)
@@ -14,6 +14,7 @@ details. */
 #include <fcntl.h>
 #include <errno.h>
 #include <unistd.h>
+#include "fhandler.h"
 
 /**********************************************************************/
 /* fhandler_dev_floppy */
index 2c364b2..99d12c4 100644 (file)
@@ -14,6 +14,7 @@ details. */
 #include <errno.h>
 #include <limits.h>
 #include "cygerrno.h"
+#include "fhandler.h"
 
 #define RANDOM   8
 #define URANDOM  9
index 7a2e97b..49c2d02 100644 (file)
@@ -17,6 +17,8 @@
 #include <cygwin/rdevio.h>
 #include <sys/mtio.h>
 #include "cygerrno.h"
+#include "fhandler.h"
+#include "path.h"
 
 /* static wrapper functions to hide the effect of media changes and
    bus resets which occurs after a new media is inserted. This is
index 4511486..8ea4c9f 100644 (file)
@@ -13,8 +13,11 @@ details. */
 #include <errno.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include "pinfo.h"
 #include "cygerrno.h"
+#include "fhandler.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "pinfo.h"
 
 /**********************************************************************/
 /* fhandler_serial */
index 03dd485..43bbf0f 100644 (file)
@@ -17,6 +17,8 @@ details. */
 
 #include <sys/mtio.h>
 #include "cygerrno.h"
+#include "fhandler.h"
+#include "path.h"
 
 /**********************************************************************/
 /* fhandler_dev_tape */
index e154e29..49430a0 100644 (file)
@@ -14,8 +14,11 @@ details. */
 #include <unistd.h>
 #include <errno.h>
 #include <ctype.h>
-#include "pinfo.h"
 #include "cygerrno.h"
+#include "fhandler.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "pinfo.h"
 
 /* Common functions shared by tty/console */
 
index 1b0bb39..2e291ba 100644 (file)
@@ -16,9 +16,12 @@ details. */
 #include <errno.h>
 #include <ctype.h>
 #include <limits.h>
+#include "cygerrno.h"
+#include "fhandler.h"
 #include "dtable.h"
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
-#include "cygerrno.h"
 
 /* Tty master stuff */
 
index 5b1e285..f937d81 100644 (file)
@@ -16,6 +16,7 @@ details. */
 #include <wingdi.h>
 #include <winuser.h>
 #include "cygerrno.h"
+#include "fhandler.h"
 
 /*
 The following unix-style calls are supported:
index 9b4212c..4c74abc 100644 (file)
@@ -12,6 +12,7 @@ details. */
 
 #include "winsup.h"
 #include <errno.h>
+#include "fhandler.h"
 
 fhandler_dev_zero::fhandler_dev_zero (const char *name)
   : fhandler_base (FH_ZERO, name)
index d9bc5d9..f93d3a8 100644 (file)
@@ -16,9 +16,13 @@ details. */
 #include <stdarg.h>
 #include <errno.h>
 #include "dll_init.h"
+#include "fhandler.h"
 #include "dtable.h"
-#include "pinfo.h"
 #include "cygerrno.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "pinfo.h"
+#include "perthread.h"
 
 DWORD NO_COPY chunksize = 0;
 /* Timeout to wait for child to start, parent to init child, etc.  */
index 8e1171a..85d9aa8 100644 (file)
@@ -15,6 +15,9 @@ details. */
 #include <grp.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include "thread.h"
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
 
 /* Read /etc/group only once for better performance.  This is done
index fdc4367..6c05a5d 100644 (file)
@@ -10,8 +10,10 @@ details. */
 
 #include "winsup.h"
 #include <errno.h>
-#include "pinfo.h"
 #include "cygerrno.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "pinfo.h"
 
 #define brksize ((char *) user_data->heaptop - (char *) user_data->heapbase)
 #define brk (user_data->heapptr)
index 5b6e2aa..ddf4822 100644 (file)
@@ -10,6 +10,7 @@ details. */
 
 #include "winsup.h"
 #include <stdlib.h>
+#include "thread.h"
 
 extern HMODULE cygwin_hmodule;
 
index 860ad6e..5e198b8 100644 (file)
@@ -14,11 +14,11 @@ details. */
 #include "winsup.h"
 #include <sys/ioctl.h>
 #include <errno.h>
-#include "dtable.h"
 #include "cygerrno.h"
+#include "fhandler.h"
+#include "dtable.h"
 
-extern "C"
-int
+extern "C" int
 ioctl (int fd, int cmd, void *buf)
 {
   if (fdtab.not_open (fd))
index 22aa207..7e17fd9 100644 (file)
@@ -13,6 +13,7 @@ details. */
 
 #include "winsup.h"
 #include <stdlib.h>
+#include "sync.h"
 
 /* we provide these stubs to call into a user's
    provided malloc if there is one - otherwise
index 9afcd8c..bc2764c 100644 (file)
@@ -13,9 +13,13 @@ details. */
 #include <stddef.h>
 #include <sys/mman.h>
 #include <errno.h>
+#include "fhandler.h"
 #include "dtable.h"
-#include "pinfo.h"
 #include "cygerrno.h"
+#include "thread.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "pinfo.h"
 
 /*
  * Simple class used to keep a record of all current
index e8217b3..bcd8f8f 100644 (file)
@@ -23,9 +23,14 @@ details. */
 #include <fcntl.h>
 #include "autoload.h"
 #include <winsock.h>
+#include "cygerrno.h"
+#include "fhandler.h"
+#include "path.h"
 #include "dtable.h"
+#include "thread.h"
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
-#include "cygerrno.h"
 
 /* We only want to initialize WinSock in a child process if socket
    handles are inheritted. This global allows us to know whether this
index 8dfa330..a4ceda5 100644 (file)
@@ -13,9 +13,13 @@ details. */
 #include <pwd.h>
 #include <stdio.h>
 #include <errno.h>
+#include "cygerrno.h"
+#include "fhandler.h"
 #include "dtable.h"
+#include "thread.h"
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
-#include "cygerrno.h"
 
 /* Read /etc/passwd only once for better performance.  This is done
    on the first call that needs information from it. */
index 94da125..8fd0424 100644 (file)
@@ -81,8 +81,13 @@ details. */
 #include <errno.h>
 #include <ctype.h>
 #include <winioctl.h>
-#include "pinfo.h"
 #include "cygerrno.h"
+#include "fhandler.h"
+#include "path.h"
+#include "thread.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "pinfo.h"
 
 static int normalize_win32_path (const char *cwd, const char *src, char *dst);
 static char *getcwd_inner (char *buf, size_t ulen, int posix_p, int with_chroot);
index a2b647b..a436702 100644 (file)
@@ -108,6 +108,9 @@ int __stdcall get_device_number (const char *name, int &unit, BOOL from_conv = F
 int __stdcall slash_unc_prefix_p (const char *path);
 int __stdcall check_null_empty_path (const char *name);
 
+const char * __stdcall find_exec (const char *name, path_conv& buf, const char *winenv = "PATH=",
+                       int null_if_notfound = 0, const char **known_suffix = NULL);
+
 /* Common macros for checking for invalid path names */
 
 #define check_null_empty_path_errno(src) \
index fa6e1df..7d009e1 100644 (file)
@@ -35,3 +35,79 @@ set_reent (struct _reent *r)
   *base = PTMAGIC;
   base[-1] = (DWORD) r;
 }
+
+#define PER_THREAD_FORK_CLEAR ((void *)0xffffffff)
+class per_thread
+{
+  DWORD tls;
+  int clear_on_fork_p;
+public:
+  per_thread (int forkval = 1) {tls = TlsAlloc (); clear_on_fork_p = forkval;}
+  DWORD get_tls () {return tls;}
+  int clear_on_fork () {return clear_on_fork_p;}
+
+  virtual void *get () {return TlsGetValue (get_tls ());}
+  virtual size_t size () {return 0;}
+  virtual void set (void *s = NULL);
+  virtual void set (int n) {TlsSetValue (get_tls (), (void *)n);}
+  virtual void *create ()
+  {
+    void *s = new char [size ()];
+    memset (s, 0, size ());
+    set (s);
+    return s;
+  }
+};
+
+class per_thread_waitq : public per_thread
+{
+public:
+  per_thread_waitq () : per_thread (0) {}
+  void *get () {return (waitq *) this->per_thread::get ();}
+  void *create () {return (waitq *) this->per_thread::create ();}
+  size_t size () {return sizeof (waitq);}
+};
+
+struct vfork_save
+{
+  int pid;
+  jmp_buf j;
+  DWORD frame[100];
+  char **vfork_ebp;
+  char **vfork_esp;
+  int is_active () { return pid < 0; }
+};
+
+class per_thread_vfork : public per_thread
+{
+public:
+  vfork_save *val () { return (vfork_save *) this->per_thread::get (); }
+  vfork_save *create () {return (vfork_save *) this->per_thread::create ();}
+  size_t size () {return sizeof (vfork_save);}
+};
+
+extern "C" {
+struct signal_dispatch
+{
+  int arg;
+  void (*func) (int);
+  int sig;
+  int saved_errno;
+  DWORD oldmask;
+  DWORD retaddr;
+  DWORD *retaddr_on_stack;
+};
+};
+
+struct per_thread_signal_dispatch : public per_thread
+{
+  signal_dispatch *get () { return (signal_dispatch *) this->per_thread::get (); }
+  signal_dispatch *create () {return (signal_dispatch *) this->per_thread::create ();}
+  size_t size () {return sizeof (signal_dispatch);}
+};
+
+extern per_thread_waitq waitq_storage;
+extern per_thread_vfork vfork_storage;
+extern per_thread_signal_dispatch signal_dispatch_storage;
+
+extern per_thread *threadstuff[];
index 8316bd2..347015b 100644 (file)
@@ -13,9 +13,13 @@ details. */
 #include <time.h>
 #include <errno.h>
 #include <limits.h>
+#include "fhandler.h"
 #include "dtable.h"
-#include "pinfo.h"
 #include "cygerrno.h"
+#include "thread.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "pinfo.h"
 
 static char NO_COPY pinfo_dummy[sizeof(pinfo)] = {0};
 
index 87d4f3d..b8ee914 100644 (file)
@@ -11,6 +11,9 @@ enum
 };
 
 #define PSIZE 1024
+
+class ThreadItem;
+
 class _pinfo
 {
 public:
@@ -166,3 +169,4 @@ cygwin_pid (pid_t pid)
   return (pid_t) (os_being_run == winNT) ? pid : -(int) pid;
 }
 void __stdcall pinfo_init (PBYTE);
+extern pinfo myself;
index 091548a..fb354a4 100644 (file)
@@ -12,8 +12,10 @@ details. */
 #include <unistd.h>
 #include <sys/fcntl.h>
 #include <errno.h>
-#include "dtable.h"
 #include "cygerrno.h"
+#include "fhandler.h"
+#include "dtable.h"
+#include "thread.h"
 
 static int
 make_pipe (int fildes[2], unsigned int psize, int mode)
index 0ecf152..fc51be1 100644 (file)
@@ -11,6 +11,7 @@
 #include "winsup.h"
 #include <sys/poll.h>
 #include <errno.h>
+#include "fhandler.h"
 #include "dtable.h"
 #include "cygerrno.h"
 
index f535318..2a2287b 100644 (file)
@@ -11,6 +11,7 @@
    details. */
 
 #include "winsup.h"
+#include "thread.h"
 
 extern "C" {
 /*  ThreadCreation */
index 5a3241f..9ca1917 100644 (file)
@@ -14,8 +14,10 @@ details. */
 
 #include "winsup.h"
 #include <errno.h>
-#include "pinfo.h"
 #include "cygerrno.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "pinfo.h"
 
 /* add timeval values */
 static void
index 6766007..a8d5780 100644 (file)
@@ -22,9 +22,13 @@ details. */
 #include <sys/stat.h>
 #include <sys/acl.h>
 #include <ctype.h>
+#include "cygerrno.h"
+#include "fhandler.h"
+#include "path.h"
 #include "dtable.h"
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
-#include "cygerrno.h"
 
 extern BOOL allow_ntea;
 BOOL allow_ntsec = FALSE;
@@ -51,11 +55,11 @@ convert_sid_to_string_sid (PSID psid, char *sid_str)
   if (!psid || !sid_str)
     return NULL;
   strcpy (sid_str, "S-1-");
-  sprintf(t, "%u", GetSidIdentifierAuthority (psid)->Value[5]);
+  __small_sprintf(t, "%u", GetSidIdentifierAuthority (psid)->Value[5]);
   strcat (sid_str, t);
   for (i = 0; i < *GetSidSubAuthorityCount (psid); ++i)
     {
-      sprintf(t, "-%lu", *GetSidSubAuthority (psid, i));
+      __small_sprintf(t, "-%lu", *GetSidSubAuthority (psid, i));
       strcat (sid_str, t);
     }
   return sid_str;
@@ -2005,27 +2009,27 @@ acltotext (aclent_t *aclbufp, int aclcnt)
       switch (aclbufp[pos].a_type)
         {
         case USER_OBJ:
-          sprintf (buf + strlen (buf), "user::%s",
+          __small_sprintf (buf + strlen (buf), "user::%s",
                    permtostr (aclbufp[pos].a_perm));
           break;
         case USER:
-          sprintf (buf + strlen (buf), "user:%d:%s",
+          __small_sprintf (buf + strlen (buf), "user:%d:%s",
                    aclbufp[pos].a_id, permtostr (aclbufp[pos].a_perm));
           break;
         case GROUP_OBJ:
-          sprintf (buf + strlen (buf), "group::%s",
+          __small_sprintf (buf + strlen (buf), "group::%s",
                    permtostr (aclbufp[pos].a_perm));
           break;
         case GROUP:
-          sprintf (buf + strlen (buf), "group:%d:%s",
+          __small_sprintf (buf + strlen (buf), "group:%d:%s",
                    aclbufp[pos].a_id, permtostr (aclbufp[pos].a_perm));
           break;
         case CLASS_OBJ:
-          sprintf (buf + strlen (buf), "mask::%s",
+          __small_sprintf (buf + strlen (buf), "mask::%s",
                    permtostr (aclbufp[pos].a_perm));
           break;
         case OTHER_OBJ:
-          sprintf (buf + strlen (buf), "other::%s",
+          __small_sprintf (buf + strlen (buf), "other::%s",
                    permtostr (aclbufp[pos].a_perm));
           break;
         default:
index 5f427d4..99c321b 100644 (file)
@@ -33,8 +33,12 @@ details. */
 #include <stdio.h>
 #include <winsock.h>
 #include "select.h"
-#include "dtable.h"
 #include "cygerrno.h"
+#include "fhandler.h"
+#include "dtable.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "perthread.h"
 
 /*
  * All these defines below should be in sys/types.h
index e44c725..2010d18 100644 (file)
@@ -14,6 +14,8 @@ details. */
 #include <stdlib.h>
 #include <grp.h>
 #include <pwd.h>
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
 
 #define SHAREDVER (unsigned)(cygwin_version.api_major << 16 | \
index 851bad4..2a8e9a6 100644 (file)
@@ -86,9 +86,6 @@ void __stdcall init_child_info (DWORD, child_info *, int, HANDLE);
 
 extern child_info_fork *child_proc_info;
 
-/* Process info for this process */
-extern pinfo myself;
-
 /* non-NULL if this process is a child of a cygwin process */
 extern HANDLE parent_alive;
 
index 94cd2cf..2927712 100644 (file)
@@ -13,8 +13,10 @@ details. */
 
 #include "winsup.h"
 #include <errno.h>
-#include "pinfo.h"
 #include "cygerrno.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "pinfo.h"
 
 extern "C"
 _sig_func_ptr
index a1d9ad3..45b6d20 100644 (file)
@@ -16,8 +16,11 @@ details. */
 #include <sys/wait.h>
 #include <errno.h>
 #include <stdlib.h>
-#include "pinfo.h"
 #include "cygerrno.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "pinfo.h"
+#include "perthread.h"
 
 extern BOOL allow_ntsec;
 
index 683e1d9..9e1c3fb 100644 (file)
@@ -32,8 +32,6 @@ typedef struct struct_waitq
   HANDLE thread_ev;
 } waitq;
 
-class muto;
-
 struct sigthread
 {
   DWORD id;
index 4095727..940f8d1 100644 (file)
@@ -20,9 +20,14 @@ details. */
 #include <winuser.h>
 #include <ctype.h>
 #include <paths.h>
+#include "cygerrno.h"
+#include "fhandler.h"
+#include "path.h"
 #include "dtable.h"
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
-#include "cygerrno.h"
+#include "perthread.h"
 
 extern BOOL allow_ntsec;
 
index 457cd22..5cba5d0 100644 (file)
@@ -14,6 +14,8 @@ details. */
 #include <wingdi.h>
 #include <winuser.h>
 #include <ctype.h>
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
 
 #define PROTECT(x) x[sizeof(x)-1] = 0
index 70f7985..f5c2159 100644 (file)
@@ -20,6 +20,7 @@ details. */
 #include <sys/wait.h>
 #include <errno.h>
 #include <stdlib.h>
+#include "sync.h"
 
 muto NO_COPY muto_start;
 
index 114b768..92a53a4 100644 (file)
@@ -24,9 +24,14 @@ details. */
 #include <unistd.h>
 #include <winnls.h>
 #include <lmcons.h> /* for UNLEN */
+#include "cygerrno.h"
+#include "fhandler.h"
+#include "path.h"
 #include "dtable.h"
+#include "thread.h"
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
-#include "cygerrno.h"
 
 extern BOOL allow_ntsec;
 
index 25f8370..a6383dc 100644 (file)
@@ -13,6 +13,7 @@ details. */
 #include <errno.h>
 #include <time.h>
 #include <limits.h>
+#include "fhandler.h"
 #include "dtable.h"
 #include "cygerrno.h"
 
index 3a79269..48b0d66 100644 (file)
@@ -14,8 +14,10 @@ details. */
 #include <syslog.h>
 #include <stdarg.h>
 #include <unistd.h>
+#include "fhandler.h"
 #include "dtable.h"
 #include "cygerrno.h"
+#include "thread.h"
 
 /* FIXME: These should probably be in the registry. */
 /* FIXME: The Win95 path should be whatever slash is */
index 5eb5ddb..e30bb60 100644 (file)
@@ -13,8 +13,9 @@ details. */
 
 #include "winsup.h"
 #include <errno.h>
-#include "dtable.h"
 #include "cygerrno.h"
+#include "fhandler.h"
+#include "dtable.h"
 
 /* tcsendbreak: POSIX 7.2.2.1 */
 extern "C"
index 6f40a68..da3b0da 100644 (file)
@@ -20,6 +20,9 @@ details. */
 #include <assert.h>
 #include <stdlib.h>
 #include <syslog.h>
+#include "thread.h"
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
 
 extern int threadsafe;
index e16d3ce..aed02dc 100644 (file)
@@ -43,9 +43,8 @@ extern "C"
 #include <pthread.h>
 #include <pwd.h>
 #include <grp.h>
-#include <stdio.h>
+#define _NOMNTENT_FUNCS
 #include <mntent.h>
-#include <time.h>
 
 extern "C" {
 
index bd7286d..b34d510 100644 (file)
@@ -16,8 +16,13 @@ details. */
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
-#include "pinfo.h"
 #include "cygerrno.h"
+#include "fhandler.h"
+#include "path.h"
+#include "thread.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "pinfo.h"
 
 #define FACTOR (0x19db1ded53ea710LL)
 #define NSPERSEC 10000000LL
index 015cce6..16fe39a 100644 (file)
@@ -14,9 +14,12 @@ details. */
 #include <utmp.h>
 #include <wingdi.h>
 #include <winuser.h>
+#include "cygerrno.h"
+#include "fhandler.h"
 #include "dtable.h"
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
-#include "cygerrno.h"
 
 extern fhandler_tty_master *tty_master;
 
index a9cb227..fc3f8bf 100644 (file)
@@ -18,6 +18,9 @@ details. */
 #include <stdlib.h>
 #include <wchar.h>
 #include <lm.h>
+#include "thread.h"
+#include "sync.h"
+#include "sigproc.h"
 #include "pinfo.h"
 
 char *
index 62d4112..4ad5afd 100644 (file)
@@ -13,6 +13,9 @@ details. */
 #include <stdlib.h>
 #include <errno.h>
 #include "cygerrno.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "perthread.h"
 
 /* This is called _wait and not wait because the real wait is defined
    in libc/syscalls/syswait.c.  It calls us.  */
index db30441..be151e7 100644 (file)
@@ -107,17 +107,12 @@ extern int dynamically_loaded;
 #define __CONDSETF(n, what, x, prefix) \
   ((n) ? __SETF (what, x, prefix) : __CLEARF (what, x, prefix))
 
-#include "thread.h"
 #include "shared.h"
 
 extern HANDLE hMainThread;
 extern HANDLE hMainProc;
 
 #include "debug.h"
-#include "sync.h"
-#include "sigproc.h"
-#include "fhandler.h"
-#include "path.h"
 #include <sys/cygwin.h>
 
 /********************** Application Interface **************************/
@@ -155,84 +150,6 @@ extern host_dependent_constants host_dependent;
 /* Events/mutexes */
 extern HANDLE title_mutex;
 
-/*************************** Per Thread ******************************/
-
-#define PER_THREAD_FORK_CLEAR ((void *)0xffffffff)
-class per_thread
-{
-  DWORD tls;
-  int clear_on_fork_p;
-public:
-  per_thread (int forkval = 1) {tls = TlsAlloc (); clear_on_fork_p = forkval;}
-  DWORD get_tls () {return tls;}
-  int clear_on_fork () {return clear_on_fork_p;}
-
-  virtual void *get () {return TlsGetValue (get_tls ());}
-  virtual size_t size () {return 0;}
-  virtual void set (void *s = NULL);
-  virtual void set (int n) {TlsSetValue (get_tls (), (void *)n);}
-  virtual void *create ()
-  {
-    void *s = new char [size ()];
-    memset (s, 0, size ());
-    set (s);
-    return s;
-  }
-};
-
-class per_thread_waitq : public per_thread
-{
-public:
-  per_thread_waitq () : per_thread (0) {}
-  void *get () {return (waitq *) this->per_thread::get ();}
-  void *create () {return (waitq *) this->per_thread::create ();}
-  size_t size () {return sizeof (waitq);}
-};
-
-struct vfork_save
-{
-  int pid;
-  jmp_buf j;
-  DWORD frame[100];
-  char **vfork_ebp;
-  char **vfork_esp;
-  int is_active () { return pid < 0; }
-};
-
-class per_thread_vfork : public per_thread
-{
-public:
-  vfork_save *val () { return (vfork_save *) this->per_thread::get (); }
-  vfork_save *create () {return (vfork_save *) this->per_thread::create ();}
-  size_t size () {return sizeof (vfork_save);}
-};
-
-extern "C" {
-struct signal_dispatch
-{
-  int arg;
-  void (*func) (int);
-  int sig;
-  int saved_errno;
-  DWORD oldmask;
-  DWORD retaddr;
-  DWORD *retaddr_on_stack;
-};
-};
-
-struct per_thread_signal_dispatch : public per_thread
-{
-  signal_dispatch *get () { return (signal_dispatch *) this->per_thread::get (); }
-  signal_dispatch *create () {return (signal_dispatch *) this->per_thread::create ();}
-  size_t size () {return sizeof (signal_dispatch);}
-};
-
-extern per_thread_waitq waitq_storage;
-extern per_thread_vfork vfork_storage;
-extern per_thread_signal_dispatch signal_dispatch_storage;
-
-extern per_thread *threadstuff[];
-
 /**************************** Convenience ******************************/
 
 #define NO_COPY __attribute__((section(".data_cygwin_nocopy")))
@@ -316,9 +233,6 @@ extern int cygwin_finished_initializing;
 
 /**************************** Miscellaneous ******************************/
 
-const char * __stdcall find_exec (const char *name, path_conv& buf, const char *winenv = "PATH=",
-                       int null_if_notfound = 0, const char **known_suffix = NULL);
-
 /* File manipulation */
 int __stdcall set_process_privileges ();
 int __stdcall get_file_attribute (int, const char *, int *,
@@ -349,6 +263,7 @@ extern "C" int _spawnve (HANDLE hToken, int mode, const char *path,
 
 extern void __stdcall exec_fixup_after_fork ();
 
+class _pinfo;
 /* For mmaps across fork(). */
 int __stdcall recreate_mmaps_after_fork (void *);
 void __stdcall set_child_mmap_ptr (_pinfo *);