OSDN Git Service

Break out more header info into separate files. Use appropriate header files
authorcgf <cgf>
Fri, 8 Sep 2000 02:56:54 +0000 (02:56 +0000)
committercgf <cgf>
Fri, 8 Sep 2000 02:56:54 +0000 (02:56 +0000)
throughout.
* shared.h: Remove.
* cygwin_version.h: New file.
* delqueue.h: New file.
* environ.h: New file.
* host_dependent.h: New file.
* perprocess.h: New file.
* registry.h: New file.
* security.h: New file.

63 files changed:
winsup/cygwin/ChangeLog
winsup/cygwin/assert.cc
winsup/cygwin/child_info.h
winsup/cygwin/cygwin_version.h [new file with mode: 0644]
winsup/cygwin/dcrt0.cc
winsup/cygwin/debug.cc
winsup/cygwin/delqueue.cc
winsup/cygwin/delqueue.h [new file with mode: 0644]
winsup/cygwin/dir.cc
winsup/cygwin/dlfcn.cc
winsup/cygwin/dll_init.cc
winsup/cygwin/dtable.cc
winsup/cygwin/dtable.h
winsup/cygwin/environ.cc
winsup/cygwin/environ.h [new file with mode: 0644]
winsup/cygwin/exceptions.cc
winsup/cygwin/exec.cc
winsup/cygwin/external.cc
winsup/cygwin/fhandler.cc
winsup/cygwin/fhandler.h
winsup/cygwin/fhandler_console.cc
winsup/cygwin/fhandler_serial.cc
winsup/cygwin/fhandler_tty.cc
winsup/cygwin/fork.cc
winsup/cygwin/heap.cc
winsup/cygwin/heap.h
winsup/cygwin/host_dependent.h [new file with mode: 0644]
winsup/cygwin/init.cc
winsup/cygwin/malloc_wrapper.cc
winsup/cygwin/mkvers.sh
winsup/cygwin/mmap.cc
winsup/cygwin/net.cc
winsup/cygwin/ntea.cc
winsup/cygwin/path.cc
winsup/cygwin/path.h
winsup/cygwin/perprocess.h [new file with mode: 0644]
winsup/cygwin/perthread.h
winsup/cygwin/pinfo.cc
winsup/cygwin/pinfo.h
winsup/cygwin/pipe.cc
winsup/cygwin/poll.cc
winsup/cygwin/registry.cc
winsup/cygwin/registry.h [new file with mode: 0644]
winsup/cygwin/security.cc
winsup/cygwin/security.h [new file with mode: 0644]
winsup/cygwin/shared.cc
winsup/cygwin/shared.h [deleted file]
winsup/cygwin/shared_info.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/termios.cc
winsup/cygwin/thread.cc
winsup/cygwin/times.cc
winsup/cygwin/tty.cc
winsup/cygwin/uinfo.cc
winsup/cygwin/uname.cc
winsup/cygwin/window.cc
winsup/cygwin/winsup.h

index dacf7aa..9154876 100644 (file)
@@ -1,3 +1,16 @@
+Thu Sep  7 22:45:16 2000  Christopher Faylor <cgf@cygnus.com>
+
+       Break out more header info into separate files.  Use appropriate
+       header files throughout.
+       * shared.h: Remove.
+       * cygwin_version.h: New file.
+       * delqueue.h: New file.
+       * environ.h: New file.
+       * host_dependent.h: New file.
+       * perprocess.h: New file.
+       * registry.h: New file.
+       * security.h: New file.
+
 Thu Sep  7 12:14:43 2000  Christopher Faylor <cgf@cygnus.com>
 
        Split out tty and shared_info stuff into their own headers and use
index 5e1c0b8..68a5934 100644 (file)
@@ -9,6 +9,7 @@ Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 details. */
 
 #include "winsup.h"
+#include "security.h"
 #include <wingdi.h>
 #include <winuser.h>
 
index 29e44af..8e76ca3 100644 (file)
@@ -8,6 +8,8 @@ This software is a copyrighted work licensed under the terms of the
 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 details. */
 
+#include <setjmp.h>
+
 enum
 {
   PROC_MAGIC = 0xaf08f000,
diff --git a/winsup/cygwin/cygwin_version.h b/winsup/cygwin/cygwin_version.h
new file mode 100644 (file)
index 0000000..e6d7758
--- /dev/null
@@ -0,0 +1,31 @@
+/* cygwin_version.h: shared info for cygwin
+
+   Copyright 2000 Cygnus Solutions.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#include <cygwin/version.h>
+
+extern "C" {
+/* This is for programs that want to access the shared data. */
+class shared_info *cygwin_getshared (void);
+
+struct cygwin_version_info
+{
+  unsigned short api_major;
+  unsigned short api_minor;
+  unsigned short dll_major;
+  unsigned short dll_minor;
+  unsigned short shared_data;
+  unsigned short mount_registry;
+  const char *dll_build_date;
+  char shared_id[sizeof (CYGWIN_VERSION_DLL_IDENTIFIER) + 64];
+};
+
+extern cygwin_version_info cygwin_version;
+extern const char *cygwin_version_strings;
+}
index 4121d89..cc48d73 100644 (file)
@@ -13,23 +13,27 @@ details. */
 #include <stdlib.h>
 #include "glob.h"
 #include "exceptions.h"
-#include "dll_init.h"
 #include "autoload.h"
 #include <ctype.h>
 #include "sync.h"
 #include "sigproc.h"
-#include "perthread.h"
 #include "pinfo.h"
 #include "cygheap.h"
 #include "heap.h"
 #include "cygerrno.h"
 #include "fhandler.h"
 #include "child_info.h"
+#define NEED_VFORK
+#include "perthread.h"
 #include "path.h"
 #include "dtable.h"
 #include "thread.h"
-#include "tty.h"
 #include "shared_info.h"
+#include "cygwin_version.h"
+#include "perprocess.h"
+#include "dll_init.h"
+#include "host_dependent.h"
+#include "security.h"
 
 #define MAX_AT_FILE_LEVEL 10
 
index e635c69..f89b21a 100644 (file)
@@ -12,6 +12,8 @@ details. */
 #include "sigproc.h"
 #include "pinfo.h"
 #include "perthread.h"
