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 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
details. */
#include "winsup.h"
+#include "security.h"
#include <wingdi.h>
#include <winuser.h>
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
+#include <setjmp.h>
+
enum
{
PROC_MAGIC = 0xaf08f000,
--- /dev/null
+/* 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;
+}
#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
#include "sigproc.h"
#include "pinfo.h"
#include "perthread.h"
+#include "perprocess.h"
+#include "security.h"
#undef CloseHandle
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
--- /dev/null
+/* 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 ();
+};
#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
#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
#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 *);
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
+#include <sys/cygwin.h>
#include <winsock.h>
#include "sync.h"
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;
void dtable_init (void);
void stdio_init (void);
extern dtable fdtab;
+
+extern "C" int getfdtabsize ();
+extern "C" void setfdtabsize (int);
#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"
#include "path.h"
#include "cygerrno.h"
#include "cygheap.h"
+#include "registry.h"
+#include "environ.h"
extern BOOL allow_glob;
extern BOOL allow_ntea;
--- /dev/null
+/* 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);
#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];
#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. */
#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)
#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 */
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_ */
#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.
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
+#include "security.h"
#include <sys/termios.h>
/**********************************************************************/
#include "sigproc.h"
#include "pinfo.h"
#include "cygheap.h"
-#include "tty.h"
#include "shared_info.h"
/* Tty master stuff */
#include <fcntl.h>
#include <stdarg.h>
#include <errno.h>
-#include "dll_init.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygerrno.h"
#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. */
#include "sigproc.h"
#include "pinfo.h"
#include "heap.h"
-#include "tty.h"
#include "shared_info.h"
#define assert(x)
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
+#include "perprocess.h"
+
/* Heap management. */
void heap_init (void);
void malloc_init (void);
--- /dev/null
+/* 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;
#include "winsup.h"
#include <stdlib.h>
#include "thread.h"
+#include "perprocess.h"
extern HMODULE cygwin_hmodule;
#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
# 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)
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
+#include "security.h"
/*
* Simple class used to keep a record of all current
#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
unsigned long int
htonl (unsigned long int x)
{
- MARK ();
return ((((x & 0x000000ffU) << 24) |
((x & 0x0000ff00U) << 8) |
((x & 0x00ff0000U) >> 8) |
unsigned short
htons (unsigned short x)
{
- MARK ();
return ((((x & 0x000000ffU) << 8) |
((x & 0x0000ff00U) >> 8)));
}
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;
#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"
#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);
/* 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.
--- /dev/null
+/* 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)
size_t size () {return sizeof (waitq);}
};
+#ifdef NEED_VFORK
struct vfork_save
{
int pid;
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
};
extern per_thread_waitq waitq_storage;
-extern per_thread_vfork vfork_storage;
extern per_thread_signal_dispatch signal_dispatch_storage;
extern per_thread *threadstuff[];
#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};
-/******** 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) */
#define PSIZE 1024
class ThreadItem;
+#include <sys/resource.h>
class _pinfo
{
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 *);
#include "fhandler.h"
#include "dtable.h"
#include "thread.h"
+#include "security.h"
static int
make_pipe (int fildes[2], unsigned int psize, int mode)
details. */
#include "winsup.h"
+#include <sys/time.h>
#include <sys/poll.h>
#include <errno.h>
#include "fhandler.h"
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";
--- /dev/null
+/* 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);
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
+#include "security.h"
extern BOOL allow_ntea;
BOOL allow_ntsec = FALSE;
--- /dev/null
+/* 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);
#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)
+++ /dev/null
-/* 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;
-/* 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.
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
+#include "tty.h"
+
/* Mount table entry */
class mount_item
scheme should be satisfactory for a long while yet. */
#define MAX_MOUNTS 30
+class reg_key;
class mount_info
{
int posix_sorted[MAX_MOUNTS];
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 */
#include "winsup.h"
#include <errno.h>
#include "cygerrno.h"
+#include <sys/cygwin.h>
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
#include <sys/wait.h>
#include <errno.h>
#include <stdlib.h>
+#include <sys/cygwin.h>
#include "cygerrno.h"
#include "sync.h"
#include "sigproc.h"
#include "child_info.h"
#include "perthread.h"
#include <assert.h>
-#include "tty.h"
#include "shared_info.h"
+#include "security.h"
/*
* Convenience defines
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
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);
#include <winuser.h>
#include <ctype.h>
#include "cygerrno.h"
+#include <sys/cygwin.h>
#include "fhandler.h"
#include "path.h"
#include "dtable.h"
#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)
SetLastError (err);
}
-void __stdcall
-mark (const char *, int)
-{
-}
-
static const struct tab
{
int v;
#include <errno.h>
#include <stdlib.h>
#include "sync.h"
+#include "security.h"
muto NO_COPY muto_start;
#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"
#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;
#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 */
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
+#include "perprocess.h"
+#include "security.h"
extern int threadsafe;
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
+#include "security.h"
#define FACTOR (0x19db1ded53e8000LL)
#define NSPERSEC 10000000LL
#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;
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
+#include "registry.h"
+#include "security.h"
char *
internal_getlogin (_pinfo *pi)
#include "winsup.h"
#include <stdio.h>
#include <sys/utsname.h>
+#include "cygwin_version.h"
/* uname: POSIX 4.4.1.1 */
extern "C" int
#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;
#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
#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
#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;
#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
/******************** 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 *);
/* 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);
/**************************** 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);
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" {
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);
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)
#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 */