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.
This commit is contained in:
Christopher Faylor 2000-09-08 02:56:55 +00:00
parent 42b6d9648f
commit f0338f545d
63 changed files with 422 additions and 274 deletions

View 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

View 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>

View 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,

View File

@ -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;
}

View 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

View File

@ -12,6 +12,8 @@ details. */
#include "sigproc.h"
#include "pinfo.h"
#include "perthread.h"
#include "perprocess.h"
#include "security.h"
#undef CloseHandle

View 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

30
winsup/cygwin/delqueue.h Normal file
View File

@ -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 ();
};

View 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

View 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

View 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 *);

View 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"

View 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);

View 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;

40
winsup/cygwin/environ.h Normal file
View File

@ -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);

View 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];

View 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. */

View 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)

View 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 */

View 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_ */

View 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.

View File

@ -18,6 +18,7 @@ details. */
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
#include "security.h"
#include <sys/termios.h>
/**********************************************************************/

View 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 */

View 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. */

View 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)

View 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);

View File

@ -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;

View File

@ -11,6 +11,7 @@ details. */
#include "winsup.h"
#include <stdlib.h>
#include "thread.h"
#include "perprocess.h"
extern HMODULE cygwin_hmodule;

View 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

View 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)

View 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

View 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)));
}

View 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;

View 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);

View 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.

View File

@ -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)

View 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[];

View 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};

View 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 *);

View 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)

View File

@ -9,6 +9,7 @@
details. */
#include "winsup.h"
#include <sys/time.h>
#include <sys/poll.h>
#include <errno.h>
#include "fhandler.h"

View 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";

43
winsup/cygwin/registry.h Normal file
View File

@ -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);

View 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;

40
winsup/cygwin/security.h Normal file
View File

@ -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);

View 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)

View File

@ -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;

View 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 */

View 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"

View 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

View 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);

View 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)

View 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;

View File

@ -21,6 +21,7 @@ details. */
#include <errno.h>
#include <stdlib.h>
#include "sync.h"
#include "security.h"
muto NO_COPY muto_start;

View 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;

View 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 */

View File

@ -24,6 +24,8 @@ details. */
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
#include "perprocess.h"
#include "security.h"
extern int threadsafe;

View File

@ -23,6 +23,7 @@ details. */
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
#include "security.h"
#define FACTOR (0x19db1ded53e8000LL)
#define NSPERSEC 10000000LL

View 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;

View 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)

View 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

View 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;

View 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 */