+#include "perprocess.h"
+#include "security.h"
 
 #undef CloseHandle
 
index a08b24a..3073d02 100644 (file)
@@ -9,6 +9,7 @@ Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 details. */
 
 #include "winsup.h"
+#include "shared_info.h"
 
 /* FIXME: this delqueue module is very flawed and should be rewritten.
        First, having an array of a fixed size for keeping track of the
diff --git a/winsup/cygwin/delqueue.h b/winsup/cygwin/delqueue.h
new file mode 100644 (file)
index 0000000..f306e7f
--- /dev/null
@@ -0,0 +1,30 @@
+/* delqueue.h: shared info for cygwin
+
+   Copyright 2000 Cygnus Solutions.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+/* First pass at a file deletion queue structure.
+
+   We can't keep this list in the per-process info, since
+   one process may open a file, and outlive a process which
+   wanted to unlink the file - and the data would go away.
+*/
+
+#define MAX_DELQUEUES_PENDING 100
+
+class delqueue_list
+{
+  char name[MAX_DELQUEUES_PENDING][MAX_PATH];
+  char inuse[MAX_DELQUEUES_PENDING];
+  int empty;
+
+public:
+  void init ();
+  void queue_file (const char *dosname);
+  void process_queue ();
+};
index 350fbce..d73eeac 100644 (file)
@@ -23,6 +23,7 @@ details. */
 #include "cygerrno.h"
 #include "fhandler.h"
 #include "path.h"
+#include "security.h"
 
 /* Cygwin internal */
 /* Return whether the directory of a file is writable.  Return 1 if it
index 4484154..a853513 100644 (file)
@@ -13,11 +13,12 @@ details. */
 #include <stdlib.h>
 #include <unistd.h>
 #include <ctype.h>
-#include "dlfcn.h"
-#include "dll_init.h"
 #include "fhandler.h"
 #include "path.h"
 #include "thread.h"
+#include "perprocess.h"
+#include "dlfcn.h"
+#include "dll_init.h"
 
 #define _dl_error _reent_winsup()->_dl_error
 #define _dl_buffer _reent_winsup()->_dl_buffer
index 7e94fa9..6a713fa 100644 (file)
@@ -9,8 +9,10 @@ details. */
 #include "winsup.h"
 #include <stdlib.h>
 #include "exceptions.h"
-#include "dll_init.h"
 #include "cygerrno.h"
+#include "perprocess.h"
+#include "dll_init.h"
+#include "environ.h"
 
 extern void __stdcall check_sanity_and_sync (per_process *);
 
index affac33..9e7b3c5 100644 (file)
@@ -18,6 +18,7 @@ details. */
 #include <stdio.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <sys/cygwin.h>
 
 #include <winsock.h>
 #include "sync.h"
index db57c6b..85963fc 100644 (file)
@@ -8,6 +8,9 @@ This software is a copyrighted work licensed under the terms of the
 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 details. */
 
