2000-02-18 03:38:33 +08:00
|
|
|
/* fhandler.h
|
|
|
|
|
2002-01-02 00:25:31 +08:00
|
|
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
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 _FHANDLER_H_
|
|
|
|
#define _FHANDLER_H_
|
|
|
|
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2001-06-15 02:21:17 +08:00
|
|
|
FH_RBINARY = 0x00001000, /* binary read mode */
|
|
|
|
FH_WBINARY = 0x00002000, /* binary write mode */
|
|
|
|
FH_CLOEXEC = 0x00004000, /* close-on-exec */
|
|
|
|
FH_RBINSET = 0x00008000, /* binary read mode has been explicitly set */
|
|
|
|
FH_WBINSET = 0x00010000, /* binary write mode has been explicitly set */
|
|
|
|
FH_APPEND = 0x00020000, /* always append */
|
|
|
|
FH_ASYNC = 0x00040000, /* async I/O */
|
2001-08-07 08:01:42 +08:00
|
|
|
FH_SIGCLOSE = 0x00080000, /* signal handler should close fd on interrupt */
|
2001-06-15 02:21:17 +08:00
|
|
|
|
|
|
|
FH_SYMLINK = 0x00100000, /* is a symlink */
|
|
|
|
FH_EXECABL = 0x00200000, /* file looked like it would run:
|
2000-02-18 03:38:33 +08:00
|
|
|
* ends in .exe or .bat or begins with #! */
|
2001-06-15 02:21:17 +08:00
|
|
|
FH_W95LSBUG = 0x00400000, /* set when lseek is called as a flag that
|
2000-02-18 03:38:33 +08:00
|
|
|
* _write should check if we've moved beyond
|
|
|
|
* EOF, zero filling if so. */
|
2001-11-24 11:11:39 +08:00
|
|
|
FH_NOHANDLE = 0x00800000, /* No handle associated with fhandler. */
|
2001-06-15 02:21:17 +08:00
|
|
|
FH_NOEINTR = 0x01000000, /* Set if I/O should be uninterruptible. */
|
|
|
|
FH_FFIXUP = 0x02000000, /* Set if need to fixup after fork. */
|
|
|
|
FH_LOCAL = 0x04000000, /* File is unix domain socket */
|
2001-08-31 13:06:14 +08:00
|
|
|
FH_SHUTRD = 0x08000000, /* Socket saw a SHUT_RD */
|
|
|
|
FH_SHUTWR = 0x10000000, /* Socket saw a SHUT_WR */
|
2001-06-15 02:21:17 +08:00
|
|
|
FH_ISREMOTE = 0x10000000, /* File is on a remote drive */
|
|
|
|
FH_DCEXEC = 0x20000000, /* Don't care if this is executable */
|
|
|
|
FH_HASACLS = 0x40000000, /* True if fs of file has ACLS */
|
|
|
|
FH_QUERYOPEN = 0x80000000, /* open file without requesting either read
|
|
|
|
or write access */
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
/* Device flags */
|
|
|
|
|
|
|
|
/* Slow devices */
|
|
|
|
FH_CONSOLE = 0x00000001, /* is a console */
|
|
|
|
FH_CONIN = 0x00000002, /* console input */
|
|
|
|
FH_CONOUT = 0x00000003, /* console output */
|
|
|
|
FH_TTYM = 0x00000004, /* is a tty master */
|
|
|
|
FH_TTYS = 0x00000005, /* is a tty slave */
|
|
|
|
FH_PTYM = 0x00000006, /* is a pty master */
|
|
|
|
FH_SERIAL = 0x00000007, /* is a serial port */
|
|
|
|
FH_PIPE = 0x00000008, /* is a pipe */
|
|
|
|
FH_PIPER = 0x00000009, /* read end of a pipe */
|
|
|
|
FH_PIPEW = 0x0000000a, /* write end of a pipe */
|
|
|
|
FH_SOCKET = 0x0000000b, /* is a socket */
|
|
|
|
FH_WINDOWS = 0x0000000c, /* is a window */
|
|
|
|
FH_SLOW = 0x00000010, /* "slow" device if below this */
|
|
|
|
|
|
|
|
/* Fast devices */
|
|
|
|
FH_DISK = 0x00000010, /* is a disk */
|
|
|
|
FH_FLOPPY = 0x00000011, /* is a floppy */
|
|
|
|
FH_TAPE = 0x00000012, /* is a tape */
|
|
|
|
FH_NULL = 0x00000013, /* is the null device */
|
|
|
|
FH_ZERO = 0x00000014, /* is the zero device */
|
2000-05-03 23:39:10 +08:00
|
|
|
FH_RANDOM = 0x00000015, /* is a random device */
|
2000-10-01 09:02:40 +08:00
|
|
|
FH_MEM = 0x00000016, /* is a mem device */
|
2001-11-22 13:59:07 +08:00
|
|
|
FH_CLIPBOARD = 0x00000017, /* is a clipboard device */
|
2001-04-17 11:52:08 +08:00
|
|
|
FH_OSS_DSP = 0x00000018, /* is a dsp audio device */
|
2001-11-22 13:59:07 +08:00
|
|
|
FH_CYGDRIVE= 0x00000019, /* /cygdrive/x */
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-11-22 13:59:07 +08:00
|
|
|
FH_NDEV = 0x0000001a, /* Maximum number of devices */
|
2000-02-18 03:38:33 +08:00
|
|
|
FH_DEVMASK = 0x00000fff, /* devices live here */
|
|
|
|
FH_BAD = 0xffffffff
|
|
|
|
};
|
|
|
|
|
|
|
|
#define FHDEVN(n) ((n) & FH_DEVMASK)
|
|
|
|
#define FHISSETF(x) __ISSETF (this, x, FH)
|
|
|
|
#define FHSETF(x) __SETF (this, x, FH)
|
|
|
|
#define FHCLEARF(x) __CLEARF (this, x, FH)
|
|
|
|
#define FHCONDSETF(n, x) __CONDSETF(n, this, x, FH)
|
|
|
|
|
|
|
|
#define FHSTATOFF 0
|
|
|
|
|
2001-08-14 15:41:45 +08:00
|
|
|
/* fcntl flags used only internaly. */
|
|
|
|
#define O_NOSYMLINK 0x080000
|
|
|
|
#define O_DIROPEN 0x100000
|
|
|
|
|
|
|
|
/* newlib used to define O_NDELAY differently from O_NONBLOCK. Now it
|
|
|
|
properly defines both to be the same. Unfortunately, we have to
|
2001-10-29 07:05:49 +08:00
|
|
|
behave properly the old version, too, to accommodate older executables. */
|
2001-08-14 15:41:45 +08:00
|
|
|
#define OLD_O_NDELAY (CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK ? 4 : 0)
|
|
|
|
|
|
|
|
/* Care for the old O_NDELAY flag. If one of the flags is set,
|
|
|
|
both flags are set. */
|
|
|
|
#define O_NONBLOCK_MASK (O_NONBLOCK | OLD_O_NDELAY)
|
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
extern const char *windows_device_names[];
|
2000-07-09 13:29:51 +08:00
|
|
|
extern struct __cygwin_perfile *perfile_table;
|
2000-02-18 03:38:33 +08:00
|
|
|
#define __fmode (*(user_data->fmode_ptr))
|
|
|
|
|
|
|
|
class select_record;
|
|
|
|
class path_conv;
|
|
|
|
class fhandler_disk_file;
|
2001-11-21 14:47:57 +08:00
|
|
|
typedef struct __DIR DIR;
|
|
|
|
struct dirent;
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-01-17 22:57:09 +08:00
|
|
|
enum bg_check_types
|
|
|
|
{
|
|
|
|
bg_error = -1,
|
|
|
|
bg_eof = 0,
|
|
|
|
bg_ok = 1,
|
|
|
|
bg_signalled = 2
|
|
|
|
};
|
|
|
|
|
2001-03-05 14:28:25 +08:00
|
|
|
enum executable_states
|
|
|
|
{
|
|
|
|
is_executable,
|
|
|
|
not_executable,
|
|
|
|
dont_care_if_executable,
|
|
|
|
dont_know_if_executable
|
|
|
|
};
|
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
class fhandler_base
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
protected:
|
2000-02-18 03:38:33 +08:00
|
|
|
DWORD status;
|
2001-11-02 05:15:53 +08:00
|
|
|
private:
|
2001-04-24 10:07:58 +08:00
|
|
|
int access;
|
2000-02-18 03:38:33 +08:00
|
|
|
HANDLE io_handle;
|
|
|
|
|
2001-04-24 10:07:58 +08:00
|
|
|
unsigned long namehash; /* hashed filename, used as inode num */
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-11-02 05:15:53 +08:00
|
|
|
protected:
|
2000-02-18 03:38:33 +08:00
|
|
|
/* Full unix path name of this file */
|
|
|
|
/* File open flags from open () and fcntl () calls */
|
2001-04-24 10:07:58 +08:00
|
|
|
int openflags;
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
char *rabuf; /* used for crlf conversion in text files */
|
|
|
|
size_t ralen;
|
|
|
|
size_t raixget;
|
|
|
|
size_t raixput;
|
|
|
|
size_t rabuflen;
|
|
|
|
|
2001-04-24 10:07:58 +08:00
|
|
|
char *unix_path_name;
|
|
|
|
char *win32_path_name;
|
|
|
|
DWORD open_status;
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2000-06-19 01:43:45 +08:00
|
|
|
void set_name (const char * unix_path, const char * win32_path = NULL,
|
|
|
|
int unit = 0);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-10-01 12:10:07 +08:00
|
|
|
void reset_unix_path_name (const char *);
|
2000-09-03 12:16:35 +08:00
|
|
|
virtual fhandler_base& operator =(fhandler_base &x);
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_base (DWORD dev, int unit = 0);
|
2000-02-18 03:38:33 +08:00
|
|
|
virtual ~fhandler_base ();
|
|
|
|
|
|
|
|
/* Non-virtual simple accessor functions. */
|
2000-10-12 12:38:29 +08:00
|
|
|
void set_io_handle (HANDLE x) { io_handle = x; }
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
DWORD get_device () { return status & FH_DEVMASK; }
|
|
|
|
virtual int get_unit () { return 0; }
|
|
|
|
virtual BOOL is_slow () { return get_device () < FH_SLOW; }
|
|
|
|
|
2001-04-24 10:07:58 +08:00
|
|
|
int get_access () { return access; }
|
|
|
|
void set_access (int x) { access = x; }
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-11-24 11:11:39 +08:00
|
|
|
bool get_async () { return FHISSETF (ASYNC); }
|
2000-02-18 03:38:33 +08:00
|
|
|
void set_async (int x) { FHCONDSETF (x, ASYNC); }
|
|
|
|
|
2001-04-24 10:07:58 +08:00
|
|
|
int get_flags () { return openflags; }
|
|
|
|
void set_flags (int x) { openflags = x; }
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-11-24 11:11:39 +08:00
|
|
|
bool is_nonblocking ();
|
2001-08-15 15:49:15 +08:00
|
|
|
void set_nonblocking (int yes);
|
|
|
|
|
2001-11-24 11:11:39 +08:00
|
|
|
bool get_w_binary () { return FHISSETF (WBINARY); }
|
|
|
|
bool get_r_binary () { return FHISSETF (RBINARY); }
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-11-24 11:11:39 +08:00
|
|
|
bool get_w_binset () { return FHISSETF (WBINSET); }
|
|
|
|
bool get_r_binset () { return FHISSETF (RBINSET); }
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
void set_w_binary (int b) { FHCONDSETF (b, WBINARY); FHSETF (WBINSET); }
|
|
|
|
void set_r_binary (int b) { FHCONDSETF (b, RBINARY); FHSETF (RBINSET); }
|
2001-04-24 01:29:33 +08:00
|
|
|
void clear_w_binary () {FHCLEARF (WBINARY); FHCLEARF (WBINSET); }
|
|
|
|
void clear_r_binary () {FHCLEARF (RBINARY); FHCLEARF (RBINSET); }
|
2001-11-24 11:11:39 +08:00
|
|
|
|
|
|
|
bool get_nohandle () { return FHISSETF (NOHANDLE); }
|
|
|
|
void set_nohandle (int x) { FHCONDSETF (x, NOHANDLE); }
|
|
|
|
|
2001-04-24 10:07:58 +08:00
|
|
|
void set_open_status () {open_status = status;}
|
|
|
|
DWORD get_open_status () {return open_status;}
|
|
|
|
void reset_to_open_binmode ()
|
|
|
|
{
|
|
|
|
status = status & ~(FH_WBINARY | FH_WBINSET | FH_RBINARY | FH_RBINSET);
|
|
|
|
status = status | ((FH_WBINARY | FH_WBINSET | FH_RBINARY | FH_RBINSET)
|
|
|
|
& open_status);
|
|
|
|
}
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2000-07-09 13:29:51 +08:00
|
|
|
int get_default_fmode (int flags);
|
|
|
|
|
2001-11-24 11:11:39 +08:00
|
|
|
bool get_r_no_interrupt () { return FHISSETF (NOEINTR); }
|
2000-02-18 03:38:33 +08:00
|
|
|
void set_r_no_interrupt (int b) { FHCONDSETF (b, NOEINTR); }
|
|
|
|
|
2001-11-24 11:11:39 +08:00
|
|
|
bool get_close_on_exec () { return FHISSETF (CLOEXEC); }
|
2000-02-18 03:38:33 +08:00
|
|
|
int set_close_on_exec_flag (int b) { return FHCONDSETF (b, CLOEXEC); }
|
|
|
|
|
2001-07-27 03:22:24 +08:00
|
|
|
LPSECURITY_ATTRIBUTES get_inheritance (bool all = 0)
|
|
|
|
{
|
|
|
|
if (all)
|
|
|
|
return get_close_on_exec () ? &sec_all_nih : &sec_all;
|
|
|
|
else
|
|
|
|
return get_close_on_exec () ? &sec_none_nih : &sec_none;
|
|
|
|
}
|
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
void set_check_win95_lseek_bug (int b = 1) { FHCONDSETF (b, W95LSBUG); }
|
2001-11-24 11:11:39 +08:00
|
|
|
bool get_check_win95_lseek_bug () { return FHISSETF (W95LSBUG); }
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-11-24 11:11:39 +08:00
|
|
|
bool get_need_fork_fixup () { return FHISSETF (FFIXUP); }
|
2000-02-18 03:38:33 +08:00
|
|
|
void set_need_fork_fixup () { FHSETF (FFIXUP); }
|
|
|
|
|
|
|
|
virtual void set_close_on_exec (int val);
|
2000-10-26 18:13:41 +08:00
|
|
|
|
|
|
|
virtual void fixup_before_fork_exec (DWORD) {}
|
|
|
|
virtual void fixup_after_fork (HANDLE);
|
|
|
|
virtual void fixup_after_exec (HANDLE) {}
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-11-24 11:11:39 +08:00
|
|
|
bool get_symlink_p () { return FHISSETF (SYMLINK); }
|
2000-02-18 03:38:33 +08:00
|
|
|
void set_symlink_p (int val) { FHCONDSETF (val, SYMLINK); }
|
|
|
|
void set_symlink_p () { FHSETF (SYMLINK); }
|
|
|
|
|
2001-11-24 11:11:39 +08:00
|
|
|
bool get_socket_p () { return FHISSETF (LOCAL); }
|
2000-02-18 03:38:33 +08:00
|
|
|
void set_socket_p (int val) { FHCONDSETF (val, LOCAL); }
|
|
|
|
void set_socket_p () { FHSETF (LOCAL); }
|
|
|
|
|
2001-11-24 11:11:39 +08:00
|
|
|
bool get_execable_p () { return FHISSETF (EXECABL); }
|
2001-03-05 14:28:25 +08:00
|
|
|
void set_execable_p (executable_states val)
|
|
|
|
{
|
|
|
|
FHCONDSETF (val == is_executable, EXECABL);
|
2001-05-31 13:25:46 +08:00
|
|
|
FHCONDSETF (val == dont_care_if_executable, DCEXEC);
|
2001-03-05 14:28:25 +08:00
|
|
|
}
|
2000-02-18 03:38:33 +08:00
|
|
|
void set_execable_p () { FHSETF (EXECABL); }
|
2001-11-24 11:11:39 +08:00
|
|
|
bool dont_care_if_execable () { return FHISSETF (DCEXEC); }
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-11-24 11:11:39 +08:00
|
|
|
bool get_append_p () { return FHISSETF (APPEND); }
|
2000-02-18 03:38:33 +08:00
|
|
|
void set_append_p (int val) { FHCONDSETF (val, APPEND); }
|
|
|
|
void set_append_p () { FHSETF (APPEND); }
|
|
|
|
|
2001-11-24 11:11:39 +08:00
|
|
|
bool get_query_open () { return FHISSETF (QUERYOPEN); }
|
2001-06-15 02:21:17 +08:00
|
|
|
void set_query_open (int val) { FHCONDSETF (val, QUERYOPEN); }
|
|
|
|
|
2001-11-24 11:11:39 +08:00
|
|
|
bool get_readahead_valid () { return raixget < ralen; }
|
2000-02-18 03:38:33 +08:00
|
|
|
int puts_readahead (const char *s, size_t len = (size_t) -1);
|
|
|
|
int put_readahead (char value);
|
|
|
|
|
|
|
|
int get_readahead ();
|
|
|
|
int peek_readahead (int queryput = 0);
|
|
|
|
|
|
|
|
int eat_readahead (int n);
|
|
|
|
|
|
|
|
void set_readahead_valid (int val, int ch = -1);
|
|
|
|
|
2000-03-12 14:29:54 +08:00
|
|
|
int get_readahead_into_buffer (char *buf, size_t buflen);
|
|
|
|
|
2001-11-24 11:11:39 +08:00
|
|
|
bool has_acls () { return FHISSETF (HASACLS); }
|
2000-02-18 03:38:33 +08:00
|
|
|
void set_has_acls (int val) { FHCONDSETF (val, HASACLS); }
|
|
|
|
|
2001-11-24 11:11:39 +08:00
|
|
|
bool isremote () { return FHISSETF (ISREMOTE); }
|
2001-05-31 13:25:46 +08:00
|
|
|
void set_isremote (int val) { FHCONDSETF (val, ISREMOTE); }
|
|
|
|
|
2001-04-24 10:07:58 +08:00
|
|
|
const char *get_name () { return unix_path_name; }
|
|
|
|
const char *get_win32_name () { return win32_path_name; }
|
|
|
|
unsigned long get_namehash () { return namehash; }
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2000-04-20 12:38:10 +08:00
|
|
|
virtual void hclose (HANDLE h) {CloseHandle (h);}
|
2001-09-21 04:58:29 +08:00
|
|
|
virtual void set_inheritance (HANDLE &h, int not_inheriting);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
/* fixup fd possibly non-inherited handles after fork */
|
|
|
|
void fork_fixup (HANDLE parent, HANDLE &h, const char *name);
|
|
|
|
|
2001-10-04 10:34:20 +08:00
|
|
|
virtual int open (path_conv * real_path, int flags, mode_t mode = 0);
|
2000-02-18 03:38:33 +08:00
|
|
|
virtual int close ();
|
2001-10-24 12:16:45 +08:00
|
|
|
virtual int __stdcall fstat (struct stat *buf, path_conv *) __attribute__ ((regparm (3)));
|
2000-02-18 03:38:33 +08:00
|
|
|
virtual int ioctl (unsigned int cmd, void *);
|
2000-10-24 04:16:52 +08:00
|
|
|
virtual int fcntl (int cmd, void *);
|
2000-02-18 03:38:33 +08:00
|
|
|
virtual char const * ttyname () { return get_name(); }
|
2001-10-24 12:16:45 +08:00
|
|
|
virtual int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
|
2000-02-18 03:38:33 +08:00
|
|
|
virtual int write (const void *ptr, size_t len);
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
virtual __off32_t lseek (__off32_t offset, int whence);
|
2000-02-18 03:38:33 +08:00
|
|
|
virtual int lock (int, struct flock *);
|
|
|
|
virtual void dump ();
|
|
|
|
virtual int dup (fhandler_base *child);
|
|
|
|
|
2000-10-05 21:07:02 +08:00
|
|
|
virtual HANDLE mmap (caddr_t *addr, size_t len, DWORD access,
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
int flags, __off32_t off);
|
2000-10-05 21:07:02 +08:00
|
|
|
virtual int munmap (HANDLE h, caddr_t addr, size_t len);
|
|
|
|
virtual int msync (HANDLE h, caddr_t addr, size_t len, int flags);
|
2001-01-11 20:33:12 +08:00
|
|
|
virtual BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
|
|
|
|
DWORD size, void *address);
|
2000-10-05 21:07:02 +08:00
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
void *operator new (size_t, void *p) {return p;}
|
|
|
|
|
|
|
|
virtual void init (HANDLE, DWORD, mode_t);
|
|
|
|
|
|
|
|
virtual int tcflush (int);
|
|
|
|
virtual int tcsendbreak (int);
|
|
|
|
virtual int tcdrain ();
|
|
|
|
virtual int tcflow (int);
|
|
|
|
virtual int tcsetattr (int a, const struct termios *t);
|
|
|
|
virtual int tcgetattr (struct termios *t);
|
|
|
|
virtual int tcsetpgrp (const pid_t pid);
|
|
|
|
virtual int tcgetpgrp ();
|
|
|
|
virtual int is_tty () { return 0; }
|
|
|
|
virtual BOOL is_device () { return TRUE; }
|
|
|
|
virtual char *ptsname () { return NULL;}
|
|
|
|
virtual class fhandler_socket *is_socket () { return 0; }
|
|
|
|
virtual class fhandler_console *is_console () { return 0; }
|
|
|
|
virtual int is_windows () {return 0; }
|
|
|
|
|
|
|
|
virtual int raw_read (void *ptr, size_t ulen);
|
|
|
|
virtual int raw_write (const void *ptr, size_t ulen);
|
|
|
|
|
|
|
|
/* Virtual accessor functions to hide the fact
|
|
|
|
that some fd's have two handles. */
|
2001-03-11 09:58:23 +08:00
|
|
|
virtual HANDLE& get_handle () { return io_handle; }
|
|
|
|
virtual HANDLE& get_io_handle () { return io_handle; }
|
|
|
|
virtual HANDLE& get_output_handle () { return io_handle; }
|
2001-09-25 05:50:44 +08:00
|
|
|
virtual bool hit_eof () {return FALSE;}
|
2000-02-18 03:38:33 +08:00
|
|
|
virtual select_record *select_read (select_record *s);
|
|
|
|
virtual select_record *select_write (select_record *s);
|
|
|
|
virtual select_record *select_except (select_record *s);
|
2001-11-04 10:31:58 +08:00
|
|
|
virtual int ready_for_read (int fd, DWORD howlong);
|
2000-02-18 03:38:33 +08:00
|
|
|
virtual const char * get_native_name ()
|
|
|
|
{
|
|
|
|
return windows_device_names[FHDEVN (status)];
|
|
|
|
}
|
2001-01-17 22:57:09 +08:00
|
|
|
virtual bg_check_types bg_check (int) {return bg_ok;}
|
2000-09-03 12:16:35 +08:00
|
|
|
void clear_readahead ()
|
|
|
|
{
|
|
|
|
raixput = raixget = ralen = rabuflen = 0;
|
|
|
|
rabuf = NULL;
|
|
|
|
}
|
|
|
|
void operator delete (void *);
|
2001-11-03 11:32:27 +08:00
|
|
|
virtual HANDLE get_guard () const {return NULL;}
|
2001-11-03 13:42:21 +08:00
|
|
|
virtual void set_eof () {}
|
2001-11-22 13:59:07 +08:00
|
|
|
virtual DIR *opendir (path_conv& pc);
|
2001-11-21 14:47:57 +08:00
|
|
|
virtual dirent *readdir (DIR *);
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
virtual __off32_t telldir (DIR *);
|
|
|
|
virtual void seekdir (DIR *, __off32_t);
|
2001-11-21 14:47:57 +08:00
|
|
|
virtual void rewinddir (DIR *);
|
|
|
|
virtual int closedir (DIR *);
|
2000-02-18 03:38:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class fhandler_socket: public fhandler_base
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
private:
|
2000-02-18 03:38:33 +08:00
|
|
|
int addr_family;
|
2001-04-09 15:21:32 +08:00
|
|
|
int connect_secret [4];
|
|
|
|
HANDLE secret_event;
|
2000-10-26 18:13:41 +08:00
|
|
|
struct _WSAPROTOCOL_INFOA *prot_info_ptr;
|
2002-01-02 00:25:31 +08:00
|
|
|
char *sun_path;
|
2000-10-26 18:13:41 +08:00
|
|
|
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_socket ();
|
2000-10-26 18:13:41 +08:00
|
|
|
~fhandler_socket ();
|
2001-03-11 09:58:23 +08:00
|
|
|
int get_socket () { return (int) get_handle(); }
|
2000-02-18 03:38:33 +08:00
|
|
|
fhandler_socket * is_socket () { return this; }
|
2001-08-31 13:06:14 +08:00
|
|
|
|
2001-09-01 13:17:34 +08:00
|
|
|
bool saw_shutdown_read () const {return FHISSETF (SHUTRD);}
|
|
|
|
bool saw_shutdown_write () const {return FHISSETF (SHUTWR);}
|
2001-08-31 13:06:14 +08:00
|
|
|
|
|
|
|
void set_shutdown_read () {FHSETF (SHUTRD);}
|
|
|
|
void set_shutdown_write () {FHSETF (SHUTWR);}
|
|
|
|
|
2002-02-09 18:40:48 +08:00
|
|
|
int recv (void *ptr, size_t len, unsigned int flags);
|
2001-10-24 12:16:45 +08:00
|
|
|
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
|
2002-02-09 18:40:48 +08:00
|
|
|
|
|
|
|
int send (const void *ptr, size_t len, unsigned int flags);
|
|
|
|
int write (const void *ptr, size_t len);
|
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
int ioctl (unsigned int cmd, void *);
|
2000-10-24 04:16:52 +08:00
|
|
|
int fcntl (int cmd, void *);
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
__off32_t lseek (__off32_t, int) { return 0; }
|
2000-02-18 03:38:33 +08:00
|
|
|
int close ();
|
2000-04-20 12:38:10 +08:00
|
|
|
void hclose (HANDLE) {close ();}
|
2000-10-26 18:13:41 +08:00
|
|
|
int dup (fhandler_base *child);
|
|
|
|
|
2001-06-23 04:53:45 +08:00
|
|
|
void set_close_on_exec (int val);
|
2000-10-26 18:13:41 +08:00
|
|
|
virtual void fixup_before_fork_exec (DWORD);
|
|
|
|
void fixup_after_fork (HANDLE);
|
2001-09-20 19:29:48 +08:00
|
|
|
void fixup_after_exec (HANDLE);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
select_record *select_read (select_record *s);
|
|
|
|
select_record *select_write (select_record *s);
|
|
|
|
select_record *select_except (select_record *s);
|
|
|
|
void set_addr_family (int af) {addr_family = af;}
|
2002-02-08 19:54:10 +08:00
|
|
|
int get_addr_family () {return addr_family;}
|
2002-01-02 00:25:31 +08:00
|
|
|
void set_sun_path (const char *path);
|
|
|
|
char *get_sun_path () {return sun_path;}
|
2001-04-09 15:21:32 +08:00
|
|
|
void set_connect_secret ();
|
|
|
|
void get_connect_secret (char*);
|
|
|
|
HANDLE create_secret_event (int *secret = NULL);
|
|
|
|
int check_peer_secret_event (struct sockaddr_in *peer, int *secret = NULL);
|
2001-06-20 14:50:13 +08:00
|
|
|
void signal_secret_event ();
|
2001-04-09 15:21:32 +08:00
|
|
|
void close_secret_event ();
|
2001-10-24 12:16:45 +08:00
|
|
|
int __stdcall fstat (struct stat *buf, path_conv *) __attribute__ ((regparm (3)));
|
2000-02-18 03:38:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class fhandler_pipe: public fhandler_base
|
|
|
|
{
|
2001-09-23 00:55:02 +08:00
|
|
|
HANDLE guard;
|
2001-11-05 09:52:20 +08:00
|
|
|
bool broken_pipe;
|
2001-09-25 05:50:44 +08:00
|
|
|
HANDLE writepipe_exists;
|
|
|
|
DWORD orig_pid;
|
|
|
|
unsigned id;
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2001-11-24 11:11:39 +08:00
|
|
|
fhandler_pipe (DWORD devtype);
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
__off32_t lseek (__off32_t offset, int whence);
|
2000-02-18 03:38:33 +08:00
|
|
|
select_record *select_read (select_record *s);
|
|
|
|
select_record *select_write (select_record *s);
|
|
|
|
select_record *select_except (select_record *s);
|
2001-09-23 00:55:02 +08:00
|
|
|
void set_close_on_exec (int val);
|
2001-10-24 12:16:45 +08:00
|
|
|
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
|
2001-09-23 00:55:02 +08:00
|
|
|
int close ();
|
|
|
|
void create_guard (SECURITY_ATTRIBUTES *sa) {guard = CreateMutex (sa, FALSE, NULL);}
|
|
|
|
int dup (fhandler_base *child);
|
2001-09-29 09:23:06 +08:00
|
|
|
void fixup_after_fork (HANDLE);
|
2001-09-25 05:50:44 +08:00
|
|
|
bool hit_eof ();
|
2001-11-05 09:52:20 +08:00
|
|
|
void set_eof () {broken_pipe = true;}
|
2001-09-25 05:50:44 +08:00
|
|
|
friend int make_pipe (int fildes[2], unsigned int psize, int mode);
|
2001-11-02 05:15:53 +08:00
|
|
|
HANDLE get_guard () const {return guard;}
|
2000-02-18 03:38:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class fhandler_dev_raw: public fhandler_base
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
protected:
|
2000-02-18 03:38:33 +08:00
|
|
|
char *devbuf;
|
|
|
|
size_t devbufsiz;
|
|
|
|
size_t devbufstart;
|
|
|
|
size_t devbufend;
|
|
|
|
int eom_detected : 1;
|
|
|
|
int eof_detected : 1;
|
|
|
|
int lastblk_to_read : 1;
|
|
|
|
int is_writing : 1;
|
|
|
|
int has_written : 1;
|
2001-08-31 13:23:04 +08:00
|
|
|
int varblkop : 1;
|
2000-02-18 03:38:33 +08:00
|
|
|
int unit;
|
|
|
|
|
|
|
|
virtual void clear (void);
|
|
|
|
virtual int writebuf (void);
|
|
|
|
|
|
|
|
/* returns not null, if `win_error' determines an end of media condition */
|
|
|
|
virtual int is_eom(int win_error) = 0;
|
|
|
|
/* returns not null, if `win_error' determines an end of file condition */
|
|
|
|
virtual int is_eof(int win_error) = 0;
|
|
|
|
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_dev_raw (DWORD dev, int unit);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2000-02-18 03:38:33 +08:00
|
|
|
~fhandler_dev_raw (void);
|
|
|
|
|
2001-10-16 22:53:26 +08:00
|
|
|
int get_unit () { return unit; }
|
|
|
|
|
2001-10-04 10:34:20 +08:00
|
|
|
int open (path_conv *, int flags, mode_t mode = 0);
|
2000-02-18 03:38:33 +08:00
|
|
|
int close (void);
|
|
|
|
|
|
|
|
int raw_read (void *ptr, size_t ulen);
|
|
|
|
int raw_write (const void *ptr, size_t ulen);
|
|
|
|
|
|
|
|
int dup (fhandler_base *child);
|
|
|
|
|
|
|
|
int ioctl (unsigned int cmd, void *buf);
|
2000-11-01 06:20:59 +08:00
|
|
|
|
|
|
|
void fixup_after_fork (HANDLE);
|
2001-09-20 19:29:48 +08:00
|
|
|
void fixup_after_exec (HANDLE);
|
2000-02-18 03:38:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class fhandler_dev_floppy: public fhandler_dev_raw
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
protected:
|
2000-02-18 03:38:33 +08:00
|
|
|
virtual int is_eom (int win_error);
|
|
|
|
virtual int is_eof (int win_error);
|
|
|
|
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_dev_floppy (int unit);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-10-04 10:34:20 +08:00
|
|
|
virtual int open (path_conv *, int flags, mode_t mode = 0);
|
2000-02-18 03:38:33 +08:00
|
|
|
virtual int close (void);
|
|
|
|
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
virtual __off32_t lseek (__off32_t offset, int whence);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
virtual int ioctl (unsigned int cmd, void *buf);
|
|
|
|
};
|
|
|
|
|
|
|
|
class fhandler_dev_tape: public fhandler_dev_raw
|
|
|
|
{
|
|
|
|
int lasterr;
|
|
|
|
|
2001-10-16 22:53:26 +08:00
|
|
|
bool is_rewind_device () { return get_unit () < 128; }
|
|
|
|
|
2001-11-02 05:15:53 +08:00
|
|
|
protected:
|
2000-02-18 03:38:33 +08:00
|
|
|
virtual void clear (void);
|
|
|
|
|
|
|
|
virtual int is_eom (int win_error);
|
|
|
|
virtual int is_eof (int win_error);
|
|
|
|
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_dev_tape (int unit);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-10-05 12:21:41 +08:00
|
|
|
int open (path_conv *, int flags, mode_t mode = 0);
|
|
|
|
int close (void);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
__off32_t lseek (__off32_t offset, int whence);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-10-24 12:16:45 +08:00
|
|
|
int __stdcall fstat (struct stat *buf, path_conv *) __attribute__ ((regparm (3)));
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-10-05 12:21:41 +08:00
|
|
|
int dup (fhandler_base *child);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-10-05 12:21:41 +08:00
|
|
|
int ioctl (unsigned int cmd, void *buf);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-11-02 05:15:53 +08:00
|
|
|
private:
|
2000-02-18 03:38:33 +08:00
|
|
|
int tape_write_marks (int marktype, DWORD len);
|
|
|
|
int tape_get_pos (unsigned long *ret);
|
|
|
|
int tape_set_pos (int mode, long count, BOOLEAN sfm_func = FALSE);
|
|
|
|
int tape_erase (int mode);
|
|
|
|
int tape_prepare (int action);
|
|
|
|
BOOLEAN tape_get_feature (DWORD parm);
|
|
|
|
int tape_get_blocksize (long *min, long *def, long *max, long *cur);
|
|
|
|
int tape_set_blocksize (long count);
|
|
|
|
int tape_status (struct mtget *get);
|
|
|
|
int tape_compression (long count);
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Standard disk file */
|
|
|
|
|
|
|
|
class fhandler_disk_file: public fhandler_base
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_disk_file ();
|
2001-11-22 13:59:07 +08:00
|
|
|
fhandler_disk_file (DWORD devtype);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-10-04 10:34:20 +08:00
|
|
|
int open (path_conv * real_path, int flags, mode_t mode);
|
2000-02-18 03:38:33 +08:00
|
|
|
int close ();
|
|
|
|
int lock (int, struct flock *);
|
|
|
|
BOOL is_device () { return FALSE; }
|
2001-10-24 12:16:45 +08:00
|
|
|
int __stdcall fstat (struct stat *buf, path_conv *pc) __attribute__ ((regparm (3)));
|
|
|
|
int __stdcall fstat_helper (struct stat *buf) __attribute__ ((regparm (2)));
|
2000-10-05 21:07:02 +08:00
|
|
|
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, __off32_t off);
|
2000-10-08 01:35:36 +08:00
|
|
|
int munmap (HANDLE h, caddr_t addr, size_t len);
|
|
|
|
int msync (HANDLE h, caddr_t addr, size_t len, int flags);
|
2001-01-11 20:33:12 +08:00
|
|
|
BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
|
|
|
|
DWORD size, void *address);
|
2001-11-22 13:59:07 +08:00
|
|
|
DIR *opendir (path_conv& pc);
|
2001-11-21 14:47:57 +08:00
|
|
|
struct dirent *readdir (DIR *);
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
__off32_t telldir (DIR *);
|
|
|
|
void seekdir (DIR *, __off32_t);
|
2001-11-21 14:47:57 +08:00
|
|
|
void rewinddir (DIR *);
|
|
|
|
int closedir (DIR *);
|
2000-02-18 03:38:33 +08:00
|
|
|
};
|
|
|
|
|
2001-11-22 13:59:07 +08:00
|
|
|
class fhandler_cygdrive: public fhandler_disk_file
|
|
|
|
{
|
|
|
|
int unit;
|
|
|
|
int ndrives;
|
|
|
|
const char *pdrive;
|
|
|
|
void set_drives ();
|
|
|
|
public:
|
|
|
|
bool iscygdrive_root () const { return !unit; }
|
|
|
|
fhandler_cygdrive (int unit);
|
|
|
|
DIR *opendir (path_conv& pc);
|
|
|
|
struct dirent *readdir (DIR *);
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
__off32_t telldir (DIR *);
|
|
|
|
void seekdir (DIR *, __off32_t);
|
2001-11-22 13:59:07 +08:00
|
|
|
void rewinddir (DIR *);
|
|
|
|
int closedir (DIR *);
|
|
|
|
int __stdcall fstat (struct stat *buf, path_conv *pc) __attribute__ ((regparm (3)));
|
|
|
|
};
|
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
class fhandler_serial: public fhandler_base
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
private:
|
2000-02-18 03:38:33 +08:00
|
|
|
unsigned int vmin_; /* from termios */
|
|
|
|
unsigned int vtime_; /* from termios */
|
|
|
|
pid_t pgrp_;
|
|
|
|
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2000-02-18 03:38:33 +08:00
|
|
|
int overlapped_armed;
|
|
|
|
OVERLAPPED io_status;
|
2001-12-11 08:24:46 +08:00
|
|
|
DWORD ev;
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
/* Constructor */
|
2001-10-29 13:28:24 +08:00
|
|
|
fhandler_serial (int unit);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-10-04 10:34:20 +08:00
|
|
|
int open (path_conv *, int flags, mode_t mode);
|
2000-02-18 03:38:33 +08:00
|
|
|
int close ();
|
|
|
|
void init (HANDLE h, DWORD a, mode_t flags);
|
|
|
|
void overlapped_setup ();
|
|
|
|
int dup (fhandler_base *child);
|
|
|
|
int raw_read (void *ptr, size_t ulen);
|
|
|
|
int raw_write (const void *ptr, size_t ulen);
|
|
|
|
int tcsendbreak (int);
|
|
|
|
int tcdrain ();
|
|
|
|
int tcflow (int);
|
|
|
|
int tcsetattr (int a, const struct termios *t);
|
|
|
|
int tcgetattr (struct termios *t);
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
__off32_t lseek (__off32_t, int) { return 0; }
|
2000-02-18 03:38:33 +08:00
|
|
|
int tcflush (int);
|
|
|
|
void dump ();
|
|
|
|
int is_tty () { return 1; }
|
|
|
|
void fixup_after_fork (HANDLE parent);
|
2000-09-03 12:16:35 +08:00
|
|
|
void fixup_after_exec (HANDLE);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
/* We maintain a pgrp so that tcsetpgrp and tcgetpgrp work, but we
|
|
|
|
don't use it for permissions checking. fhandler_tty_slave does
|
|
|
|
permission checking on pgrps. */
|
|
|
|
virtual int tcgetpgrp () { return pgrp_; }
|
|
|
|
virtual int tcsetpgrp (const pid_t pid) { pgrp_ = pid; return 0; }
|
|
|
|
select_record *select_read (select_record *s);
|
|
|
|
select_record *select_write (select_record *s);
|
|
|
|
select_record *select_except (select_record *s);
|
|
|
|
};
|
|
|
|
|
2000-09-07 09:18:37 +08:00
|
|
|
#define acquire_output_mutex(ms) \
|
|
|
|
__acquire_output_mutex (__PRETTY_FUNCTION__, __LINE__, ms);
|
|
|
|
|
|
|
|
#define release_output_mutex() \
|
|
|
|
__release_output_mutex (__PRETTY_FUNCTION__, __LINE__);
|
|
|
|
|
2000-09-08 00:23:51 +08:00
|
|
|
class tty;
|
|
|
|
class tty_min;
|
2000-02-18 03:38:33 +08:00
|
|
|
class fhandler_termios: public fhandler_base
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
protected:
|
2000-02-18 03:38:33 +08:00
|
|
|
HANDLE output_handle;
|
2000-02-21 13:20:38 +08:00
|
|
|
virtual void doecho (const void *, DWORD) {};
|
2000-02-18 03:38:33 +08:00
|
|
|
virtual int accept_input () {return 1;};
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2000-02-18 03:38:33 +08:00
|
|
|
tty_min *tc;
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_termios (DWORD dev, int unit = 0) :
|
|
|
|
fhandler_base (dev, unit)
|
2000-02-18 03:38:33 +08:00
|
|
|
{
|
2001-03-13 04:39:40 +08:00
|
|
|
set_need_fork_fixup ();
|
2000-02-18 03:38:33 +08:00
|
|
|
}
|
2001-03-11 09:58:23 +08:00
|
|
|
HANDLE& get_output_handle () { return output_handle; }
|
2000-02-18 03:38:33 +08:00
|
|
|
int line_edit (const char *rptr, int nread, int always_accept = 0);
|
|
|
|
void set_output_handle (HANDLE h) { output_handle = h; }
|
|
|
|
void tcinit (tty_min *this_tc, int force = FALSE);
|
|
|
|
virtual int is_tty () { return 1; }
|
|
|
|
int tcgetpgrp ();
|
|
|
|
int tcsetpgrp (int pid);
|
2001-01-17 22:57:09 +08:00
|
|
|
bg_check_types bg_check (int sig);
|
2000-09-07 09:18:37 +08:00
|
|
|
virtual DWORD __acquire_output_mutex (const char *fn, int ln, DWORD ms) {return 1;}
|
|
|
|
virtual void __release_output_mutex (const char *fn, int ln) {}
|
2001-03-13 05:27:42 +08:00
|
|
|
void fixup_after_fork (HANDLE);
|
|
|
|
void fixup_after_exec (HANDLE parent) { fixup_after_fork (parent); }
|
2001-05-10 02:53:55 +08:00
|
|
|
void echo_erase (int force = 0);
|
2000-02-18 03:38:33 +08:00
|
|
|
};
|
|
|
|
|
2001-02-27 17:14:35 +08:00
|
|
|
enum ansi_intensity
|
2000-02-18 03:38:33 +08:00
|
|
|
{
|
2001-02-27 17:14:35 +08:00
|
|
|
INTENSITY_INVISIBLE,
|
|
|
|
INTENSITY_DIM,
|
|
|
|
INTENSITY_NORMAL,
|
|
|
|
INTENSITY_BOLD
|
|
|
|
};
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
#define normal 1
|
|
|
|
#define gotesc 2
|
|
|
|
#define gotsquare 3
|
|
|
|
#define gotarg1 4
|
|
|
|
#define gotrsquare 5
|
|
|
|
#define gotcommand 6
|
|
|
|
#define gettitle 7
|
|
|
|
#define eattitle 8
|
|
|
|
#define MAXARGS 10
|
2001-02-27 17:14:35 +08:00
|
|
|
|
|
|
|
/* This is a input and output console handle */
|
|
|
|
class fhandler_console: public fhandler_termios
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
private:
|
2001-02-27 17:14:35 +08:00
|
|
|
|
|
|
|
WORD default_color, underline_color, dim_color;
|
|
|
|
|
2001-03-06 20:05:45 +08:00
|
|
|
/* Used to determine if an input keystroke should be modified with META. */
|
|
|
|
int meta_mask;
|
|
|
|
|
2001-02-27 17:14:35 +08:00
|
|
|
/* Output state */
|
2000-02-18 03:38:33 +08:00
|
|
|
int state_;
|
|
|
|
int args_[MAXARGS];
|
|
|
|
int nargs_;
|
2001-02-27 17:14:35 +08:00
|
|
|
unsigned rarg;
|
2001-11-02 12:44:06 +08:00
|
|
|
bool saw_question_mark;
|
2001-02-27 17:14:35 +08:00
|
|
|
|
|
|
|
char my_title_buf [TITLESIZE + 1];
|
|
|
|
|
|
|
|
WORD current_win32_attr;
|
|
|
|
ansi_intensity intensity;
|
2001-11-02 12:44:06 +08:00
|
|
|
bool underline, blink, reverse;
|
2001-02-27 17:14:35 +08:00
|
|
|
WORD fg, bg;
|
|
|
|
|
|
|
|
/* saved cursor coordinates */
|
|
|
|
int savex, savey;
|
|
|
|
|
2001-03-30 19:10:13 +08:00
|
|
|
/* saved screen */
|
|
|
|
COORD savebufsiz;
|
|
|
|
PCHAR_INFO savebuf;
|
|
|
|
|
2001-02-27 17:14:35 +08:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
short Top, Bottom;
|
|
|
|
} scroll_region;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
SHORT winTop;
|
|
|
|
SHORT winBottom;
|
|
|
|
COORD dwWinSize;
|
|
|
|
COORD dwBufferSize;
|
|
|
|
COORD dwCursorPosition;
|
|
|
|
WORD wAttributes;
|
|
|
|
} info;
|
|
|
|
|
|
|
|
COORD dwLastCursorPosition;
|
|
|
|
DWORD dwLastButtonState;
|
|
|
|
int nModifiers;
|
|
|
|
|
2001-11-02 12:44:06 +08:00
|
|
|
bool insert_mode;
|
|
|
|
bool use_mouse;
|
|
|
|
bool raw_win32_keyboard_mode;
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
/* Output calls */
|
2001-02-27 17:14:35 +08:00
|
|
|
void set_default_attr ();
|
|
|
|
WORD get_win32_attr ();
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
BOOL fillin_info ();
|
|
|
|
void clear_screen (int, int, int, int);
|
|
|
|
void scroll_screen (int, int, int, int, int, int);
|
|
|
|
void cursor_set (BOOL, int, int);
|
|
|
|
void cursor_get (int *, int *);
|
|
|
|
void cursor_rel (int, int);
|
|
|
|
const unsigned char * write_normal (unsigned const char*, unsigned const char *);
|
2001-02-27 17:14:35 +08:00
|
|
|
void char_command (char);
|
|
|
|
BOOL set_raw_win32_keyboard_mode (BOOL);
|
2000-02-18 03:38:33 +08:00
|
|
|
int output_tcsetattr (int a, const struct termios *t);
|
|
|
|
|
|
|
|
/* Input calls */
|
|
|
|
int igncr_enabled ();
|
|
|
|
int input_tcsetattr (int a, const struct termios *t);
|
2000-07-29 12:19:24 +08:00
|
|
|
void set_cursor_maybe ();
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_console ();
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
fhandler_console* is_console () { return this; }
|
|
|
|
|
2001-10-04 10:34:20 +08:00
|
|
|
int open (path_conv *, int flags, mode_t mode = 0);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
int write (const void *ptr, size_t len);
|
|
|
|
void doecho (const void *str, DWORD len) { (void) write (str, len); }
|
2001-10-24 12:16:45 +08:00
|
|
|
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
|
2000-02-18 03:38:33 +08:00
|
|
|
int close ();
|
|
|
|
|
|
|
|
int tcflush (int);
|
|
|
|
int tcsetattr (int a, const struct termios *t);
|
|
|
|
int tcgetattr (struct termios *t);
|
|
|
|
|
|
|
|
/* Special dup as we must dup two handles */
|
|
|
|
int dup (fhandler_base *child);
|
|
|
|
|
|
|
|
int ioctl (unsigned int cmd, void *);
|
|
|
|
void init (HANDLE, DWORD, mode_t);
|
2001-03-02 09:55:21 +08:00
|
|
|
bool mouse_aware () {return use_mouse;}
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
select_record *select_read (select_record *s);
|
|
|
|
select_record *select_write (select_record *s);
|
|
|
|
select_record *select_except (select_record *s);
|
2000-09-03 12:16:35 +08:00
|
|
|
void fixup_after_exec (HANDLE);
|
2000-02-18 03:38:33 +08:00
|
|
|
void set_close_on_exec (int val);
|
|
|
|
void fixup_after_fork (HANDLE parent);
|
2000-09-08 00:23:51 +08:00
|
|
|
void set_input_state ();
|
2000-02-18 03:38:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class fhandler_tty_common: public fhandler_termios
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_tty_common (DWORD dev, int unit = 0)
|
2001-10-23 02:39:22 +08:00
|
|
|
: fhandler_termios (dev, unit), output_done_event (NULL),
|
|
|
|
ioctl_request_event (NULL), ioctl_done_event (NULL), output_mutex (NULL),
|
|
|
|
input_mutex (NULL), input_available_event (NULL), inuse (NULL), ttynum (unit)
|
2000-02-18 03:38:33 +08:00
|
|
|
{
|
|
|
|
// nothing to do
|
|
|
|
}
|
|
|
|
HANDLE output_done_event; // Raised by master when tty's output buffer
|
|
|
|
// written. Write status in tty::write_retval.
|
|
|
|
HANDLE ioctl_request_event; // Raised by slave to perform ioctl() request.
|
|
|
|
// Ioctl() request in tty::cmd/arg.
|
|
|
|
HANDLE ioctl_done_event; // Raised by master on ioctl() completion.
|
|
|
|
// Ioctl() status in tty::ioctl_retval.
|
2001-03-04 23:34:25 +08:00
|
|
|
HANDLE output_mutex, input_mutex;
|
|
|
|
HANDLE input_available_event;
|
2000-02-18 03:38:33 +08:00
|
|
|
HANDLE inuse; // used to indicate that a tty is in use
|
2001-10-23 02:39:22 +08:00
|
|
|
int ttynum; // Master tty num.
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
DWORD __acquire_output_mutex (const char *fn, int ln, DWORD ms);
|
|
|
|
void __release_output_mutex (const char *fn, int ln);
|
|
|
|
|
|
|
|
virtual int dup (fhandler_base *child);
|
|
|
|
|
|
|
|
tty *get_ttyp () { return (tty *)tc; }
|
|
|
|
int get_unit () { return ttynum; }
|
|
|
|
|
|
|
|
int close ();
|
|
|
|
void set_close_on_exec (int val);
|
|
|
|
void fixup_after_fork (HANDLE parent);
|
|
|
|
select_record *select_read (select_record *s);
|
|
|
|
select_record *select_write (select_record *s);
|
|
|
|
select_record *select_except (select_record *s);
|
|
|
|
};
|
|
|
|
|
|
|
|
class fhandler_tty_slave: public fhandler_tty_common
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2000-02-18 03:38:33 +08:00
|
|
|
/* Constructor */
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_tty_slave ();
|
|
|
|
fhandler_tty_slave (int);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-10-04 10:34:20 +08:00
|
|
|
int open (path_conv *, int flags, mode_t mode = 0);
|
2000-02-18 03:38:33 +08:00
|
|
|
int write (const void *ptr, size_t len);
|
2001-10-24 12:16:45 +08:00
|
|
|
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
|
2000-02-18 03:38:33 +08:00
|
|
|
void init (HANDLE, DWORD, mode_t);
|
|
|
|
|
|
|
|
int tcsetattr (int a, const struct termios *t);
|
|
|
|
int tcgetattr (struct termios *t);
|
|
|
|
int tcflush (int);
|
|
|
|
int ioctl (unsigned int cmd, void *);
|
|
|
|
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
__off32_t lseek (__off32_t, int) { return 0; }
|
2001-03-19 02:05:01 +08:00
|
|
|
select_record *select_read (select_record *s);
|
2001-11-04 10:31:58 +08:00
|
|
|
int ready_for_read (int fd, DWORD howlong);
|
2000-02-18 03:38:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class fhandler_pty_master: public fhandler_tty_common
|
|
|
|
{
|
|
|
|
int pktmode; // non-zero if pty in a packet mode.
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2000-03-12 14:29:54 +08:00
|
|
|
int need_nl; // Next read should start with \n
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
/* Constructor */
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_pty_master (DWORD devtype = FH_PTYM, int unit = -1);
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2000-03-12 14:29:54 +08:00
|
|
|
int process_slave_output (char *buf, size_t len, int pktmode_on);
|
2000-02-18 03:38:33 +08:00
|
|
|
void doecho (const void *str, DWORD len);
|
|
|
|
int accept_input ();
|
2001-10-04 10:34:20 +08:00
|
|
|
int open (path_conv *, int flags, mode_t mode = 0);
|
2000-02-18 03:38:33 +08:00
|
|
|
int write (const void *ptr, size_t len);
|
2001-10-24 12:16:45 +08:00
|
|
|
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
|
2000-02-18 03:38:33 +08:00
|
|
|
int close ();
|
|
|
|
|
|
|
|
int tcsetattr (int a, const struct termios *t);
|
|
|
|
int tcgetattr (struct termios *t);
|
|
|
|
int tcflush (int);
|
|
|
|
int ioctl (unsigned int cmd, void *);
|
|
|
|
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
__off32_t lseek (__off32_t, int) { return 0; }
|
2000-02-18 03:38:33 +08:00
|
|
|
char *ptsname ();
|
|
|
|
|
|
|
|
void set_close_on_exec (int val);
|
2001-09-25 05:50:44 +08:00
|
|
|
bool hit_eof ();
|
2000-02-18 03:38:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class fhandler_tty_master: public fhandler_pty_master
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2000-02-18 03:38:33 +08:00
|
|
|
/* Constructor */
|
|
|
|
fhandler_console *console; // device handler to perform real i/o.
|
|
|
|
HANDLE hThread; // process_output thread handle.
|
|
|
|
|
2001-10-23 02:39:22 +08:00
|
|
|
fhandler_tty_master (int unit);
|
2000-02-18 03:38:33 +08:00
|
|
|
int init (int);
|
|
|
|
int init_console ();
|
|
|
|
void fixup_after_fork (HANDLE parent);
|
2000-09-03 12:16:35 +08:00
|
|
|
void fixup_after_exec (HANDLE);
|
2000-02-18 03:38:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class fhandler_dev_null: public fhandler_base
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_dev_null ();
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
void dump ();
|
|
|
|
select_record *select_read (select_record *s);
|
|
|
|
select_record *select_write (select_record *s);
|
|
|
|
select_record *select_except (select_record *s);
|
|
|
|
};
|
|
|
|
|
|
|
|
class fhandler_dev_zero: public fhandler_base
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_dev_zero ();
|
2001-10-04 10:34:20 +08:00
|
|
|
int open (path_conv *, int flags, mode_t mode = 0);
|
2000-02-18 03:38:33 +08:00
|
|
|
int write (const void *ptr, size_t len);
|
2001-10-24 12:16:45 +08:00
|
|
|
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
__off32_t lseek (__off32_t offset, int whence);
|
2000-02-18 03:38:33 +08:00
|
|
|
int close (void);
|
|
|
|
|
|
|
|
void dump ();
|
|
|
|
};
|
|
|
|
|
2000-05-03 23:39:10 +08:00
|
|
|
class fhandler_dev_random: public fhandler_base
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
protected:
|
2000-05-03 23:39:10 +08:00
|
|
|
int unit;
|
|
|
|
HCRYPTPROV crypt_prov;
|
2000-07-24 19:33:02 +08:00
|
|
|
long pseudo;
|
|
|
|
|
|
|
|
BOOL crypt_gen_random (void *ptr, size_t len);
|
|
|
|
int pseudo_write (const void *ptr, size_t len);
|
|
|
|
int pseudo_read (void *ptr, size_t len);
|
2000-07-24 05:13:05 +08:00
|
|
|
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_dev_random (int unit);
|
2000-05-03 23:39:10 +08:00
|
|
|
int get_unit () { return unit; }
|
2001-10-04 10:34:20 +08:00
|
|
|
int open (path_conv *, int flags, mode_t mode = 0);
|
2000-05-03 23:39:10 +08:00
|
|
|
int write (const void *ptr, size_t len);
|
2001-10-24 12:16:45 +08:00
|
|
|
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
__off32_t lseek (__off32_t offset, int whence);
|
2000-05-03 23:39:10 +08:00
|
|
|
int close (void);
|
|
|
|
int dup (fhandler_base *child);
|
|
|
|
|
|
|
|
void dump ();
|
|
|
|
};
|
|
|
|
|
2000-10-01 09:02:40 +08:00
|
|
|
class fhandler_dev_mem: public fhandler_base
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
protected:
|
2000-10-08 01:35:36 +08:00
|
|
|
int unit;
|
|
|
|
DWORD mem_size;
|
|
|
|
DWORD pos;
|
2000-10-01 09:02:40 +08:00
|
|
|
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_dev_mem (int unit);
|
2000-10-01 09:02:40 +08:00
|
|
|
~fhandler_dev_mem (void);
|
|
|
|
|
2001-10-04 10:34:20 +08:00
|
|
|
int open (path_conv *, int flags, mode_t mode = 0);
|
2000-10-01 09:02:40 +08:00
|
|
|
int write (const void *ptr, size_t ulen);
|
2001-10-24 12:16:45 +08:00
|
|
|
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
__off32_t lseek (__off32_t offset, int whence);
|
2000-10-01 09:02:40 +08:00
|
|
|
int close (void);
|
2001-10-24 12:16:45 +08:00
|
|
|
int __stdcall fstat (struct stat *buf, path_conv *) __attribute__ ((regparm (3)));
|
2000-10-01 09:02:40 +08:00
|
|
|
int dup (fhandler_base *child);
|
|
|
|
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, __off32_t off);
|
2000-10-08 01:35:36 +08:00
|
|
|
int munmap (HANDLE h, caddr_t addr, size_t len);
|
|
|
|
int msync (HANDLE h, caddr_t addr, size_t len, int flags);
|
2001-01-11 20:33:12 +08:00
|
|
|
BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
|
|
|
|
DWORD size, void *address);
|
2000-10-08 01:35:36 +08:00
|
|
|
|
2000-10-17 09:46:26 +08:00
|
|
|
void dump ();
|
|
|
|
} ;
|
2000-10-28 13:41:44 +08:00
|
|
|
|
2000-10-17 09:46:26 +08:00
|
|
|
class fhandler_dev_clipboard: public fhandler_base
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_dev_clipboard ();
|
2000-10-17 09:46:26 +08:00
|
|
|
int is_windows (void) { return 1; }
|
2001-10-04 10:34:20 +08:00
|
|
|
int open (path_conv *, int flags, mode_t mode = 0);
|
2000-10-17 09:46:26 +08:00
|
|
|
int write (const void *ptr, size_t len);
|
2001-10-24 12:16:45 +08:00
|
|
|
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
__off32_t lseek (__off32_t offset, int whence);
|
2000-10-17 09:46:26 +08:00
|
|
|
int close (void);
|
|
|
|
|
2001-03-23 06:11:34 +08:00
|
|
|
int dup (fhandler_base *child);
|
|
|
|
|
2000-10-01 09:02:40 +08:00
|
|
|
void dump ();
|
2001-03-23 06:11:34 +08:00
|
|
|
|
2001-11-02 05:15:53 +08:00
|
|
|
private:
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
__off32_t pos;
|
2001-03-23 06:11:34 +08:00
|
|
|
void *membuffer;
|
|
|
|
size_t msize;
|
2001-11-02 12:44:06 +08:00
|
|
|
bool eof;
|
2000-10-01 09:02:40 +08:00
|
|
|
};
|
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
class fhandler_windows: public fhandler_base
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
private:
|
2000-02-18 03:38:33 +08:00
|
|
|
HWND hWnd_; // the window whose messages are to be retrieved by read() call
|
|
|
|
int method_; // write method (Post or Send)
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_windows ();
|
2000-02-18 03:38:33 +08:00
|
|
|
int is_windows (void) { return 1; }
|
2001-10-04 10:34:20 +08:00
|
|
|
int open (path_conv *, int flags, mode_t mode = 0);
|
2000-02-18 03:38:33 +08:00
|
|
|
int write (const void *ptr, size_t len);
|
2001-10-24 12:16:45 +08:00
|
|
|
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
|
2000-02-18 03:38:33 +08:00
|
|
|
int ioctl (unsigned int cmd, void *);
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
__off32_t lseek (__off32_t, int) { return 0; }
|
2000-02-18 03:38:33 +08:00
|
|
|
int close (void) { return 0; }
|
|
|
|
|
|
|
|
void set_close_on_exec (int val);
|
|
|
|
void fixup_after_fork (HANDLE parent);
|
|
|
|
select_record *select_read (select_record *s);
|
|
|
|
select_record *select_write (select_record *s);
|
|
|
|
select_record *select_except (select_record *s);
|
|
|
|
};
|
|
|
|
|
2001-04-16 11:27:16 +08:00
|
|
|
class fhandler_dev_dsp : public fhandler_base
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
private:
|
2001-04-16 11:27:16 +08:00
|
|
|
int audioformat_;
|
|
|
|
int audiofreq_;
|
|
|
|
int audiobits_;
|
|
|
|
int audiochannels_;
|
|
|
|
bool setupwav(const char *pData, int nBytes);
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2001-10-14 01:23:35 +08:00
|
|
|
fhandler_dev_dsp ();
|
2001-04-16 11:27:16 +08:00
|
|
|
~fhandler_dev_dsp();
|
|
|
|
|
2001-10-04 10:34:20 +08:00
|
|
|
int open (path_conv *, int flags, mode_t mode = 0);
|
2001-04-16 11:27:16 +08:00
|
|
|
int write (const void *ptr, size_t len);
|
2001-10-24 12:16:45 +08:00
|
|
|
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
|
2001-04-16 11:27:16 +08:00
|
|
|
int ioctl (unsigned int cmd, void *);
|
* (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h):
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 21:38:51 +08:00
|
|
|
__off32_t lseek (__off32_t, int);
|
2001-04-16 11:27:16 +08:00
|
|
|
int close (void);
|
|
|
|
int dup (fhandler_base * child);
|
|
|
|
void dump (void);
|
2001-05-24 13:20:17 +08:00
|
|
|
void fixup_after_exec (HANDLE);
|
2001-04-16 11:27:16 +08:00
|
|
|
};
|
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
typedef union
|
|
|
|
{
|
2001-10-08 13:50:33 +08:00
|
|
|
char base[sizeof(fhandler_base)];
|
|
|
|
char console[sizeof(fhandler_console)];
|
|
|
|
char dev_clipboard[sizeof(fhandler_dev_clipboard)];
|
|
|
|
char dev_dsp[sizeof(fhandler_dev_dsp)];
|
|
|
|
char dev_floppy[sizeof(fhandler_dev_floppy)];
|
|
|
|
char dev_mem[sizeof(fhandler_dev_mem)];
|
|
|
|
char dev_null[sizeof(fhandler_dev_null)];
|
|
|
|
char dev_random[sizeof(fhandler_dev_random)];
|
|
|
|
char dev_raw[sizeof(fhandler_dev_raw)];
|
|
|
|
char dev_tape[sizeof(fhandler_dev_tape)];
|
|
|
|
char dev_zero[sizeof(fhandler_dev_zero)];
|
|
|
|
char disk_file[sizeof(fhandler_disk_file)];
|
|
|
|
char pipe[sizeof(fhandler_pipe)];
|
|
|
|
char pty_master[sizeof(fhandler_pty_master)];
|
|
|
|
char serial[sizeof(fhandler_serial)];
|
|
|
|
char socket[sizeof(fhandler_socket)];
|
|
|
|
char termios[sizeof(fhandler_termios)];
|
|
|
|
char tty_common[sizeof(fhandler_tty_common)];
|
|
|
|
char tty_master[sizeof(fhandler_tty_master)];
|
|
|
|
char tty_slave[sizeof(fhandler_tty_slave)];
|
|
|
|
char windows[sizeof(fhandler_windows)];
|
2000-02-18 03:38:33 +08:00
|
|
|
} fhandler_union;
|
2001-10-08 13:50:33 +08:00
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
struct select_record
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
HANDLE h;
|
|
|
|
fhandler_base *fh;
|
2001-11-02 12:44:06 +08:00
|
|
|
bool saw_error;
|
|
|
|
bool windows_handle;
|
|
|
|
bool read_ready, write_ready, except_ready;
|
|
|
|
bool read_selected, write_selected, except_selected;
|
2000-02-18 03:38:33 +08:00
|
|
|
int (*startup) (select_record *me, class select_stuff *stuff);
|
2001-11-04 10:31:58 +08:00
|
|
|
int (*peek) (select_record *, bool);
|
2000-02-18 03:38:33 +08:00
|
|
|
int (*verify) (select_record *me, fd_set *readfds, fd_set *writefds,
|
|
|
|
fd_set *exceptfds);
|
|
|
|
void (*cleanup) (select_record *me, class select_stuff *stuff);
|
|
|
|
struct select_record *next;
|
2000-03-30 11:51:30 +08:00
|
|
|
|
2000-03-30 12:23:11 +08:00
|
|
|
select_record (fhandler_base *in_fh = NULL) : fd (0), h (NULL),
|
|
|
|
fh (in_fh), saw_error (0), windows_handle (0),
|
|
|
|
read_ready (0), write_ready (0), except_ready (0),
|
|
|
|
read_selected (0), write_selected (0), except_selected (0),
|
2001-11-04 10:31:58 +08:00
|
|
|
startup (NULL), peek (NULL), verify (NULL), cleanup (NULL),
|
2000-03-30 12:23:11 +08:00
|
|
|
next (NULL) {}
|
2000-02-18 03:38:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class select_stuff
|
|
|
|
{
|
2001-11-02 05:15:53 +08:00
|
|
|
public:
|
2000-02-18 03:38:33 +08:00
|
|
|
~select_stuff ();
|
2000-04-04 02:15:01 +08:00
|
|
|
select_stuff (): always_ready (0), windows_used (0), start (0)
|
2000-03-30 11:51:30 +08:00
|
|
|
{
|
|
|
|
memset (device_specific, 0, sizeof (device_specific));
|
|
|
|
}
|
2001-11-02 12:44:06 +08:00
|
|
|
bool always_ready, windows_used;
|
2000-02-18 03:38:33 +08:00
|
|
|
select_record start;
|
|
|
|
void *device_specific[FH_NDEV];
|
|
|
|
|
|
|
|
int test_and_set (int i, fd_set *readfds, fd_set *writefds,
|
|
|
|
fd_set *exceptfds);
|
|
|
|
int poll (fd_set *readfds, fd_set *writefds, fd_set *exceptfds);
|
|
|
|
int wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds, DWORD ms);
|
2001-08-31 13:06:14 +08:00
|
|
|
void cleanup ();
|
2000-02-18 03:38:33 +08:00
|
|
|
};
|
|
|
|
|
2000-09-08 10:56:55 +08:00
|
|
|
int __stdcall set_console_state_for_spawn ();
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
#endif /* _FHANDLER_H_ */
|