diff options
43 files changed, 106 insertions, 44 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 722a572..83736c2 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +Sat Aug 12 01:33:12 2000 Christopher Faylor <cgf@cygnus.com> + + * winsup.h: Split out dtable definitions into separate header file. + * dtable.h: New file. + * sigproc.h: Eliminate pinfo.h usage here. Use it in source files that + need it. + Sat Aug 12 01:08:11 2000 Christopher Faylor <cgf@cygnus.com> * Makefile.in: Use dtable.o rather than hinfo.o. diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index aa00a3a..e14447a 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -16,6 +16,8 @@ details. */ #include "dll_init.h" #include "autoload.h" #include <ctype.h> +#include "dtable.h" +#include "pinfo.h" #define MAX_AT_FILE_LEVEL 10 @@ -730,7 +732,7 @@ dll_crt0_1 () } /* Allocate fdtab */ - fdtab_init (); + dtable_init (); /* Initialize uid, gid. */ uinfo_init (); diff --git a/winsup/cygwin/debug.cc b/winsup/cygwin/debug.cc index 23cd83c..e83b13a 100644 --- a/winsup/cygwin/debug.cc +++ b/winsup/cygwin/debug.cc @@ -10,6 +10,7 @@ details. */ #include "winsup.h" #include "exceptions.h" #include "perthread.h" +#include "pinfo.h" static muto NO_COPY *threadname_lock = NULL; #define lock_threadname() \ diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index f9cb83b..07d0e34 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -13,6 +13,7 @@ details. */ #include <stdlib.h> #include <sys/stat.h> #include <errno.h> +#include "pinfo.h" #define _COMPILING_NEWLIB #include "dirent.h" diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index 45c0680..716770a 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -20,12 +20,14 @@ details. */ #include <fcntl.h> #include <winsock.h> +#include "dtable.h" +#include "pinfo.h" dtable fdtab; /* Set aside space for the table of fds */ void -fdtab_init (void) +dtable_init (void) { if (!fdtab.size) fdtab.extend(NOFILE_INCR); diff --git a/winsup/cygwin/dtable.h b/winsup/cygwin/dtable.h new file mode 100644 index 0000000..64ffc49 --- /dev/null +++ b/winsup/cygwin/dtable.h @@ -0,0 +1,44 @@ +/* dtable.h: fd table definition. + + 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. */ + +class dtable +{ + fhandler_base **fds; + fhandler_base **fds_on_hold; + int first_fd_for_open; +public: + size_t size; + dtable () {first_fd_for_open = 3;} + int vfork_child_dup (); + void vfork_parent_restore (); + fhandler_base *dup_worker (fhandler_base *oldfh); + int extend (int howmuch); + void fixup_after_fork (HANDLE); + fhandler_base *build_fhandler (int fd, DWORD dev, const char *name, + int unit = -1); + fhandler_base *build_fhandler (int fd, const char *name, HANDLE h); + int not_open (int n); + int find_unused_handle (int start); + int find_unused_handle () { return find_unused_handle (first_fd_for_open);} + void release (int fd); + void init_std_file_from_handle (int fd, HANDLE handle, DWORD access, const char *name); + int dup2 (int oldfd, int newfd); + int linearize_fd_array (unsigned char *buf, int buflen); + LPBYTE de_linearize_fd_array (LPBYTE buf); + fhandler_base *operator [](int fd) { return fds[fd]; } + select_record *select_read (int fd, select_record *s); + select_record *select_write (int fd, select_record *s); + select_record *select_except (int fd, select_record *s); + operator fhandler_base **() {return fds;} +}; + +void dtable_init (void); +void stdio_init (void); +extern dtable fdtab; diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index c081b70..dfb53a8 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -13,6 +13,7 @@ details. */ #include <stddef.h> #include <ctype.h> #include <fcntl.h> +#include "pinfo.h" extern BOOL allow_glob; extern BOOL allow_ntea; diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 7452e94..52e333c 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -15,6 +15,7 @@ details. */ #include "exceptions.h" #include <imagehlp.h> +#include "pinfo.h" char debugger_command[2 * MAX_PATH + 20]; diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc index f31d349..0d08011 100644 --- a/winsup/cygwin/external.cc +++ b/winsup/cygwin/external.cc @@ -11,6 +11,7 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #include "winsup.h" +#include "pinfo.h" static external_pinfo * fillout_pinfo (pid_t pid, int winpid) diff --git a/winsup/cygwin/fcntl.cc b/winsup/cygwin/fcntl.cc index 793e432..6f64bd9 100644 --- a/winsup/cygwin/fcntl.cc +++ b/winsup/cygwin/fcntl.cc @@ -13,6 +13,7 @@ details. */ #include <stdarg.h> #include <errno.h> #include <unistd.h> +#include "dtable.h" extern "C" int diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 564e4e2..7388dda 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -22,6 +22,7 @@ details. */ #include <wingdi.h> #include <winuser.h> #include <ctype.h> +#include "pinfo.h" /* * Scroll the screen context. diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc index 6ceb71e..80f0904 100644 --- a/winsup/cygwin/fhandler_serial.cc +++ b/winsup/cygwin/fhandler_serial.cc @@ -13,6 +13,7 @@ details. */ #include <errno.h> #include <unistd.h> #include <stdlib.h> +#include "pinfo.h" /**********************************************************************/ /* fhandler_serial */ diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc index 410a936..3e3b5b6 100644 --- a/winsup/cygwin/fhandler_termios.cc +++ b/winsup/cygwin/fhandler_termios.cc @@ -14,6 +14,7 @@ details. */ #include <unistd.h> #include <errno.h> #include <ctype.h> +#include "pinfo.h" /* Common functions shared by tty/console */ diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 6491ed9..2c80701 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -16,6 +16,8 @@ details. */ #include <errno.h> #include <ctype.h> #include <limits.h> +#include "pinfo.h" +#include "dtable.h" /* Tty master stuff */ diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 1f0a007..6181b24 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -16,6 +16,8 @@ details. */ #include <stdarg.h> #include <errno.h> #include "dll_init.h" +#include "dtable.h" +#include "pinfo.h" DWORD NO_COPY chunksize = 0; /* Timeout to wait for child to start, parent to init child, etc. */ diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index f7f86de..8e1171a 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -15,6 +15,7 @@ details. */ #include <grp.h> #include <stdio.h> #include <stdlib.h> +#include "pinfo.h" /* Read /etc/group only once for better performance. This is done on the first call that needs information from it. */ diff --git a/winsup/cygwin/heap.cc b/winsup/cygwin/heap.cc index b3dc488..53bace4 100644 --- a/winsup/cygwin/heap.cc +++ b/winsup/cygwin/heap.cc @@ -10,6 +10,7 @@ details. */ #include "winsup.h" #include <errno.h> +#include "pinfo.h" #define brksize ((char *) user_data->heaptop - (char *) user_data->heapbase) #define brk (user_data->heapptr) diff --git a/winsup/cygwin/ioctl.cc b/winsup/cygwin/ioctl.cc index 51022ee..e232ae3 100644 --- a/winsup/cygwin/ioctl.cc +++ b/winsup/cygwin/ioctl.cc @@ -14,6 +14,7 @@ details. */ #include "winsup.h" #include <sys/ioctl.h> #include <errno.h> +#include "dtable.h" extern "C" int diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 400b575..bef6b4b 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -13,7 +13,8 @@ details. */ #include <stddef.h> #include <sys/mman.h> #include <errno.h> - +#include "dtable.h" +#include "pinfo.h" /* * Simple class used to keep a record of all current diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 00d988f..e0b5a08 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -23,6 +23,8 @@ details. */ #include <fcntl.h> #include "autoload.h" #include <winsock.h> +#include "dtable.h" +#include "pinfo.h" /* We only want to initialize WinSock in a child process if socket handles are inheritted. This global allows us to know whether this diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index 6dd0129..d5f8b15 100644 --- a/winsup/cygwin/passwd.cc +++ b/winsup/cygwin/passwd.cc @@ -13,6 +13,8 @@ details. */ #include <pwd.h> #include <stdio.h> #include <errno.h> +#include "dtable.h" +#include "pinfo.h" /* Read /etc/passwd only once for better performance. This is done on the first call that needs information from it. */ diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index fe1c385..8ab7316 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -81,6 +81,7 @@ details. */ #include <errno.h> #include <ctype.h> #include <winioctl.h> +#include "pinfo.h" static int normalize_win32_path (const char *cwd, const char *src, char *dst); static char *getcwd_inner (char *buf, size_t ulen, int posix_p, int with_chroot); diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 02d3cf6..49ef499 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -13,6 +13,8 @@ details. */ #include <time.h> #include <errno.h> #include <limits.h> +#include "dtable.h" +#include "pinfo.h" static char NO_COPY pinfo_dummy[sizeof(pinfo)] = {0}; diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc index 951e9f4..c001c55 100644 --- a/winsup/cygwin/pipe.cc +++ b/winsup/cygwin/pipe.cc @@ -12,6 +12,7 @@ details. */ #include <unistd.h> #include <sys/fcntl.h> #include <errno.h> +#include "dtable.h" static int make_pipe (int fildes[2], unsigned int psize, int mode) diff --git a/winsup/cygwin/poll.cc b/winsup/cygwin/poll.cc index 6804619..2121d28 100644 --- a/winsup/cygwin/poll.cc +++ b/winsup/cygwin/poll.cc @@ -11,6 +11,7 @@ #include <sys/poll.h> #include <errno.h> #include "winsup.h" +#include "dtable.h" extern "C" int diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc index a456f24..330e147 100644 --- a/winsup/cygwin/resource.cc +++ b/winsup/cygwin/resource.cc @@ -14,6 +14,7 @@ details. */ #include "winsup.h" #include <errno.h> +#include "pinfo.h" /* add timeval values */ static void diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index 09c732d..98bf59c 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -22,6 +22,8 @@ details. */ #include <sys/stat.h> #include <sys/acl.h> #include <ctype.h> +#include "dtable.h" +#include "pinfo.h" extern BOOL allow_ntea; BOOL allow_ntsec = FALSE; diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 3b23b39..8c630ee 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -33,6 +33,7 @@ details. */ #include <stdio.h> #include <winsock.h> #include "select.h" +#include "dtable.h" /* * All these defines below should be in sys/types.h diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index ff8dd3d..e44c725 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -14,6 +14,7 @@ details. */ #include <stdlib.h> #include <grp.h> #include <pwd.h> +#include "pinfo.h" #define SHAREDVER (unsigned)(cygwin_version.api_major << 16 | \ cygwin_version.api_minor) diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 332034f..5695b4d 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -13,6 +13,7 @@ details. */ #include "winsup.h" #include <errno.h> +#include "pinfo.h" extern "C" _sig_func_ptr diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index aba39d6..1bd9bcd 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -16,6 +16,7 @@ details. */ #include <sys/wait.h> #include <errno.h> #include <stdlib.h> +#include "pinfo.h" extern BOOL allow_ntsec; diff --git a/winsup/cygwin/sigproc.h b/winsup/cygwin/sigproc.h index f7b36a8..683e1d9 100644 --- a/winsup/cygwin/sigproc.h +++ b/winsup/cygwin/sigproc.h @@ -94,8 +94,7 @@ int __stdcall handle_sigsuspend (sigset_t); int __stdcall proc_subproc (DWORD, DWORD); -#include "pinfo.h" - +class _pinfo; void __stdcall proc_terminate (); void __stdcall sigproc_init (); void __stdcall subproc_init (); diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index af5ac6c..6ac71e1 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -19,7 +19,9 @@ details. */ #include <wingdi.h> #include <winuser.h> #include <ctype.h> -#include "paths.h" +#include <paths.h> +#include "dtable.h" +#include "pinfo.h" extern BOOL allow_ntsec; diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc index 0470897..457cd22 100644 --- a/winsup/cygwin/strace.cc +++ b/winsup/cygwin/strace.cc @@ -14,6 +14,7 @@ details. */ #include <wingdi.h> #include <winuser.h> #include <ctype.h> +#include "pinfo.h" #define PROTECT(x) x[sizeof(x)-1] = 0 #define CHECK(x) if (x[sizeof(x)-1] != 0) { small_printf("array bound exceeded %d\n", __LINE__); ExitProcess(1); } diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 2fa0643..4acec27 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -24,6 +24,8 @@ details. */ #include <unistd.h> #include <winnls.h> #include <lmcons.h> /* for UNLEN */ +#include "dtable.h" +#include "pinfo.h" extern BOOL allow_ntsec; diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc index 75bf69f..05131d9 100644 --- a/winsup/cygwin/sysconf.cc +++ b/winsup/cygwin/sysconf.cc @@ -13,6 +13,7 @@ details. */ #include <errno.h> #include <time.h> #include <limits.h> +#include "dtable.h" /* sysconf: POSIX 4.8.1.1 */ /* Allows a portable app to determine quantities of resources or diff --git a/winsup/cygwin/syslog.cc b/winsup/cygwin/syslog.cc index 50ef80b..b0c4789 100644 --- a/winsup/cygwin/syslog.cc +++ b/winsup/cygwin/syslog.cc @@ -14,6 +14,7 @@ details. */ #include <syslog.h> #include <stdarg.h> #include <unistd.h> +#include "dtable.h" /* FIXME: These should probably be in the registry. */ /* FIXME: The Win95 path should be whatever slash is */ diff --git a/winsup/cygwin/termios.cc b/winsup/cygwin/termios.cc index 4b8a996..6a5736b 100644 --- a/winsup/cygwin/termios.cc +++ b/winsup/cygwin/termios.cc @@ -13,6 +13,7 @@ details. */ #include "winsup.h" #include <errno.h> +#include "dtable.h" /* tcsendbreak: POSIX 7.2.2.1 */ extern "C" diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 2335d60..6f40a68 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -18,9 +18,9 @@ details. */ #include "winsup.h" #include <errno.h> #include <assert.h> - #include <stdlib.h> #include <syslog.h> +#include "pinfo.h" extern int threadsafe; diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index 28763e1..fa8cdb5 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -16,7 +16,7 @@ details. */ #include <stdio.h> #include <stdlib.h> #include <errno.h> - +#include "pinfo.h" #define FACTOR (0x19db1ded53ea710LL) #define NSPERSEC 10000000LL diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc index fa55b26..1aa182c 100644 --- a/winsup/cygwin/tty.cc +++ b/winsup/cygwin/tty.cc @@ -14,6 +14,8 @@ details. */ #include <utmp.h> #include <wingdi.h> #include <winuser.h> +#include "dtable.h" +#include "pinfo.h" extern fhandler_tty_master *tty_master; diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index d752d69..a9cb227 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -18,6 +18,7 @@ details. */ #include <stdlib.h> #include <wchar.h> #include <lm.h> +#include "pinfo.h" char * internal_getlogin (_pinfo *pi) diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index f3794f5..3c9e519 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -113,7 +113,6 @@ extern int dynamically_loaded; extern HANDLE hMainThread; extern HANDLE hMainProc; -/* Now that pinfo has been defined, include... */ #include "debug.h" #include "sync.h" #include "sigproc.h" @@ -131,36 +130,6 @@ extern "C" per_process __cygwin_user_data; /* Pointer into application's static Do not change this value. */ #define SIZEOF_PER_PROCESS (42 * 4) -class dtable -{ - fhandler_base **fds; - fhandler_base **fds_on_hold; - int first_fd_for_open; -public: - size_t size; - dtable () {first_fd_for_open = 3;} - int vfork_child_dup (); - void vfork_parent_restore (); - fhandler_base *dup_worker (fhandler_base *oldfh); - int extend (int howmuch); - void fixup_after_fork (HANDLE parent); - fhandler_base *build_fhandler (int fd, DWORD dev, const char *name, - int unit = -1); - fhandler_base *build_fhandler (int fd, const char *name, HANDLE h); - int not_open (int n); - int find_unused_handle (int start); - int find_unused_handle () { return find_unused_handle (first_fd_for_open);} - void release (int fd); - void init_std_file_from_handle (int fd, HANDLE handle, DWORD access, const char *name); - int dup2 (int oldfd, int newfd); - int linearize_fd_array (unsigned char *buf, int buflen); - LPBYTE de_linearize_fd_array (LPBYTE buf); - fhandler_base *operator [](int fd) { return fds[fd]; } - select_record *select_read (int fd, select_record *s); - select_record *select_write (int fd, select_record *s); - select_record *select_except (int fd, select_record *s); -}; - /******************* Host-dependent constants **********************/ /* Portions of the cygwin DLL require special constants whose values are dependent on the host system. Rather than dynamically @@ -320,11 +289,6 @@ void environ_init (int); void heap_init (void); void malloc_init (void); -/* fd table */ -void fdtab_init (void); -void stdio_init (void); -extern dtable fdtab; - /* UID/GID */ void uinfo_init (void); |