+/* Initial and increment values for cygwin's fd table */
+#define NOFILE_INCR    32
+
 class dtable
 {
   fhandler_base **fds;
@@ -41,3 +44,6 @@ public:
 void dtable_init (void);
 void stdio_init (void);
 extern dtable fdtab;
+
+extern "C" int getfdtabsize ();
+extern "C" void setfdtabsize (int);
index 2cc8080..9c7b72c 100644 (file)
@@ -13,6 +13,8 @@ details. */
 #include <stddef.h>
 #include <ctype.h>
 #include <fcntl.h>
+#include <sys/cygwin.h>
+#include <cygwin/version.h>
 #include "sync.h"
 #include "sigproc.h"
 #include "pinfo.h"
@@ -20,6 +22,8 @@ details. */
 #include "path.h"
 #include "cygerrno.h"
 #include "cygheap.h"
+#include "registry.h"
+#include "environ.h"
 
 extern BOOL allow_glob;
 extern BOOL allow_ntea;
diff --git a/winsup/cygwin/environ.h b/winsup/cygwin/environ.h
new file mode 100644 (file)
index 0000000..e5967eb
--- /dev/null
@@ -0,0 +1,40 @@
+/* environ.h: Declarations for environ manipulation
+
+   Copyright 2000 Red Hat, Inc.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+/* Initialize the environment */
+void environ_init (char **);
+
+/* The structure below is used to control conversion to/from posix-style
+ * file specs.  Currently, only PATH and HOME are converted, but PATH
+ * needs to use a "convert path list" function while HOME needs a simple
+ * "convert to posix/win32".  For the simple case, where a calculated length
+ * is required, just return MAX_PATH.  *FIXME*
+ */
+struct win_env
+  {
+    const char *name;
+    size_t namelen;
+    char *posix;
+    char *native;
+    int (*toposix) (const char *, char *);
+    int (*towin32) (const char *, char *);
+    int (*posix_len) (const char *);
+    int (*win32_len) (const char *);
+    void add_cache (const char *in_posix, const char *in_native = NULL);
+    const char * get_native () {return native ? native + namelen : NULL;}
+  };
+
+win_env * __stdcall getwinenv (const char *name, const char *posix = NULL);
+
+void __stdcall update_envptrs ();
+char * __stdcall winenv (const char * const *, int);
+extern char **__cygwin_environ, ***main_environ;
+extern "C" char __stdcall **cur_environ ();
+int __stdcall envsize (const char * const *, int debug_print = 0);
index 8b133cc..16b8450 100644 (file)
@@ -20,8 +20,9 @@ details. */
 #include "cygerrno.h"
 #include "thread.h"
 #include "perthread.h"
-#include "tty.h"
 #include "shared_info.h"
+#include "perprocess.h"
+#include "security.h"
 
 char debugger_command[2 * MAX_PATH + 20];
 
index 76a9807..6438d16 100644 (file)
@@ -15,6 +15,10 @@ details. */
 #include <process.h>
 #include "fhandler.h"
 #include "path.h"
+#include "sync.h"
+#include "sigproc.h"
+#include "pinfo.h"
+#include "environ.h"
 
 /* This is called _execve and not execve because the real execve is defined
    in libc/posix/execve.c.  It calls us.  */
index 64a3acf..74b1069 100644 (file)
@@ -16,8 +16,9 @@ details. */
 #include "sigproc.h"
 #include "pinfo.h"
 #include <exceptions.h>
-#include "tty.h"
 #include "shared_info.h"
+#include "cygwin_version.h"
+#include "perprocess.h"
 
 static external_pinfo *
 fillout_pinfo (pid_t pid, int winpid)
index e5a903c..7307e88 100644 (file)
@@ -15,11 +15,15 @@ details. */
 #include <stdlib.h>
 #include "cygheap.h"
 #include <string.h>
+#include <sys/cygwin.h>
+#include <signal.h>
 #include "cygerrno.h"
 #include "fhandler.h"
 #include "path.h"
-#include "tty.h"
 #include "shared_info.h"
+#include "host_dependent.h"
+#include "perprocess.h"
+#include "security.h"
 
 static NO_COPY const int CHUNK_SIZE = 1024; /* Used for crlf conversions */
 
index b256658..df9153e 100644 (file)
@@ -842,5 +842,6 @@ public:
 
 uid_t __stdcall get_file_owner (int, const char *);
 gid_t __stdcall get_file_group (int, const char *);
+int __stdcall set_console_state_for_spawn ();
 
 #endif /* _FHANDLER_H_ */
index ff70bb4..dc76df4 100644 (file)
@@ -19,13 +19,14 @@ details. */
 #include <winuser.h>
 #include <wincon.h>
 #include <ctype.h>
+#include <sys/cygwin.h>
 #include "cygerrno.h"
 #include "fhandler.h"
 #include "sync.h"
 #include "sigproc.h"
 #include "pinfo.h"
-#include "tty.h"
 #include "shared_info.h"
+#include "security.h"
 
 /*
  * Scroll the screen context.
index 1f31cd6..c1e472b 100644 (file)
@@ -18,6 +18,7 @@ details. */
 #include "sync.h"
 #include "sigproc.h"
 #include "pinfo.h"
+#include "security.h"
 #include <sys/termios.h>
 
 /**********************************************************************/
index c78f2ba..9961182 100644 (file)
@@ -23,7 +23,6 @@ details. */
 #include "sigproc.h"
 #include "pinfo.h"
 #include "cygheap.h"
-#include "tty.h"
 #include "shared_info.h"
 
 /* Tty master stuff */
index 6be5e3a..02b784a 100644 (file)
@@ -15,7 +15,6 @@ details. */
 #include <fcntl.h>
 #include <stdarg.h>
 #include <errno.h>
-#include "dll_init.h"
 #include "fhandler.h"
 #include "dtable.h"
 #include "cygerrno.h"
@@ -24,7 +23,11 @@ details. */
 #include "pinfo.h"
 #include "cygheap.h"
 #include "child_info.h"
+#define NEED_VFORK
 #include "perthread.h"
+#include "perprocess.h"
+#include "dll_init.h"
+#include "security.h"
 
 DWORD NO_COPY chunksize = 0;
 /* Timeout to wait for child to start, parent to init child, etc.  */
index 1ad80a2..dc2e6e9 100644 (file)
@@ -15,7 +15,6 @@ details. */
 #include "sigproc.h"
 #include "pinfo.h"
 #include "heap.h"
-#include "tty.h"
 #include "shared_info.h"
 
 #define assert(x)
index 080b415..110e037 100644 (file)
@@ -8,6 +8,8 @@ This software is a copyrighted work licensed under the terms of the
 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 details. */
 
+#include "perprocess.h"
+
 /* Heap management. */
 void heap_init (void);
 void malloc_init (void);
diff --git a/winsup/cygwin/host_dependent.h b/winsup/cygwin/host_dependent.h
new file mode 100644 (file)
index 0000000..94e1546
--- /dev/null
@@ -0,0 +1,30 @@
+/* host_dependent.h: host dependent Cygwin header file.
+
+   Copyright 2000 Red Hat, Inc.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+/* Portions of the cygwin DLL require special constants whose values
+   are dependent on the host system.  Rather than dynamically
+   determine those values whenever they are required, initialize these
+   values once at process start-up. */
+
+class host_dependent_constants
+{
+ public:
+  void init (void);
+
+  /* Used by fhandler_disk_file::lock which needs a platform-specific
+     upper word value for locking entire files. */
+  DWORD win32_upper;
+
+  /* fhandler_base::open requires host dependent file sharing
+     attributes. */
+  int shared;
+};
+
+extern host_dependent_constants host_dependent;
index f0c5a1c..1f169e9 100644 (file)
@@ -11,6 +11,7 @@ details. */
 #include "winsup.h"
 #include <stdlib.h>
 #include "thread.h"
+#include "perprocess.h"
 
 extern HMODULE cygwin_hmodule;
 
index 2e10cdd..ad117eb 100644 (file)
@@ -17,6 +17,7 @@ details. */
 #include "cygheap.h"
 #include "heap.h"
 #include "sync.h"
+#include "perprocess.h"
 
 /* we provide these stubs to call into a user's
    provided malloc if there is one - otherwise
index d111c2c..47cfb27 100644 (file)
@@ -62,7 +62,7 @@ set -$- ''
 # Output the initial part of version.cc
 #
 cat <<EOF 1>&9
-#include <winsup.h>
+#include "cygwin_version.h"
 
 #define strval(x) #x
 #define str(x) strval(x)
index 158b538..cb86a84 100644 (file)
@@ -20,6 +20,7 @@ details. */
 #include "sync.h"
 #include "sigproc.h"
 #include "pinfo.h"
+#include "security.h"
 
 /*
  * Simple class used to keep a record of all current
index 4f1a8a0..f140bdc 100644 (file)
@@ -31,6 +31,7 @@ details. */
 #include "sync.h"
 #include "sigproc.h"
 #include "pinfo.h"
+#include "registry.h"
 
 /* We only want to initialize WinSock in a child process if socket
    handles are inheritted. This global allows us to know whether this
@@ -76,7 +77,6 @@ extern "C"
 unsigned long int
 htonl (unsigned long int x)
 {
-  MARK ();
   return ((((x & 0x000000ffU) << 24) |
           ((x & 0x0000ff00U) <<  8) |
           ((x & 0x00ff0000U) >>  8) |
@@ -96,7 +96,6 @@ extern "C"
 unsigned short
 htons (unsigned short x)
 {
-  MARK ();
   return ((((x & 0x000000ffU) << 8) |
           ((x & 0x0000ff00U) >> 8)));
 }
index cf0a159..2c9df4c 100644 (file)
@@ -10,9 +10,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 "winsup.h"
 #include <stdio.h>
 #include <stdlib.h>
+#include "security.h"
 
 /* Default to not using NTEA information */
 BOOL allow_ntea = FALSE;
index 307ab62..a6025b0 100644 (file)
@@ -57,6 +57,8 @@ details. */
 #include <errno.h>
 #include <ctype.h>
 #include <winioctl.h>
+#include <sys/cygwin.h>
+#include <cygwin/version.h>
 #include "cygerrno.h"
 #include "fhandler.h"
 #include "path.h"
@@ -65,8 +67,9 @@ details. */
 #include "sigproc.h"
 #include "pinfo.h"
 #include "cygheap.h"
-#include "tty.h"
 #include "shared_info.h"
+#include "registry.h"
+#include "security.h"
 
 static int normalize_win32_path (const char *src, char *dst);
 static void slashify (const char *src, char *dst, int trailing_slash_p);
index 9143b41..01c9657 100644 (file)
@@ -1,6 +1,6 @@
 /* path.h: path data structures
 
-   Copyright 1996, 1997, 1998, 2000 Cygnus Solutions.
+   Copyright 1996, 1997, 1998, 2000 Red Hat, Inc.
 
 This file is part of Cygwin.
 
diff --git a/winsup/cygwin/perprocess.h b/winsup/cygwin/perprocess.h
new file mode 100644 (file)
index 0000000..a649ece
--- /dev/null
@@ -0,0 +1,20 @@
+/* per_process.h: main Cygwin header file.
+
+   Copyright 2000 Red Hat, Inc.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#include <sys/cygwin.h>
+
+/* Pointer into application's static data */
+extern "C" per_process __cygwin_user_data;
+#define user_data (&__cygwin_user_data)
+
+/* We use the following to test that sizeof hasn't changed.  When adding
+   or deleting members, insert fillers or use the reserved entries.
+   Do not change this value. */
+#define SIZEOF_PER_PROCESS (42 * 4)
index 7d009e1..f4c82c0 100644 (file)
@@ -68,6 +68,7 @@ public:
   size_t size () {return sizeof (waitq);}
 };
 
