diff options
author | cvs2svn <> | 2002-02-25 20:47:52 +0300 |
---|---|---|
committer | cvs2svn <> | 2002-02-25 20:47:52 +0300 |
commit | adbf54b0e04a2e6eb3833af122cdfd31952c86c4 (patch) | |
tree | 39eab7fb362bb354a4c58a24029fe850617e6ff4 /winsup/cygwin | |
parent | dcef278ac89877f82c36a1489e98c395fcc3dc35 (diff) |
This commit was manufactured by cvs2svn to create branch 'cygwin_daemon'.
Cherrypick from master 2002-02-25 17:47:51 UTC Corinna Vinschen <corinna@vinschen.de> ' * cygwin.din (fstat64): New symbol.':
winsup/cygwin/hires.h
winsup/cygwin/how-spawn-works.txt
winsup/cygwin/include/cygwin/grp.h
winsup/cygwin/include/cygwin/stat.h
winsup/cygwin/wsock_event.h
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/hires.h | 24 | ||||
-rw-r--r-- | winsup/cygwin/how-spawn-works.txt | 32 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/grp.h | 46 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/stat.h | 93 | ||||
-rw-r--r-- | winsup/cygwin/wsock_event.h | 32 |
5 files changed, 227 insertions, 0 deletions
diff --git a/winsup/cygwin/hires.h b/winsup/cygwin/hires.h new file mode 100644 index 000000000..c341aa287 --- /dev/null +++ b/winsup/cygwin/hires.h @@ -0,0 +1,24 @@ +/* hires.h: Definitions for hires clock calculations + + Copyright 2002 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. */ + +#ifndef __HIRES_H__ +#define __HIRES_H__ + +class hires +{ + int inited; + LARGE_INTEGER primed_ft; + LARGE_INTEGER primed_pc; + double freq; + void prime () __attribute__ ((regparm (1))); + public: + LONGLONG usecs (bool justdelta) __attribute__ ((regparm (2))); +}; +#endif /*__HIRES_H__*/ diff --git a/winsup/cygwin/how-spawn-works.txt b/winsup/cygwin/how-spawn-works.txt new file mode 100644 index 000000000..e4e25eae9 --- /dev/null +++ b/winsup/cygwin/how-spawn-works.txt @@ -0,0 +1,32 @@ +Spawn.cc in cygwin handles spawn, vfork and exec calls. It does this via +a mode parameter that determines its behaviour with respect to the +child. + +Of particular interest is the exec behaviour. + +In general spawn_guts (where the action happens) does the following: +* Finds the actual program being run (which may include path searching). +* Determines the type (.exe, shell script, perl etc) and for non binary +programs finds the correct interpreter. +* Creates a commandline (based on the type and the user parameters). +* Guesses at whether the binary that will be invoked is a cygwin program +or not (if (real_path.iscygexec ())) and uses that information to copy +the argv table, or to translate it for win32 program usage. +* passes a handle to the parent to the child (note: this handle should +have it's rights restricted the daemon is merged). +* Start the process. +* if the mode is _P_OVERLAY (we are doing an exec) +wait for the child to +a) if it's a cygwin process, signal us via an event. +b) if it's a win32 process, exit. +c) exit. + +If a) occurs, we 'reparent' the child which makes it look to the current +process's parent in the pid and process group chains. +b) is where the cygwin process hangs around as a 'stub' presenting it's +pid as the win32 process's pid, to allow cygwin tools to kill the win32 +process. +once a-c has occured, execution resumes. +* If the mode is _P_OVERLAY, this process exits, otherwise it's +behaviour depends on the mode parameter. See the last block of +spawn_guts. diff --git a/winsup/cygwin/include/cygwin/grp.h b/winsup/cygwin/include/cygwin/grp.h new file mode 100644 index 000000000..3a58e2058 --- /dev/null +++ b/winsup/cygwin/include/cygwin/grp.h @@ -0,0 +1,46 @@ +/* cygwin/grp.h + + Copyright 2002 Red Hat Inc. + Written by Corinna Vinschen <corinna@vinschen.de> + +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. */ + +#ifndef _CYGWIN_GRP_H_ +#define _CYGWIN_GRP_H_ + +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __INSIDE_CYGWIN__ +struct __group16 +{ + char *gr_name; + char *gr_passwd; + __gid16_t gr_gid; + char **gr_mem; +}; + +struct __group32 +{ + char *gr_name; + char *gr_passwd; + __gid32_t gr_gid; + char **gr_mem; +}; + +struct __group16 * getgrgid (__gid16_t gid); +struct __group16 * getgrnam (const char *name); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _CYGWIN_GRP_H_ */ diff --git a/winsup/cygwin/include/cygwin/stat.h b/winsup/cygwin/include/cygwin/stat.h new file mode 100644 index 000000000..90abc3999 --- /dev/null +++ b/winsup/cygwin/include/cygwin/stat.h @@ -0,0 +1,93 @@ +/* cygwin/stat.h + + Copyright 2002 Red Hat Inc. + Written by Corinna Vinschen <corinna@vinschen.de> + +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. */ + +#ifndef _CYGWIN_STAT_H +#define _CYGWIN_STAT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __INSIDE_CYGWIN__ +struct __stat32 +{ + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + __uid16_t st_uid; + __gid16_t st_gid; + dev_t st_rdev; + __off32_t st_size; + time_t st_atime; + long st_spare1; + time_t st_mtime; + long st_spare2; + time_t st_ctime; + long st_spare3; + blksize_t st_blksize; + __blkcnt32_t st_blocks; + long st_spare4[2]; +}; + +struct __stat64 +{ + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + __uid32_t st_uid; + __gid32_t st_gid; + dev_t st_rdev; + __off64_t st_size; + time_t st_atime; + long st_spare1; + time_t st_mtime; + long st_spare2; + time_t st_ctime; + long st_spare3; + blksize_t st_blksize; + __blkcnt64_t st_blocks; + long st_spare4[2]; +}; + +extern int fstat64 (int fd, struct __stat64 *buf); +extern int stat64 (const char *file_name, struct __stat64 *buf); +extern int lstat64 (const char *file_name, struct __stat64 *buf); + +#endif + +struct stat +{ + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + off_t st_size; + time_t st_atime; + long st_spare1; + time_t st_mtime; + long st_spare2; + time_t st_ctime; + long st_spare3; + blksize_t st_blksize; + blkcnt_t st_blocks; + long st_spare4[2]; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* _CYGWIN_STAT_H */ diff --git a/winsup/cygwin/wsock_event.h b/winsup/cygwin/wsock_event.h new file mode 100644 index 000000000..3f8638134 --- /dev/null +++ b/winsup/cygwin/wsock_event.h @@ -0,0 +1,32 @@ +/* wsock_event.h: Defining the wsock_event class + + Copyright 2002 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. */ + +#ifndef __WSOCK_EVENT_H__ +#define __WSOCK_EVENT_H__ + +class wsock_event +{ + WSAEVENT event; + WSAOVERLAPPED ovr; +public: + wsock_event () : event (NULL) {}; + ~wsock_event () + { + if (event) + WSACloseEvent (event); + event = NULL; + }; + + /* The methods are implemented in net.cc */ + LPWSAOVERLAPPED prepare (); + int wait (int socket, LPDWORD flags); +}; + +#endif /* __WSOCK_EVENT_H__ */ |