* 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.
This commit is contained in:
Christopher Faylor 2000-08-12 05:35:42 +00:00
parent 3ee92b51d6
commit e2ebe11776
43 changed files with 106 additions and 44 deletions

View File

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

View File

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

View File

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

View File

@ -13,6 +13,7 @@ details. */
#include <stdlib.h>
#include <sys/stat.h>
#include <errno.h>
#include "pinfo.h"
#define _COMPILING_NEWLIB
#include "dirent.h"

View File

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

44
winsup/cygwin/dtable.h Normal file
View File

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

View File

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

View File

@ -15,6 +15,7 @@ details. */
#include "exceptions.h"
#include <imagehlp.h>
#include "pinfo.h"
char debugger_command[2 * MAX_PATH + 20];

View File

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

View File

@ -13,6 +13,7 @@ details. */
#include <stdarg.h>
#include <errno.h>
#include <unistd.h>
#include "dtable.h"
extern "C"
int

View File

@ -22,6 +22,7 @@ details. */
#include <wingdi.h>
#include <winuser.h>
#include <ctype.h>
#include "pinfo.h"
/*
* Scroll the screen context.

View File

@ -13,6 +13,7 @@ details. */
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include "pinfo.h"
/**********************************************************************/
/* fhandler_serial */

View File

@ -14,6 +14,7 @@ details. */
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include "pinfo.h"
/* Common functions shared by tty/console */

View File

@ -16,6 +16,8 @@ details. */
#include <errno.h>
#include <ctype.h>
#include <limits.h>
#include "pinfo.h"
#include "dtable.h"
/* Tty master stuff */

View File

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

View File

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

View File

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

View File

@ -14,6 +14,7 @@ details. */
#include "winsup.h"
#include <sys/ioctl.h>
#include <errno.h>
#include "dtable.h"
extern "C"
int

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,6 +11,7 @@
#include <sys/poll.h>
#include <errno.h>
#include "winsup.h"
#include "dtable.h"
extern "C"
int

View File

@ -14,6 +14,7 @@ details. */
#include "winsup.h"
#include <errno.h>
#include "pinfo.h"
/* add timeval values */
static void

View File

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

View File

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

View File

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

View File

@ -13,6 +13,7 @@ details. */
#include "winsup.h"
#include <errno.h>
#include "pinfo.h"
extern "C"
_sig_func_ptr

View File

@ -16,6 +16,7 @@ details. */
#include <sys/wait.h>
#include <errno.h>
#include <stdlib.h>
#include "pinfo.h"
extern BOOL allow_ntsec;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,6 +13,7 @@ details. */
#include "winsup.h"
#include <errno.h>
#include "dtable.h"
/* tcsendbreak: POSIX 7.2.2.1 */
extern "C"

View File

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

View File

@ -16,7 +16,7 @@ details. */
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "pinfo.h"
#define FACTOR (0x19db1ded53ea710LL)
#define NSPERSEC 10000000LL

View File

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

View File

@ -18,6 +18,7 @@ details. */
#include <stdlib.h>
#include <wchar.h>
#include <lm.h>
#include "pinfo.h"
char *
internal_getlogin (_pinfo *pi)

View File

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