+#ifdef NEED_VFORK
 struct vfork_save
 {
   int pid;
@@ -85,6 +86,8 @@ public:
   vfork_save *create () {return (vfork_save *) this->per_thread::create ();}
   size_t size () {return sizeof (vfork_save);}
 };
+extern per_thread_vfork vfork_storage;
+#endif
 
 extern "C" {
 struct signal_dispatch
@@ -107,7 +110,6 @@ struct per_thread_signal_dispatch : public per_thread
 };
 
 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 37a2808..f7c233d 100644 (file)
@@ -20,6 +20,10 @@ details. */
 #include "sync.h"
 #include "sigproc.h"
 #include "pinfo.h"
+#include "cygwin_version.h"
+#include "perprocess.h"
+#include "environ.h"
+#include "security.h"
 
 static char NO_COPY pinfo_dummy[sizeof(pinfo)] = {0};
 
index 891fd42..13eaa1d 100644 (file)
@@ -1,4 +1,12 @@
-/******** Process Table ********/
+/* pinfo.h: process table info
+
+   Copyright 2000 Cygnus Solutions.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
+details. */
 
 /* Signal constants (have to define them here, unfortunately) */
 
@@ -13,6 +21,7 @@ enum
 #define PSIZE 1024
 
 class ThreadItem;
+#include <sys/resource.h>
 
 class _pinfo
 {
@@ -166,3 +175,16 @@ cygwin_pid (pid_t pid)
 void __stdcall pinfo_init (char **);
 void __stdcall set_myself (pid_t pid, HANDLE h = NULL);
 extern pinfo myself;
+
+#define _P_VFORK 0
+extern "C" int _spawnve (HANDLE hToken, int mode, const char *path,
+                        const char *const *argv, const char *const *envp);
+
+extern void __stdcall exec_fixup_after_fork ();
+
+/* For mmaps across fork(). */
+int __stdcall recreate_mmaps_after_fork (void *);
+void __stdcall set_child_mmap_ptr (_pinfo *);
+
+void __stdcall fill_rusage (struct rusage *, HANDLE);
+void __stdcall add_rusage (struct rusage *, struct rusage *);
index 3a103e1..2de4991 100644 (file)
@@ -16,6 +16,7 @@ details. */
 #include "fhandler.h"
 #include "dtable.h"
 #include "thread.h"
+#include "security.h"
 
 static int
 make_pipe (int fildes[2], unsigned int psize, int mode)
index 91cdc2a..d55b2af 100644 (file)
@@ -9,6 +9,7 @@
    details. */
 
 #include "winsup.h"
+#include <sys/time.h>
 #include <sys/poll.h>
 #include <errno.h>
 #include "fhandler.h"
index 82acc69..70a96f6 100644 (file)
@@ -9,8 +9,10 @@ Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 details. */
 
 #include "winsup.h"
-#include "tty.h"
 #include "shared_info.h"
+#include "registry.h"
+#include "security.h"
+#include <cygwin/version.h>
 
 char cygnus_class[] = "cygnus";
 
diff --git a/winsup/cygwin/registry.h b/winsup/cygwin/registry.h
new file mode 100644 (file)
index 0000000..7e21245
--- /dev/null
@@ -0,0 +1,43 @@
+/* registry.h: shared info for cygwin
+
+   Copyright 2000 Cygnus Solutions.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+class reg_key
+{
+private:
+
+  HKEY key;
+  LONG key_is_invalid;
+
+public:
+
+  reg_key (HKEY toplev, REGSAM access, ...);
+  reg_key (REGSAM access, ...);
+  reg_key (REGSAM access = KEY_ALL_ACCESS);
+
+  void *operator new (size_t, void *p) {return p;}
+  void build_reg (HKEY key, REGSAM access, va_list av);
+
+  int error () {return key == (HKEY) INVALID_HANDLE_VALUE;}
+
+  int kill (const char *child);
+  int killvalue (const char *name);
+
+  HKEY get_key ();
+  int get_int (const char *,int def);
+  int get_string (const char *, char *buf, size_t len, const char *def);
+  int set_string (const char *,const char *);
+  int set_int (const char *, int val);
+
+  ~reg_key ();
+};
+
+/* Evaluates path to the directory of the local user registry hive */
+char *__stdcall get_registry_hive_path (const PSID psid, char *path);
+void __stdcall load_registry_hive (PSID psid);
index 8433859..3a40af5 100644 (file)
@@ -29,6 +29,7 @@ details. */
 #include "sync.h"
 #include "sigproc.h"
 #include "pinfo.h"
+#include "security.h"
 
 extern BOOL allow_ntea;
 BOOL allow_ntsec = FALSE;
diff --git a/winsup/cygwin/security.h b/winsup/cygwin/security.h
new file mode 100644 (file)
index 0000000..b6397fe
--- /dev/null
@@ -0,0 +1,40 @@
+/* security.h: security declarations
+
+   Copyright 2000 Red Hat, Inc.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+/* File manipulation */
+int __stdcall set_process_privileges ();
+int __stdcall get_file_attribute (int, const char *, int *,
+                                 uid_t * = NULL, gid_t * = NULL);
+int __stdcall set_file_attribute (int, const char *, int);
+int __stdcall set_file_attribute (int, const char *, uid_t, gid_t, int, const char *);
+extern BOOL allow_ntsec;
+
+/* `lookup_name' should be called instead of LookupAccountName.
+ * logsrv may be NULL, in this case only the local system is used for lookup.
+ * The buffer for ret_sid (40 Bytes) has to be allocated by the caller! */
+BOOL __stdcall lookup_name (const char *, const char *, PSID);
+char *__stdcall convert_sid_to_string_sid (PSID, char *);
+PSID __stdcall convert_string_sid_to_sid (PSID, const char *);
+BOOL __stdcall get_pw_sid (PSID, struct passwd *);
+
+/* Retrieve a security descriptor that allows all access */
+SECURITY_DESCRIPTOR *__stdcall get_null_sd (void);
+
+int __stdcall get_id_from_sid (PSID, BOOL);
+extern inline int get_uid_from_sid (PSID psid) { return get_id_from_sid (psid, FALSE);}
+extern inline int get_gid_from_sid (PSID psid) { return get_id_from_sid (psid, TRUE); }
+
+/* Various types of security attributes for use in Create* functions. */
+extern SECURITY_ATTRIBUTES sec_none, sec_none_nih, sec_all, sec_all_nih;
+extern SECURITY_ATTRIBUTES *__stdcall sec_user (PVOID sa_buf, PSID sid2 = NULL, BOOL inherit = TRUE);
+extern SECURITY_ATTRIBUTES *__stdcall sec_user_nih (PVOID sa_buf, PSID sid2 = NULL);
+
+int __stdcall NTReadEA (const char *file, const char *attrname, char *buf, int len);
+BOOL __stdcall NTWriteEA (const char *file, const char *attrname, char *buf, int len);
index aab2b1a..ee68c9b 100644 (file)
@@ -17,8 +17,10 @@ details. */
 #include "sync.h"
 #include "sigproc.h"
 #include "pinfo.h"
-#include "tty.h"
 #include "shared_info.h"
+#include "registry.h"
+#include "cygwin_version.h"
+#include "security.h"
 
 #define SHAREDVER (unsigned)(cygwin_version.api_major << 16 | \
                   cygwin_version.api_minor)
diff --git a/winsup/cygwin/shared.h b/winsup/cygwin/shared.h
deleted file mode 100644 (file)
index bd88ca7..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/* shared.h: shared info for cygwin
-
-   Copyright 1998, 1999, 2000 Cygnus Solutions.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-/******** Functions declarations for use in methods below ********/
-
-/* Printf type functions */
-extern "C" void __api_fatal (const char *, ...) __attribute__ ((noreturn));
-extern "C" int __small_sprintf (char *dst, const char *fmt, ...);
-extern "C" int __small_vsprintf (char *dst, const char *fmt, va_list ap);
-
-/******** Deletion Queue Class ********/
-
-/* First pass at a file deletion queue structure.
-
-   We can't keep this list in the per-process info, since
-   one process may open a file, and outlive a process which
-   wanted to unlink the file - and the data would go away.
-
-   Perhaps the FILE_FLAG_DELETE_ON_CLOSE would be ok,
-   but brief experimentation didn't get too far.
-*/
-
-#define MAX_DELQUEUES_PENDING 100
-
-class delqueue_list
-{
-  char name[MAX_DELQUEUES_PENDING][MAX_PATH];
-  char inuse[MAX_DELQUEUES_PENDING];
-  int empty;
-
-public:
-  void init ();
-  void queue_file (const char *dosname);
-  void process_queue ();
-};
-
-/* non-NULL if this process is a child of a cygwin process */
-extern HANDLE parent_alive;
-
-/******** Registry Access ********/
-
-class reg_key
-{
-private:
-
-  HKEY key;
-  LONG key_is_invalid;
-
-public:
-
-  reg_key (HKEY toplev, REGSAM access, ...);
-  reg_key (REGSAM access, ...);
-  reg_key (REGSAM access = KEY_ALL_ACCESS);
-
-  void *operator new (size_t, void *p) {return p;}
-  void build_reg (HKEY key, REGSAM access, va_list av);
-
-  int error () {return key == (HKEY) INVALID_HANDLE_VALUE;}
-
-  int kill (const char *child);
-  int killvalue (const char *name);
-
-  HKEY get_key ();
-  int get_int (const char *,int def);
-  int get_string (const char *, char *buf, size_t len, const char *def);
-  int set_string (const char *,const char *);
-  int set_int (const char *, int val);
-
-  ~reg_key ();
-};
-
-/* Evaluates path to the directory of the local user registry hive */
-char *__stdcall get_registry_hive_path (const PSID psid, char *path);
-void __stdcall load_registry_hive (PSID psid);
-
-
-/* Various types of security attributes for use in Create* functions. */
-extern SECURITY_ATTRIBUTES sec_none, sec_none_nih, sec_all, sec_all_nih;
-extern SECURITY_ATTRIBUTES *__stdcall sec_user (PVOID sa_buf, PSID sid2 = NULL, BOOL inherit = TRUE);
-extern SECURITY_ATTRIBUTES *__stdcall sec_user_nih (PVOID sa_buf, PSID sid2 = NULL);
-
-extern int __stdcall set_console_state_for_spawn ();
-
-extern "C" {
-/* This is for programs that want to access the shared data. */
-class shared_info *cygwin_getshared (void);
-
-struct cygwin_version_info
-{
-  unsigned short api_major;
-  unsigned short api_minor;
-  unsigned short dll_major;
-  unsigned short dll_minor;
-  unsigned short shared_data;
-  unsigned short mount_registry;
-  const char *dll_build_date;
-  char shared_id[sizeof (CYGWIN_VERSION_DLL_IDENTIFIER) + 64];
-};
-}
-
-extern cygwin_version_info cygwin_version;
-extern const char *cygwin_version_strings;
index 52c0559..6434da2 100644 (file)
@@ -1,6 +1,6 @@
-/* shared_sec.h: shared info for cygwin
+/* shared_info.h: shared info for cygwin
 
-   Copyright 1998, 1999, 2000 Cygnus Solutions.
+   Copyright 2000 Cygnus Solutions.
 
 This file is part of Cygwin.
 
@@ -8,6 +8,8 @@ This software is a copyrighted work licensed under the terms of the
 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 details. */
 
+#include "tty.h"
+
 /* Mount table entry */
 
 class mount_item
@@ -38,6 +40,7 @@ public:
    scheme should be satisfactory for a long while yet.  */
 #define MAX_MOUNTS 30
 
+class reg_key;
 class mount_info
 {
   int posix_sorted[MAX_MOUNTS];
@@ -100,6 +103,29 @@ private:
   void read_cygdrive_info_from_registry ();
 };
 
+/******** Close-on-delete queue ********/
+
+/* First pass at a file deletion queue structure.
+
+   We can't keep this list in the per-process info, since
+   one process may open a file, and outlive a process which
+   wanted to unlink the file - and the data would go away.
+*/
+
+#define MAX_DELQUEUES_PENDING 100
+
+class delqueue_list
+{
+  char name[MAX_DELQUEUES_PENDING][MAX_PATH];
+  char inuse[MAX_DELQUEUES_PENDING];
+  int empty;
+
+public:
+  void init ();
+  void queue_file (const char *dosname);
+  void process_queue ();
+};
+
 /******** Shared Info ********/
 /* Data accessible to all tasks */
 
index 38a1aba..f04adfd 100644 (file)
@@ -14,6 +14,7 @@ details. */
 #include "winsup.h"
 #include <errno.h>
 #include "cygerrno.h"
+#include <sys/cygwin.h>
 #include "sync.h"
 #include "sigproc.h"
 #include "pinfo.h"
index 87b29c3..46342ba 100644 (file)
@@ -16,6 +16,7 @@ details. */
 #include <sys/wait.h>
 #include <errno.h>
 #include <stdlib.h>
+#include <sys/cygwin.h>
 #include "cygerrno.h"
 #include "sync.h"
 #include "sigproc.h"
@@ -24,8 +25,8 @@ details. */
 #include "child_info.h"
 #include "perthread.h"
 #include <assert.h>
-#include "tty.h"
 #include "shared_info.h"
+#include "security.h"
 
 /*
  * Convenience defines
index 3cce46e..c863402 100644 (file)
@@ -8,6 +8,8 @@ This software is a copyrighted work licensed under the terms of the
 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 details. */
 
+#include <signal.h>
+
 #define EXIT_SIGNAL             0x010000
 #define EXIT_REPARENTING 0x020000
 #define EXIT_NOCLOSEALL  0x040000
@@ -82,6 +84,9 @@ public:
 extern sigthread mainthread;
 extern HANDLE signal_arrived;
 
+/* non-NULL if this process is a child of a cygwin process */
+extern HANDLE parent_alive;
+
 BOOL __stdcall my_parent_is_alive ();
 extern "C" int __stdcall sig_dispatch_pending (int force = FALSE) __asm__ ("sig_dispatch_pending");
 extern "C" void __stdcall set_process_mask (sigset_t newmask);
index a6dc10f..c7813a3 100644 (file)
@@ -20,6 +20,7 @@ details. */
 #include <winuser.h>
 #include <ctype.h>
 #include "cygerrno.h"
+#include <sys/cygwin.h>
 #include "fhandler.h"
 #include "path.h"
 #include "dtable.h"
@@ -28,7 +29,11 @@ details. */
 #include "cygheap.h"
 #include "child_info.h"
 #include "pinfo.h"
+#define NEED_VFORK
 #include "perthread.h"
+#include "registry.h"
+#include "environ.h"
+#include "security.h"
 
 #define LINE_BUF_CHUNK (MAX_PATH * 2)
 
index 5cba5d0..60d81e0 100644 (file)
@@ -201,11 +201,6 @@ strace::prntf (unsigned category, const char *func, const char *fmt, ...)
   SetLastError (err);
 }
 
-void __stdcall
-mark (const char *, int)
-{
-}
-
 static const struct tab
 {
   int v;
index 9f44ff2..dededa5 100644 (file)
@@ -21,6 +21,7 @@ details. */
 #include <errno.h>
 #include <stdlib.h>
 #include "sync.h"
+#include "security.h"
 
 muto NO_COPY muto_start;
 
index dd24f97..40dd694 100644 (file)
@@ -23,6 +23,8 @@ details. */
 #include <limits.h>
 #include <winnls.h>
 #include <lmcons.h> /* for UNLEN */
+#include <cygwin/version.h>
+#include <sys/cygwin.h>
 #include "cygerrno.h"
 #include "fhandler.h"
 #include "path.h"
@@ -32,8 +34,9 @@ details. */
 #include "sigproc.h"
 #include "pinfo.h"
 #include <unistd.h>
-#include "tty.h"
 #include "shared_info.h"
+#include "perprocess.h"
+#include "security.h"
 
 extern BOOL allow_ntsec;
 
index 07fa998..c72a494 100644 (file)
@@ -13,9 +13,12 @@ details. */
 
 #include "winsup.h"
 #include <errno.h>
+#include <signal.h>
 #include "cygerrno.h"
 #include "fhandler.h"
 #include "dtable.h"
+#include <cygwin/version.h>
+#include "perprocess.h"
 #include <sys/termios.h>
 
 /* tcsendbreak: POSIX 7.2.2.1 */
index 49e5223..fb1a3d6 100644 (file)
@@ -24,6 +24,8 @@ details. */
 #include "sync.h"
 #include "sigproc.h"
 #include "pinfo.h"
+#include "perprocess.h"
+#include "security.h"
 
 extern int threadsafe;
 
index 8b257ca..b8e715d 100644 (file)
@@ -23,6 +23,7 @@ details. */
 #include "sync.h"
 #include "sigproc.h"
 #include "pinfo.h"
+#include "security.h"
 
 #define FACTOR (0x19db1ded53e8000LL)
 #define NSPERSEC 10000000LL
index 4dbe72c..f0be2a5 100644 (file)
@@ -14,14 +14,15 @@ details. */
 #include <utmp.h>
 #include <wingdi.h>
 #include <winuser.h>
+#include <sys/cygwin.h>
 #include "cygerrno.h"
 #include "fhandler.h"
 #include "dtable.h"
 #include "sync.h"
 #include "sigproc.h"
 #include "pinfo.h"
-#include "tty.h"
 #include "shared_info.h"
+#include "security.h"
 
 extern fhandler_tty_master *tty_master;
 
index a0f9ae8..7057fd1 100644 (file)
@@ -22,6 +22,8 @@ details. */
 #include "sync.h"
 #include "sigproc.h"
 #include "pinfo.h"
+#include "registry.h"
+#include "security.h"
 
 char *
 internal_getlogin (_pinfo *pi)
index 0db7c39..a8712ca 100644 (file)
@@ -13,6 +13,7 @@ details. */
 #include "winsup.h"
 #include <stdio.h>
 #include <sys/utsname.h>
+#include "cygwin_version.h"
 
 /* uname: POSIX 4.4.1.1 */
 extern "C" int
index 4373acc..db5fbe1 100644 (file)
@@ -14,10 +14,13 @@ details. */
 #include <sys/time.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <signal.h>
 #include <limits.h>
 #include <wingdi.h>
 #include <winuser.h>
 #include "cygerrno.h"
+#include "perprocess.h"
+#include "security.h"
 
 static NO_COPY UINT timer_active = 0;
 static NO_COPY struct itimerval itv;
index a07c247..4f1bbc8 100644 (file)
@@ -31,10 +31,6 @@ details. */
 
 #include <sys/types.h>
 #include <sys/strace.h>
-#include <sys/resource.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <string.h>
 
 #undef strchr
 #define strchr cygwin_strchr
@@ -89,8 +85,6 @@ extern int dynamically_loaded;
 #define sys_mbstowcs(tgt,src,len) \
                    MultiByteToWideChar(CP_ACP,0,(src),-1,(tgt),(len))
 
-#include <cygwin/version.h>
-
 #define TITLESIZE 1024
 #define MAX_USER_NAME 20
 #define DEFAULT_UID 500
@@ -109,45 +103,7 @@ extern int dynamically_loaded;
 #define __CONDSETF(n, what, x, prefix) \
   ((n) ? __SETF (what, x, prefix) : __CLEARF (what, x, prefix))
 
-#include "shared.h"
-
-extern HANDLE hMainThread;
-extern HANDLE hMainProc;
-
 #include "debug.h"
-#include <sys/cygwin.h>
-
-/********************** Application Interface **************************/
-
-extern "C" per_process __cygwin_user_data; /* Pointer into application's static data */
-#define user_data (&__cygwin_user_data)
-
-/* We use the following to test that sizeof hasn't changed.  When adding
-   or deleting members, insert fillers or use the reserved entries.
-   Do not change this value. */
-#define SIZEOF_PER_PROCESS (42 * 4)
-
-/******************* Host-dependent constants **********************/
-/* Portions of the cygwin DLL require special constants whose values
-   are dependent on the host system.  Rather than dynamically
-   determine those values whenever they are required, initialize these
-   values once at process start-up. */
-
-class host_dependent_constants
-{
- public:
-  void init (void);
-
-  /* Used by fhandler_disk_file::lock which needs a platform-specific
-     upper word value for locking entire files. */
-  DWORD win32_upper;
-
-  /* fhandler_base::open requires host dependent file sharing
-     attributes. */
-  int shared;
-};
-
-extern host_dependent_constants host_dependent;
 
 /* Events/mutexes */
 extern HANDLE title_mutex;
@@ -167,12 +123,6 @@ extern HANDLE title_mutex;
 #define SIGTOMASK(sig) (1<<((sig) - signal_shift_subtract))
 extern unsigned int signal_shift_subtract;
 
-#ifdef NOSTRACE
-#define MARK() 0
-#else
-#define MARK() mark (__FILE__,__LINE__)
-#endif
-
 #ifdef NEW_MACRO_VARARGS
 # define api_fatal(...) __api_fatal ("%P: *** " __VA_ARGS__)
 #else
@@ -188,12 +138,13 @@ extern unsigned int signal_shift_subtract;
 
 /******************** Initialization/Termination **********************/
 
+class per_process;
 /* cygwin .dll initialization */
 void dll_crt0 (per_process *);
 extern "C" void __stdcall _dll_crt0 ();
 
 /* dynamically loaded dll initialization */
-extern "C" int dll_dllcrt0 (HMODULE, per_process*);
+extern "C" int dll_dllcrt0 (HMODULE, per_process *);
 
 /* dynamically loaded dll initialization for non-cygwin apps */
 extern "C" int dll_noncygwin_dllcrt0 (HMODULE, per_process *);
@@ -201,9 +152,6 @@ extern "C" int dll_noncygwin_dllcrt0 (HMODULE, per_process *);
 /* exit the program */
 extern "C" void __stdcall do_exit (int) __attribute__ ((noreturn));
 
-/* Initialize the environment */
-void environ_init (char **);
-
 /* UID/GID */
 void uinfo_init (void);
 
@@ -231,42 +179,15 @@ extern int cygwin_finished_initializing;
 
 /**************************** Miscellaneous ******************************/
 
-/* File manipulation */
-int __stdcall set_process_privileges ();
-int __stdcall get_file_attribute (int, const char *, int *,
-                                 uid_t * = NULL, gid_t * = NULL);
-int __stdcall set_file_attribute (int, const char *, int);
-int __stdcall set_file_attribute (int, const char *, uid_t, gid_t, int, const char *);
 void __stdcall set_std_handle (int);
 int __stdcall writable_directory (const char *file);
 int __stdcall stat_dev (DWORD, int, unsigned long, struct stat *);
 extern BOOL allow_ntsec;
 
-/* `lookup_name' should be called instead of LookupAccountName.
- * logsrv may be NULL, in this case only the local system is used for lookup.
- * The buffer for ret_sid (40 Bytes) has to be allocated by the caller! */
-BOOL __stdcall lookup_name (const char *, const char *, PSID);
-char *__stdcall convert_sid_to_string_sid (PSID, char *);
-PSID __stdcall convert_string_sid_to_sid (PSID, const char *);
-BOOL __stdcall get_pw_sid (PSID, struct passwd *);
-
 unsigned long __stdcall hash_path_name (unsigned long hash, const char *name);
 void __stdcall nofinalslash (const char *src, char *dst);
 extern "C" char *__stdcall rootdir (char *full_path);
 
-void __stdcall mark (const char *, int);
-
-#define _P_VFORK 0
-extern "C" int _spawnve (HANDLE hToken, int mode, const char *path,
-                        const char *const *argv, const char *const *envp);
-
-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 *);
-
 /* String manipulation */
 char *__stdcall strccpy (char *s1, const char **s2, char c);
 int __stdcall strcasematch (const char *s1, const char *s2);
@@ -277,24 +198,16 @@ char *__stdcall strcasestr (const char *searchee, const char *lookfor);
 void __stdcall totimeval (struct timeval *dst, FILETIME * src, int sub, int flag);
 long __stdcall to_time_t (FILETIME * ptr);
 
-/* Retrieve a security descriptor that allows all access */
-SECURITY_DESCRIPTOR *__stdcall get_null_sd (void);
-
-int __stdcall get_id_from_sid (PSID, BOOL);
-extern inline int get_uid_from_sid (PSID psid) { return get_id_from_sid (psid, FALSE);}
-extern inline int get_gid_from_sid (PSID psid) { return get_id_from_sid (psid, TRUE); }
-
-int __stdcall NTReadEA (const char *file, const char *attrname, char *buf, int len);
-BOOL __stdcall NTWriteEA (const char *file, const char *attrname, char *buf, int len);
-
 void __stdcall set_console_title (char *);
 void set_console_handler ();
 
-void __stdcall fill_rusage (struct rusage *, HANDLE);
-void __stdcall add_rusage (struct rusage *, struct rusage *);
-
 void set_winsock_errno ();
 
+/* Printf type functions */
+extern "C" void __api_fatal (const char *, ...) __attribute__ ((noreturn));
+extern "C" int __small_sprintf (char *dst, const char *fmt, ...);
+extern "C" int __small_vsprintf (char *dst, const char *fmt, va_list ap);
+
 /**************************** Exports ******************************/
 
 extern "C" {
@@ -306,9 +219,6 @@ int kill_pgrp (pid_t, int);
 int _kill (int, int);
 int _raise (int sig);
 
-int getfdtabsize ();
-void setfdtabsize (int);
-
 extern DWORD binmode;
 extern char _data_start__, _data_end__, _bss_start__, _bss_end__;
 extern void (*__CTOR_LIST__) (void);
@@ -328,11 +238,6 @@ extern void (*__DTOR_LIST__) (void);
    issue and is neither of the Unixy ones [so we can punt on which
    one is the right one to use].  */
 
-/* Initial and increment values for cygwin's fd table */
-#define NOFILE_INCR    32
-
-#include <sys/reent.h>
-
 #define STD_RBITS (S_IRUSR | S_IRGRP | S_IROTH)
 #define STD_WBITS (S_IWUSR)
 #define STD_XBITS (S_IXUSR | S_IXGRP | S_IXOTH)
@@ -340,38 +245,11 @@ extern void (*__DTOR_LIST__) (void);
 #define O_NOSYMLINK 0x080000
 #define O_DIROPEN   0x100000
 
-/*************************** Environment ******************************/
-
-/* The structure below is used to control conversion to/from posix-style
- * file specs.  Currently, only PATH and HOME are converted, but PATH
- * needs to use a "convert path list" function while HOME needs a simple
- * "convert to posix/win32".  For the simple case, where a calculated length
- * is required, just return MAX_PATH.  *FIXME*
- */
-struct win_env
-  {
-    const char *name;
-    size_t namelen;
-    char *posix;
-    char *native;
-    int (*toposix) (const char *, char *);
-    int (*towin32) (const char *, char *);
-    int (*posix_len) (const char *);
-    int (*win32_len) (const char *);
-    void add_cache (const char *in_posix, const char *in_native = NULL);
-    const char * get_native () {return native ? native + namelen : NULL;}
-  };
-
-win_env * __stdcall getwinenv (const char *name, const char *posix = NULL);
-
-void __stdcall update_envptrs ();
-char * __stdcall winenv (const char * const *, int);
-extern char **__cygwin_environ, ***main_environ;
-extern "C" char __stdcall **cur_environ ();
-int __stdcall envsize (const char * const *, int debug_print = 0);
-
 /* The title on program start. */
 extern char *old_title;
 extern BOOL display_title;
 
+extern HANDLE hMainThread;
+extern HANDLE hMainProc;
+
 #endif /* defined __cplusplus */