* fhandler_dsp.cc (fhandler_dsp::ioctl): Return 0 for successful
SNDCTL_DSP_GETBLKSIZE operation. Remove obsolete 'name' arg from fhandler_* constructors throughout. * winsup.h (winsock_active): New macro. (winsock2_active): Ditto. * autoload.cc (wsock_init): Use new macros to decide if winsock or winsock2 is loaded. (nonexist_wsock32): Dummy function to force winsock load. (nonexist_ws2_32): Dummy function to force winsock2 load. * fhandler.h (fhandler_socket::fstat): Declare new method. Currently unused. * fhandler_socket.cc (fhandler_socket::fixup_before_fork_exec): Check that winsock2 is active before trying WSADuplicateSocketA. (fhandler_socket::fixup_after_fork): Add extra check for winsock2_active. Otherwise use iffy procedures for Windows 95. (fhandler_socket::fixup_after_exec): Add debugging. (fhandler_socket::dup): Add debugging. (fhandler_socket::fstat): New method. (fhandler_socket::set_close_on_exec): Attempt to perform iffy stuff on Windows 95. * errno.cc (_sys_nerr): Work around compiler strangeness. * pinfo.cc (winpids::add): Add extra element at end of allocated array for setting to NULL. (winpids::enumNT): Ditto. (winpids::init): Don't modify pidlist if it hasn't been allocated (possibly due to malloc problem).
This commit is contained in:
parent
5dec13e179
commit
0476bae576
|
@ -1,3 +1,37 @@
|
||||||
|
2001-10-13 Ralf Habacker <Ralf.Habacker@freenet.de>
|
||||||
|
|
||||||
|
* fhandler_dsp.cc (fhandler_dsp::ioctl): Return 0 for successful
|
||||||
|
SNDCTL_DSP_GETBLKSIZE operation.
|
||||||
|
|
||||||
|
2001-10-13 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
Remove obsolete 'name' arg from fhandler_* constructors throughout.
|
||||||
|
* winsup.h (winsock_active): New macro.
|
||||||
|
(winsock2_active): Ditto.
|
||||||
|
* autoload.cc (wsock_init): Use new macros to decide if winsock or
|
||||||
|
winsock2 is loaded.
|
||||||
|
(nonexist_wsock32): Dummy function to force winsock load.
|
||||||
|
(nonexist_ws2_32): Dummy function to force winsock2 load.
|
||||||
|
* fhandler.h (fhandler_socket::fstat): Declare new method. Currently
|
||||||
|
unused.
|
||||||
|
* fhandler_socket.cc (fhandler_socket::fixup_before_fork_exec): Check
|
||||||
|
that winsock2 is active before trying WSADuplicateSocketA.
|
||||||
|
(fhandler_socket::fixup_after_fork): Add extra check for
|
||||||
|
winsock2_active. Otherwise use iffy procedures for Windows 95.
|
||||||
|
(fhandler_socket::fixup_after_exec): Add debugging.
|
||||||
|
(fhandler_socket::dup): Add debugging.
|
||||||
|
(fhandler_socket::fstat): New method.
|
||||||
|
(fhandler_socket::set_close_on_exec): Attempt to perform iffy stuff on
|
||||||
|
Windows 95.
|
||||||
|
|
||||||
|
* errno.cc (_sys_nerr): Work around compiler strangeness.
|
||||||
|
|
||||||
|
* pinfo.cc (winpids::add): Add extra element at end of allocated array
|
||||||
|
for setting to NULL.
|
||||||
|
(winpids::enumNT): Ditto.
|
||||||
|
(winpids::init): Don't modify pidlist if it hasn't been allocated
|
||||||
|
(possibly due to malloc problem).
|
||||||
|
|
||||||
2001-10-12 Christopher Faylor <cgf@redhat.com>
|
2001-10-12 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* autoload.cc (wsock_init): Reorganize slightly to accomodate a new
|
* autoload.cc (wsock_init): Reorganize slightly to accomodate a new
|
||||||
|
|
|
@ -241,7 +241,6 @@ static long long
|
||||||
wsock_init ()
|
wsock_init ()
|
||||||
{
|
{
|
||||||
static LONG NO_COPY here = -1L;
|
static LONG NO_COPY here = -1L;
|
||||||
extern WSADATA wsadata;
|
|
||||||
struct func_info *func = (struct func_info *) __builtin_return_address (0);
|
struct func_info *func = (struct func_info *) __builtin_return_address (0);
|
||||||
struct dll_info *dll = func->dll;
|
struct dll_info *dll = func->dll;
|
||||||
|
|
||||||
|
@ -261,7 +260,7 @@ wsock_init ()
|
||||||
Sleep (0);
|
Sleep (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wsock_started && (wsock32_handle || ws2_32_handle))
|
if (!wsock_started && (winsock_active || winsock2_active))
|
||||||
{
|
{
|
||||||
/* Don't use autoload to load WSAStartup to eliminate recursion. */
|
/* Don't use autoload to load WSAStartup to eliminate recursion. */
|
||||||
int (*wsastartup) (int, WSADATA *);
|
int (*wsastartup) (int, WSADATA *);
|
||||||
|
@ -421,7 +420,7 @@ LoadDLLfunc (WSAAsyncSelect, 16, wsock32)
|
||||||
LoadDLLfunc (WSACleanup, 0, wsock32)
|
LoadDLLfunc (WSACleanup, 0, wsock32)
|
||||||
LoadDLLfunc (WSAGetLastError, 0, wsock32)
|
LoadDLLfunc (WSAGetLastError, 0, wsock32)
|
||||||
LoadDLLfunc (WSASetLastError, 4, wsock32)
|
LoadDLLfunc (WSASetLastError, 4, wsock32)
|
||||||
LoadDLLfunc (WSAStartup, 8, wsock32)
|
// LoadDLLfunc (WSAStartup, 8, wsock32)
|
||||||
LoadDLLfunc (__WSAFDIsSet, 8, wsock32)
|
LoadDLLfunc (__WSAFDIsSet, 8, wsock32)
|
||||||
LoadDLLfunc (accept, 12, wsock32)
|
LoadDLLfunc (accept, 12, wsock32)
|
||||||
LoadDLLfunc (bind, 12, wsock32)
|
LoadDLLfunc (bind, 12, wsock32)
|
||||||
|
|
|
@ -265,63 +265,63 @@ dtable::build_fhandler (int fd, DWORD dev, const char *name, int unit)
|
||||||
switch (dev)
|
switch (dev)
|
||||||
{
|
{
|
||||||
case FH_TTYM:
|
case FH_TTYM:
|
||||||
fh = cnew (fhandler_tty_master) (name, unit);
|
fh = cnew (fhandler_tty_master) (unit);
|
||||||
break;
|
break;
|
||||||
case FH_CONSOLE:
|
case FH_CONSOLE:
|
||||||
case FH_CONIN:
|
case FH_CONIN:
|
||||||
case FH_CONOUT:
|
case FH_CONOUT:
|
||||||
fh = cnew (fhandler_console) (name);
|
fh = cnew (fhandler_console) ();
|
||||||
inc_console_fds ();
|
inc_console_fds ();
|
||||||
break;
|
break;
|
||||||
case FH_PTYM:
|
case FH_PTYM:
|
||||||
fh = cnew (fhandler_pty_master) (name);
|
fh = cnew (fhandler_pty_master) ();
|
||||||
break;
|
break;
|
||||||
case FH_TTYS:
|
case FH_TTYS:
|
||||||
if (unit < 0)
|
if (unit < 0)
|
||||||
fh = cnew (fhandler_tty_slave) (name);
|
fh = cnew (fhandler_tty_slave) ();
|
||||||
else
|
else
|
||||||
fh = cnew (fhandler_tty_slave) (unit, name);
|
fh = cnew (fhandler_tty_slave) (unit);
|
||||||
break;
|
break;
|
||||||
case FH_WINDOWS:
|
case FH_WINDOWS:
|
||||||
fh = cnew (fhandler_windows) (name);
|
fh = cnew (fhandler_windows) ();
|
||||||
break;
|
break;
|
||||||
case FH_SERIAL:
|
case FH_SERIAL:
|
||||||
fh = cnew (fhandler_serial) (name, dev, unit);
|
fh = cnew (fhandler_serial) (unit);
|
||||||
break;
|
break;
|
||||||
case FH_PIPE:
|
case FH_PIPE:
|
||||||
case FH_PIPER:
|
case FH_PIPER:
|
||||||
case FH_PIPEW:
|
case FH_PIPEW:
|
||||||
fh = cnew (fhandler_pipe) (name, dev);
|
fh = cnew (fhandler_pipe) ();
|
||||||
break;
|
break;
|
||||||
case FH_SOCKET:
|
case FH_SOCKET:
|
||||||
fh = cnew (fhandler_socket) (name);
|
fh = cnew (fhandler_socket) ();
|
||||||
break;
|
break;
|
||||||
case FH_DISK:
|
case FH_DISK:
|
||||||
fh = cnew (fhandler_disk_file) (NULL);
|
fh = cnew (fhandler_disk_file) ();
|
||||||
break;
|
break;
|
||||||
case FH_FLOPPY:
|
case FH_FLOPPY:
|
||||||
fh = cnew (fhandler_dev_floppy) (name, unit);
|
fh = cnew (fhandler_dev_floppy) (unit);
|
||||||
break;
|
break;
|
||||||
case FH_TAPE:
|
case FH_TAPE:
|
||||||
fh = cnew (fhandler_dev_tape) (name, unit);
|
fh = cnew (fhandler_dev_tape) (unit);
|
||||||
break;
|
break;
|
||||||
case FH_NULL:
|
case FH_NULL:
|
||||||
fh = cnew (fhandler_dev_null) (name);
|
fh = cnew (fhandler_dev_null) ();
|
||||||
break;
|
break;
|
||||||
case FH_ZERO:
|
case FH_ZERO:
|
||||||
fh = cnew (fhandler_dev_zero) (name);
|
fh = cnew (fhandler_dev_zero) ();
|
||||||
break;
|
break;
|
||||||
case FH_RANDOM:
|
case FH_RANDOM:
|
||||||
fh = cnew (fhandler_dev_random) (name, unit);
|
fh = cnew (fhandler_dev_random) (unit);
|
||||||
break;
|
break;
|
||||||
case FH_MEM:
|
case FH_MEM:
|
||||||
fh = cnew (fhandler_dev_mem) (name, unit);
|
fh = cnew (fhandler_dev_mem) (unit);
|
||||||
break;
|
break;
|
||||||
case FH_CLIPBOARD:
|
case FH_CLIPBOARD:
|
||||||
fh = cnew (fhandler_dev_clipboard) (name);
|
fh = cnew (fhandler_dev_clipboard) ();
|
||||||
break;
|
break;
|
||||||
case FH_OSS_DSP:
|
case FH_OSS_DSP:
|
||||||
fh = cnew (fhandler_dev_dsp) (name);
|
fh = cnew (fhandler_dev_dsp) ();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,12 +8,16 @@ This software is a copyrighted work licensed under the terms of the
|
||||||
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||||
details. */
|
details. */
|
||||||
|
|
||||||
|
#define _sys_nerr FOO_sys_nerr
|
||||||
|
#define sys_nerr FOOsys_nerr
|
||||||
#include "winsup.h"
|
#include "winsup.h"
|
||||||
#define _REENT_ONLY
|
#define _REENT_ONLY
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "cygerrno.h"
|
#include "cygerrno.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
#undef _sys_nerr
|
||||||
|
#undef sys_nerr
|
||||||
|
|
||||||
/* Table to map Windows error codes to Errno values. */
|
/* Table to map Windows error codes to Errno values. */
|
||||||
/* FIXME: Doing things this way is a little slow. It's trivial to change
|
/* FIXME: Doing things this way is a little slow. It's trivial to change
|
||||||
|
@ -145,7 +149,8 @@ seterrno (const char *file, int line)
|
||||||
|
|
||||||
extern char *_user_strerror _PARAMS ((int));
|
extern char *_user_strerror _PARAMS ((int));
|
||||||
|
|
||||||
extern const NO_COPY char __declspec(dllexport) * const _sys_errlist[]=
|
extern "C" {
|
||||||
|
const NO_COPY char __declspec(dllexport) * const _sys_errlist[]=
|
||||||
{
|
{
|
||||||
/* NOERROR 0 */ "No error",
|
/* NOERROR 0 */ "No error",
|
||||||
/* EPERM 1 */ "Not super-user",
|
/* EPERM 1 */ "Not super-user",
|
||||||
|
@ -287,8 +292,8 @@ extern const NO_COPY char __declspec(dllexport) * const _sys_errlist[]=
|
||||||
/* ECASECLASH 137 */ "Filename exists with different case"
|
/* ECASECLASH 137 */ "Filename exists with different case"
|
||||||
};
|
};
|
||||||
|
|
||||||
int NO_COPY __declspec(dllexport) _sys_nerr =
|
extern int const NO_COPY __declspec(dllexport) _sys_nerr = sizeof (_sys_errlist) / sizeof (_sys_errlist[0]);
|
||||||
sizeof (_sys_errlist) / sizeof (_sys_errlist[0]);
|
};
|
||||||
|
|
||||||
/* FIXME: Why is strerror() a long switch and not just:
|
/* FIXME: Why is strerror() a long switch and not just:
|
||||||
return sys_errlist[errnum];
|
return sys_errlist[errnum];
|
||||||
|
|
|
@ -1329,7 +1329,7 @@ fhandler_base::operator delete (void *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Normal I/O constructor */
|
/* Normal I/O constructor */
|
||||||
fhandler_base::fhandler_base (DWORD devtype, const char *name, int unit):
|
fhandler_base::fhandler_base (DWORD devtype, int unit):
|
||||||
access (0),
|
access (0),
|
||||||
io_handle (NULL),
|
io_handle (NULL),
|
||||||
namehash (0),
|
namehash (0),
|
||||||
|
@ -1369,8 +1369,8 @@ fhandler_base::~fhandler_base (void)
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/* fhandler_disk_file */
|
/* fhandler_disk_file */
|
||||||
|
|
||||||
fhandler_disk_file::fhandler_disk_file (const char *name) :
|
fhandler_disk_file::fhandler_disk_file () :
|
||||||
fhandler_base (FH_DISK, name)
|
fhandler_base (FH_DISK)
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
}
|
}
|
||||||
|
@ -1598,8 +1598,8 @@ fhandler_disk_file::lock (int cmd, struct flock *fl)
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/* /dev/null */
|
/* /dev/null */
|
||||||
|
|
||||||
fhandler_dev_null::fhandler_dev_null (const char *name) :
|
fhandler_dev_null::fhandler_dev_null () :
|
||||||
fhandler_base (FH_NULL, name)
|
fhandler_base (FH_NULL)
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ public:
|
||||||
|
|
||||||
void reset_unix_path_name (const char *);
|
void reset_unix_path_name (const char *);
|
||||||
virtual fhandler_base& operator =(fhandler_base &x);
|
virtual fhandler_base& operator =(fhandler_base &x);
|
||||||
fhandler_base (DWORD dev, const char *name = 0, int unit = 0);
|
fhandler_base (DWORD dev, int unit = 0);
|
||||||
virtual ~fhandler_base ();
|
virtual ~fhandler_base ();
|
||||||
|
|
||||||
/* Non-virtual simple accessor functions. */
|
/* Non-virtual simple accessor functions. */
|
||||||
|
@ -385,7 +385,7 @@ private:
|
||||||
struct _WSAPROTOCOL_INFOA *prot_info_ptr;
|
struct _WSAPROTOCOL_INFOA *prot_info_ptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
fhandler_socket (const char *name = 0);
|
fhandler_socket ();
|
||||||
~fhandler_socket ();
|
~fhandler_socket ();
|
||||||
int get_socket () { return (int) get_handle(); }
|
int get_socket () { return (int) get_handle(); }
|
||||||
fhandler_socket * is_socket () { return this; }
|
fhandler_socket * is_socket () { return this; }
|
||||||
|
@ -422,6 +422,7 @@ public:
|
||||||
int check_peer_secret_event (struct sockaddr_in *peer, int *secret = NULL);
|
int check_peer_secret_event (struct sockaddr_in *peer, int *secret = NULL);
|
||||||
void signal_secret_event ();
|
void signal_secret_event ();
|
||||||
void close_secret_event ();
|
void close_secret_event ();
|
||||||
|
int __stdcall fstat (struct stat *buf, path_conv *) __attribute__ ((regparm (2)));
|
||||||
};
|
};
|
||||||
|
|
||||||
class fhandler_pipe: public fhandler_base
|
class fhandler_pipe: public fhandler_base
|
||||||
|
@ -431,7 +432,7 @@ class fhandler_pipe: public fhandler_base
|
||||||
DWORD orig_pid;
|
DWORD orig_pid;
|
||||||
unsigned id;
|
unsigned id;
|
||||||
public:
|
public:
|
||||||
fhandler_pipe (const char *name = 0, DWORD devtype = FH_PIPE);
|
fhandler_pipe (DWORD devtype = FH_PIPE);
|
||||||
off_t lseek (off_t offset, int whence);
|
off_t lseek (off_t offset, int whence);
|
||||||
select_record *select_read (select_record *s);
|
select_record *select_read (select_record *s);
|
||||||
select_record *select_write (select_record *s);
|
select_record *select_write (select_record *s);
|
||||||
|
@ -470,7 +471,7 @@ protected:
|
||||||
/* returns not null, if `win_error' determines an end of file condition */
|
/* returns not null, if `win_error' determines an end of file condition */
|
||||||
virtual int is_eof(int win_error) = 0;
|
virtual int is_eof(int win_error) = 0;
|
||||||
|
|
||||||
fhandler_dev_raw (DWORD dev, const char *name, int unit);
|
fhandler_dev_raw (DWORD dev, int unit);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~fhandler_dev_raw (void);
|
~fhandler_dev_raw (void);
|
||||||
|
@ -498,7 +499,7 @@ protected:
|
||||||
virtual int is_eof (int win_error);
|
virtual int is_eof (int win_error);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
fhandler_dev_floppy (const char *name, int unit);
|
fhandler_dev_floppy (int unit);
|
||||||
|
|
||||||
virtual int open (path_conv *, int flags, mode_t mode = 0);
|
virtual int open (path_conv *, int flags, mode_t mode = 0);
|
||||||
virtual int close (void);
|
virtual int close (void);
|
||||||
|
@ -520,7 +521,7 @@ protected:
|
||||||
virtual int is_eof (int win_error);
|
virtual int is_eof (int win_error);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
fhandler_dev_tape (const char *name, int unit);
|
fhandler_dev_tape (int unit);
|
||||||
|
|
||||||
int open (path_conv *, int flags, mode_t mode = 0);
|
int open (path_conv *, int flags, mode_t mode = 0);
|
||||||
int close (void);
|
int close (void);
|
||||||
|
@ -551,7 +552,7 @@ private:
|
||||||
class fhandler_disk_file: public fhandler_base
|
class fhandler_disk_file: public fhandler_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
fhandler_disk_file (const char *name);
|
fhandler_disk_file ();
|
||||||
|
|
||||||
int open (path_conv * real_path, int flags, mode_t mode);
|
int open (path_conv * real_path, int flags, mode_t mode);
|
||||||
int close ();
|
int close ();
|
||||||
|
@ -579,7 +580,7 @@ public:
|
||||||
OVERLAPPED io_status;
|
OVERLAPPED io_status;
|
||||||
|
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
fhandler_serial (const char *name, DWORD devtype = FH_SERIAL, int unit = 0);
|
fhandler_serial (DWORD devtype = FH_SERIAL, int unit = 0);
|
||||||
|
|
||||||
int open (path_conv *, int flags, mode_t mode);
|
int open (path_conv *, int flags, mode_t mode);
|
||||||
int close ();
|
int close ();
|
||||||
|
@ -627,8 +628,8 @@ protected:
|
||||||
virtual int accept_input () {return 1;};
|
virtual int accept_input () {return 1;};
|
||||||
public:
|
public:
|
||||||
tty_min *tc;
|
tty_min *tc;
|
||||||
fhandler_termios (DWORD dev, const char *name = 0, int unit = 0) :
|
fhandler_termios (DWORD dev, int unit = 0) :
|
||||||
fhandler_base (dev, name, unit)
|
fhandler_base (dev, unit)
|
||||||
{
|
{
|
||||||
set_need_fork_fixup ();
|
set_need_fork_fixup ();
|
||||||
}
|
}
|
||||||
|
@ -740,7 +741,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
fhandler_console (const char *name);
|
fhandler_console ();
|
||||||
|
|
||||||
fhandler_console* is_console () { return this; }
|
fhandler_console* is_console () { return this; }
|
||||||
|
|
||||||
|
@ -775,9 +776,8 @@ public:
|
||||||
class fhandler_tty_common: public fhandler_termios
|
class fhandler_tty_common: public fhandler_termios
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
fhandler_tty_common (DWORD dev, const char *name = 0, int unit = 0) :
|
fhandler_tty_common (DWORD dev, int unit = 0)
|
||||||
fhandler_termios (dev, name, unit),
|
: fhandler_termios (dev, unit), ttynum (unit)
|
||||||
ttynum (unit)
|
|
||||||
{
|
{
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
@ -814,8 +814,8 @@ class fhandler_tty_slave: public fhandler_tty_common
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
fhandler_tty_slave (const char *name);
|
fhandler_tty_slave ();
|
||||||
fhandler_tty_slave (int, const char *name);
|
fhandler_tty_slave (int);
|
||||||
|
|
||||||
int open (path_conv *, int flags, mode_t mode = 0);
|
int open (path_conv *, int flags, mode_t mode = 0);
|
||||||
int write (const void *ptr, size_t len);
|
int write (const void *ptr, size_t len);
|
||||||
|
@ -839,7 +839,7 @@ public:
|
||||||
int need_nl; // Next read should start with \n
|
int need_nl; // Next read should start with \n
|
||||||
|
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
fhandler_pty_master (const char *name, DWORD devtype = FH_PTYM, int unit = -1);
|
fhandler_pty_master (DWORD devtype = FH_PTYM, int unit = -1);
|
||||||
|
|
||||||
int process_slave_output (char *buf, size_t len, int pktmode_on);
|
int process_slave_output (char *buf, size_t len, int pktmode_on);
|
||||||
void doecho (const void *str, DWORD len);
|
void doecho (const void *str, DWORD len);
|
||||||
|
@ -865,7 +865,7 @@ class fhandler_tty_master: public fhandler_pty_master
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
fhandler_tty_master (const char *name, int unit);
|
fhandler_tty_master (int unit);
|
||||||
fhandler_console *console; // device handler to perform real i/o.
|
fhandler_console *console; // device handler to perform real i/o.
|
||||||
HANDLE hThread; // process_output thread handle.
|
HANDLE hThread; // process_output thread handle.
|
||||||
|
|
||||||
|
@ -878,7 +878,7 @@ public:
|
||||||
class fhandler_dev_null: public fhandler_base
|
class fhandler_dev_null: public fhandler_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
fhandler_dev_null (const char *name);
|
fhandler_dev_null ();
|
||||||
|
|
||||||
void dump ();
|
void dump ();
|
||||||
select_record *select_read (select_record *s);
|
select_record *select_read (select_record *s);
|
||||||
|
@ -889,7 +889,7 @@ public:
|
||||||
class fhandler_dev_zero: public fhandler_base
|
class fhandler_dev_zero: public fhandler_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
fhandler_dev_zero (const char *name);
|
fhandler_dev_zero ();
|
||||||
int open (path_conv *, int flags, mode_t mode = 0);
|
int open (path_conv *, int flags, mode_t mode = 0);
|
||||||
int write (const void *ptr, size_t len);
|
int write (const void *ptr, size_t len);
|
||||||
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (2)));
|
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (2)));
|
||||||
|
@ -911,7 +911,7 @@ protected:
|
||||||
int pseudo_read (void *ptr, size_t len);
|
int pseudo_read (void *ptr, size_t len);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
fhandler_dev_random (const char *name, int unit);
|
fhandler_dev_random (int unit);
|
||||||
int get_unit () { return unit; }
|
int get_unit () { return unit; }
|
||||||
int open (path_conv *, int flags, mode_t mode = 0);
|
int open (path_conv *, int flags, mode_t mode = 0);
|
||||||
int write (const void *ptr, size_t len);
|
int write (const void *ptr, size_t len);
|
||||||
|
@ -931,7 +931,7 @@ protected:
|
||||||
DWORD pos;
|
DWORD pos;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
fhandler_dev_mem (const char *name, int unit);
|
fhandler_dev_mem (int unit);
|
||||||
~fhandler_dev_mem (void);
|
~fhandler_dev_mem (void);
|
||||||
|
|
||||||
int open (path_conv *, int flags, mode_t mode = 0);
|
int open (path_conv *, int flags, mode_t mode = 0);
|
||||||
|
@ -954,7 +954,7 @@ public:
|
||||||
class fhandler_dev_clipboard: public fhandler_base
|
class fhandler_dev_clipboard: public fhandler_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
fhandler_dev_clipboard (const char *name);
|
fhandler_dev_clipboard ();
|
||||||
int is_windows (void) { return 1; }
|
int is_windows (void) { return 1; }
|
||||||
int open (path_conv *, int flags, mode_t mode = 0);
|
int open (path_conv *, int flags, mode_t mode = 0);
|
||||||
int write (const void *ptr, size_t len);
|
int write (const void *ptr, size_t len);
|
||||||
|
@ -979,7 +979,7 @@ private:
|
||||||
HWND hWnd_; // the window whose messages are to be retrieved by read() call
|
HWND hWnd_; // the window whose messages are to be retrieved by read() call
|
||||||
int method_; // write method (Post or Send)
|
int method_; // write method (Post or Send)
|
||||||
public:
|
public:
|
||||||
fhandler_windows (const char *name = 0);
|
fhandler_windows ();
|
||||||
int is_windows (void) { return 1; }
|
int is_windows (void) { return 1; }
|
||||||
int open (path_conv *, int flags, mode_t mode = 0);
|
int open (path_conv *, int flags, mode_t mode = 0);
|
||||||
int write (const void *ptr, size_t len);
|
int write (const void *ptr, size_t len);
|
||||||
|
@ -1005,7 +1005,7 @@ private:
|
||||||
int audiochannels_;
|
int audiochannels_;
|
||||||
bool setupwav(const char *pData, int nBytes);
|
bool setupwav(const char *pData, int nBytes);
|
||||||
public:
|
public:
|
||||||
fhandler_dev_dsp (const char *name = 0);
|
fhandler_dev_dsp ();
|
||||||
~fhandler_dev_dsp();
|
~fhandler_dev_dsp();
|
||||||
|
|
||||||
int open (path_conv *, int flags, mode_t mode = 0);
|
int open (path_conv *, int flags, mode_t mode = 0);
|
||||||
|
|
|
@ -32,8 +32,8 @@ static const NO_COPY char *CYGWIN_NATIVE = "CYGWIN_NATIVE_CLIPBOARD";
|
||||||
/* this is MT safe because windows format id's are atomic */
|
/* this is MT safe because windows format id's are atomic */
|
||||||
static UINT cygnativeformat;
|
static UINT cygnativeformat;
|
||||||
|
|
||||||
fhandler_dev_clipboard::fhandler_dev_clipboard (const char *name):
|
fhandler_dev_clipboard::fhandler_dev_clipboard ():
|
||||||
fhandler_base (FH_CLIPBOARD, name)
|
fhandler_base (FH_CLIPBOARD)
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
eof = true;
|
eof = true;
|
||||||
|
|
|
@ -862,8 +862,8 @@ fhandler_console::tcgetattr (struct termios *t)
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fhandler_console::fhandler_console (const char *name) :
|
fhandler_console::fhandler_console () :
|
||||||
fhandler_termios (FH_CONSOLE, name, -1)
|
fhandler_termios (FH_CONSOLE, -1)
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
default_color = dim_color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
|
default_color = dim_color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
|
||||||
|
|
|
@ -420,8 +420,8 @@ fhandler_dev_dsp::setupwav (const char *pData, int nBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
fhandler_dev_dsp::fhandler_dev_dsp (const char *name):
|
fhandler_dev_dsp::fhandler_dev_dsp ():
|
||||||
fhandler_base (FH_OSS_DSP, name)
|
fhandler_base (FH_OSS_DSP)
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
}
|
}
|
||||||
|
@ -526,6 +526,7 @@ fhandler_dev_dsp::ioctl (unsigned int cmd, void *ptr)
|
||||||
|
|
||||||
CASE (SNDCTL_DSP_GETBLKSIZE)
|
CASE (SNDCTL_DSP_GETBLKSIZE)
|
||||||
*intptr = Audio::BLOCK_SIZE;
|
*intptr = Audio::BLOCK_SIZE;
|
||||||
|
return 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
CASE (SNDCTL_DSP_SETFMT)
|
CASE (SNDCTL_DSP_SETFMT)
|
||||||
|
|
|
@ -40,7 +40,7 @@ fhandler_dev_floppy::is_eof (int)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
fhandler_dev_floppy::fhandler_dev_floppy (const char *name, int unit) : fhandler_dev_raw (FH_FLOPPY, name, unit)
|
fhandler_dev_floppy::fhandler_dev_floppy (int unit) : fhandler_dev_raw (FH_FLOPPY, unit)
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,8 @@
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/* fhandler_dev_mem */
|
/* fhandler_dev_mem */
|
||||||
|
|
||||||
fhandler_dev_mem::fhandler_dev_mem (const char *name, int nunit)
|
fhandler_dev_mem::fhandler_dev_mem (int nunit)
|
||||||
: fhandler_base (FH_MEM, name),
|
: fhandler_base (FH_MEM), unit (nunit)
|
||||||
unit (nunit)
|
|
||||||
{
|
{
|
||||||
/* Reading physical memory only supported on NT/W2K. */
|
/* Reading physical memory only supported on NT/W2K. */
|
||||||
if (!wincap.has_physical_mem_access ())
|
if (!wincap.has_physical_mem_access ())
|
||||||
|
|
|
@ -23,10 +23,8 @@ details. */
|
||||||
#define PSEUDO_MULTIPLIER (6364136223846793005LL)
|
#define PSEUDO_MULTIPLIER (6364136223846793005LL)
|
||||||
#define PSEUDO_SHIFTVAL (21)
|
#define PSEUDO_SHIFTVAL (21)
|
||||||
|
|
||||||
fhandler_dev_random::fhandler_dev_random (const char *name, int nunit)
|
fhandler_dev_random::fhandler_dev_random (int nunit)
|
||||||
: fhandler_base (FH_RANDOM, name),
|
: fhandler_base (FH_RANDOM), unit(nunit), crypt_prov((HCRYPTPROV)NULL)
|
||||||
unit(nunit),
|
|
||||||
crypt_prov((HCRYPTPROV)NULL)
|
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,8 @@ fhandler_dev_raw::writebuf (void)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
fhandler_dev_raw::fhandler_dev_raw (DWORD devtype, const char *name, int unit) : fhandler_base (devtype, name)
|
fhandler_dev_raw::fhandler_dev_raw (DWORD devtype, int unit)
|
||||||
|
: fhandler_base (devtype)
|
||||||
{
|
{
|
||||||
clear ();
|
clear ();
|
||||||
this->unit = unit;
|
this->unit = unit;
|
||||||
|
|
|
@ -24,8 +24,8 @@ details. */
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/* fhandler_serial */
|
/* fhandler_serial */
|
||||||
|
|
||||||
fhandler_serial::fhandler_serial (const char *name, DWORD devtype, int unit) :
|
fhandler_serial::fhandler_serial (DWORD devtype, int unit) :
|
||||||
fhandler_base (devtype, name, unit)
|
fhandler_base (devtype, unit)
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
vmin_ = 0;
|
vmin_ = 0;
|
||||||
|
|
|
@ -41,8 +41,8 @@ fhandler_dev_random* entropy_source;
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/* fhandler_socket */
|
/* fhandler_socket */
|
||||||
|
|
||||||
fhandler_socket::fhandler_socket (const char *name) :
|
fhandler_socket::fhandler_socket () :
|
||||||
fhandler_base (FH_SOCKET, name)
|
fhandler_base (FH_SOCKET)
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
set_need_fork_fixup ();
|
set_need_fork_fixup ();
|
||||||
|
@ -62,8 +62,7 @@ fhandler_socket::set_connect_secret ()
|
||||||
if (!entropy_source)
|
if (!entropy_source)
|
||||||
{
|
{
|
||||||
void *buf = malloc (sizeof (fhandler_dev_random));
|
void *buf = malloc (sizeof (fhandler_dev_random));
|
||||||
entropy_source = new (buf) fhandler_dev_random (ENTROPY_SOURCE_NAME,
|
entropy_source = new (buf) fhandler_dev_random (ENTROPY_SOURCE_DEV_UNIT);
|
||||||
ENTROPY_SOURCE_DEV_UNIT);
|
|
||||||
}
|
}
|
||||||
if (entropy_source &&
|
if (entropy_source &&
|
||||||
!entropy_source->open (NULL, O_RDONLY))
|
!entropy_source->open (NULL, O_RDONLY))
|
||||||
|
@ -115,8 +114,13 @@ fhandler_socket::create_secret_event (int* secret)
|
||||||
void
|
void
|
||||||
fhandler_socket::signal_secret_event ()
|
fhandler_socket::signal_secret_event ()
|
||||||
{
|
{
|
||||||
if (secret_event)
|
if (!secret_event)
|
||||||
SetEvent (secret_event);
|
debug_printf ("no secret event?");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetEvent (secret_event);
|
||||||
|
debug_printf ("signaled secret_event");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -160,54 +164,48 @@ fhandler_socket::check_peer_secret_event (struct sockaddr_in* peer, int* secret)
|
||||||
void
|
void
|
||||||
fhandler_socket::fixup_before_fork_exec (DWORD win_proc_id)
|
fhandler_socket::fixup_before_fork_exec (DWORD win_proc_id)
|
||||||
{
|
{
|
||||||
int ret = 1;
|
if (!winsock2_active)
|
||||||
|
|
||||||
if (prot_info_ptr &&
|
|
||||||
(ret = WSADuplicateSocketA (get_socket (), win_proc_id, prot_info_ptr)))
|
|
||||||
{
|
|
||||||
debug_printf ("WSADuplicateSocket error");
|
|
||||||
set_winsock_errno ();
|
|
||||||
}
|
|
||||||
if (!ret && ws2_32_handle)
|
|
||||||
{
|
|
||||||
debug_printf ("WSADuplicateSocket went fine, dwServiceFlags1=%d",
|
|
||||||
prot_info_ptr->dwServiceFlags1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
fhandler_base::fixup_before_fork_exec (win_proc_id);
|
fhandler_base::fixup_before_fork_exec (win_proc_id);
|
||||||
debug_printf ("Without Winsock 2.0");
|
debug_printf ("Without Winsock 2.0");
|
||||||
}
|
}
|
||||||
|
else if (!WSADuplicateSocketA (get_socket (), win_proc_id, prot_info_ptr))
|
||||||
|
debug_printf ("WSADuplicateSocket went fine, dwServiceFlags1=%d",
|
||||||
|
prot_info_ptr->dwServiceFlags1);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
debug_printf ("WSADuplicateSocket error");
|
||||||
|
set_winsock_errno ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_socket::fixup_after_fork (HANDLE parent)
|
fhandler_socket::fixup_after_fork (HANDLE parent)
|
||||||
{
|
{
|
||||||
SOCKET new_sock = INVALID_SOCKET;
|
SOCKET new_sock;
|
||||||
|
|
||||||
debug_printf ("WSASocket begin, dwServiceFlags1=%d",
|
debug_printf ("WSASocket begin, dwServiceFlags1=%d",
|
||||||
prot_info_ptr->dwServiceFlags1);
|
prot_info_ptr->dwServiceFlags1);
|
||||||
if (prot_info_ptr &&
|
|
||||||
(new_sock = WSASocketA (FROM_PROTOCOL_INFO,
|
if ((new_sock = WSASocketA (FROM_PROTOCOL_INFO,
|
||||||
FROM_PROTOCOL_INFO,
|
FROM_PROTOCOL_INFO,
|
||||||
FROM_PROTOCOL_INFO,
|
FROM_PROTOCOL_INFO,
|
||||||
prot_info_ptr, 0, 0)) == INVALID_SOCKET)
|
prot_info_ptr, 0, 0)) == INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
debug_printf ("WSASocket error");
|
debug_printf ("WSASocket error");
|
||||||
set_winsock_errno ();
|
set_winsock_errno ();
|
||||||
}
|
}
|
||||||
if (new_sock != INVALID_SOCKET && ws2_32_handle)
|
else if (!new_sock && !winsock2_active)
|
||||||
|
{
|
||||||
|
fhandler_base::fixup_after_fork (parent);
|
||||||
|
debug_printf ("Without Winsock 2.0");
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
debug_printf ("WSASocket went fine %p", new_sock);
|
debug_printf ("WSASocket went fine %p", new_sock);
|
||||||
set_io_handle ((HANDLE) new_sock);
|
set_io_handle ((HANDLE) new_sock);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
fhandler_base::fixup_after_fork (parent);
|
|
||||||
#endif
|
|
||||||
debug_printf ("Without Winsock 2.0");
|
|
||||||
}
|
|
||||||
if (secret_event)
|
if (secret_event)
|
||||||
fork_fixup (parent, secret_event, "secret_event");
|
fork_fixup (parent, secret_event, "secret_event");
|
||||||
}
|
}
|
||||||
|
@ -215,21 +213,24 @@ fhandler_socket::fixup_after_fork (HANDLE parent)
|
||||||
void
|
void
|
||||||
fhandler_socket::fixup_after_exec (HANDLE parent)
|
fhandler_socket::fixup_after_exec (HANDLE parent)
|
||||||
{
|
{
|
||||||
extern WSADATA wsadata;
|
debug_printf ("here");
|
||||||
if (!get_close_on_exec ())
|
if (!get_close_on_exec ())
|
||||||
fixup_after_fork (parent);
|
fixup_after_fork (parent);
|
||||||
else if (wsadata.wVersion < 512) /* < Winsock 2.0 */
|
#if 0
|
||||||
|
else if (!winsock2_active)
|
||||||
closesocket (get_socket ());
|
closesocket (get_socket ());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fhandler_socket::dup (fhandler_base *child)
|
fhandler_socket::dup (fhandler_base *child)
|
||||||
{
|
{
|
||||||
|
debug_printf ("here");
|
||||||
fhandler_socket *fhs = (fhandler_socket *) child;
|
fhandler_socket *fhs = (fhandler_socket *) child;
|
||||||
fhs->addr_family = addr_family;
|
fhs->addr_family = addr_family;
|
||||||
fhs->set_io_handle (get_io_handle ());
|
fhs->set_io_handle (get_io_handle ());
|
||||||
fhs->fixup_before_fork_exec (GetCurrentProcessId ());
|
fhs->fixup_before_fork_exec (GetCurrentProcessId ());
|
||||||
if (ws2_32_handle)
|
if (winsock2_active)
|
||||||
{
|
{
|
||||||
fhs->fixup_after_fork (hMainProc);
|
fhs->fixup_after_fork (hMainProc);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -237,15 +238,21 @@ fhandler_socket::dup (fhandler_base *child)
|
||||||
return fhandler_base::dup (child);
|
return fhandler_base::dup (child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int __stdcall
|
||||||
|
fhandler_socket::fstat (struct stat *buf, path_conv *pc)
|
||||||
|
{
|
||||||
|
fhandler_disk_file fh;
|
||||||
|
fh.set_name (get_name (), get_win32_name ());
|
||||||
|
return fh.fstat (buf, pc);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fhandler_socket::read (void *ptr, size_t len)
|
fhandler_socket::read (void *ptr, size_t len)
|
||||||
{
|
{
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
int res = recv (get_socket (), (char *) ptr, len, 0);
|
int res = recv (get_socket (), (char *) ptr, len, 0);
|
||||||
if (res == SOCKET_ERROR)
|
if (res == SOCKET_ERROR)
|
||||||
{
|
set_winsock_errno ();
|
||||||
set_winsock_errno ();
|
|
||||||
}
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,7 +421,7 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
|
||||||
if (cmd == FIONBIO)
|
if (cmd == FIONBIO)
|
||||||
{
|
{
|
||||||
syscall_printf ("socket is now %sblocking",
|
syscall_printf ("socket is now %sblocking",
|
||||||
*(int *) p ? "un" : "");
|
*(int *) p ? "non" : "");
|
||||||
/* Start AsyncSelect if async socket unblocked */
|
/* Start AsyncSelect if async socket unblocked */
|
||||||
if (*(int *) p && get_async ())
|
if (*(int *) p && get_async ())
|
||||||
WSAAsyncSelect (get_socket (), gethwnd (), WM_ASYNCIO, ASYNC_MASK);
|
WSAAsyncSelect (get_socket (), gethwnd (), WM_ASYNCIO, ASYNC_MASK);
|
||||||
|
@ -460,11 +467,8 @@ fhandler_socket::fcntl (int cmd, void *arg)
|
||||||
void
|
void
|
||||||
fhandler_socket::set_close_on_exec (int val)
|
fhandler_socket::set_close_on_exec (int val)
|
||||||
{
|
{
|
||||||
#if 0
|
if (!winsock2_active) /* < Winsock 2.0 */
|
||||||
extern WSADATA wsadata;
|
|
||||||
if (wsadata.wVersion < 512) /* < Winsock 2.0 */
|
|
||||||
set_inheritance (get_handle (), val);
|
set_inheritance (get_handle (), val);
|
||||||
#endif
|
|
||||||
set_close_on_exec_flag (val);
|
set_close_on_exec_flag (val);
|
||||||
debug_printf ("set close_on_exec for %s to %d", get_name (), val);
|
debug_printf ("set close_on_exec for %s to %d", get_name (), val);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,8 @@ fhandler_dev_tape::is_eof (int win_error)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
fhandler_dev_tape::fhandler_dev_tape (const char *name, int unit) : fhandler_dev_raw (FH_TAPE, name, unit)
|
fhandler_dev_tape::fhandler_dev_tape (int unit)
|
||||||
|
: fhandler_dev_raw (FH_TAPE, unit)
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,8 @@ static DWORD WINAPI process_input (void *); // Input queue thread
|
||||||
static DWORD WINAPI process_output (void *); // Output queue thread
|
static DWORD WINAPI process_output (void *); // Output queue thread
|
||||||
static DWORD WINAPI process_ioctl (void *); // Ioctl requests thread
|
static DWORD WINAPI process_ioctl (void *); // Ioctl requests thread
|
||||||
|
|
||||||
fhandler_tty_master::fhandler_tty_master (const char *name, int unit) :
|
fhandler_tty_master::fhandler_tty_master (int unit) :
|
||||||
fhandler_pty_master (name, FH_TTYM, unit)
|
fhandler_pty_master (FH_TTYM, unit)
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
console = NULL;
|
console = NULL;
|
||||||
|
@ -437,8 +437,8 @@ process_ioctl (void *)
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/* Tty slave stuff */
|
/* Tty slave stuff */
|
||||||
|
|
||||||
fhandler_tty_slave::fhandler_tty_slave (int num, const char *name) :
|
fhandler_tty_slave::fhandler_tty_slave (int num)
|
||||||
fhandler_tty_common (FH_TTYS, name, num)
|
: fhandler_tty_common (FH_TTYS, num)
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
ttynum = num;
|
ttynum = num;
|
||||||
|
@ -446,8 +446,8 @@ fhandler_tty_slave::fhandler_tty_slave (int num, const char *name) :
|
||||||
inuse = NULL;
|
inuse = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
fhandler_tty_slave::fhandler_tty_slave (const char *name) :
|
fhandler_tty_slave::fhandler_tty_slave ()
|
||||||
fhandler_tty_common (FH_TTYS, name, 0)
|
: fhandler_tty_common (FH_TTYS, 0)
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
inuse = NULL;
|
inuse = NULL;
|
||||||
|
@ -950,8 +950,8 @@ out:
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
fhandler_pty_master
|
fhandler_pty_master
|
||||||
*/
|
*/
|
||||||
fhandler_pty_master::fhandler_pty_master (const char *name, DWORD devtype, int unit) :
|
fhandler_pty_master::fhandler_pty_master (DWORD devtype, int unit)
|
||||||
fhandler_tty_common (devtype, name, unit)
|
: fhandler_tty_common (devtype, unit)
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
ioctl_request_event = NULL;
|
ioctl_request_event = NULL;
|
||||||
|
|
|
@ -46,8 +46,8 @@ The following unix-style calls are supported:
|
||||||
select () call marks read fd when any message posted to queue.
|
select () call marks read fd when any message posted to queue.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fhandler_windows::fhandler_windows (const char *name) :
|
fhandler_windows::fhandler_windows ()
|
||||||
fhandler_base (FH_WINDOWS, name)
|
: fhandler_base (FH_WINDOWS)
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
hWnd_ = NULL;
|
hWnd_ = NULL;
|
||||||
|
|
|
@ -15,8 +15,8 @@ details. */
|
||||||
#include "security.h"
|
#include "security.h"
|
||||||
#include "fhandler.h"
|
#include "fhandler.h"
|
||||||
|
|
||||||
fhandler_dev_zero::fhandler_dev_zero (const char *name)
|
fhandler_dev_zero::fhandler_dev_zero ()
|
||||||
: fhandler_base (FH_ZERO, name)
|
: fhandler_base (FH_ZERO)
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,7 +217,7 @@ mmap_record::fixup_map ()
|
||||||
&old_prot);
|
&old_prot);
|
||||||
}
|
}
|
||||||
|
|
||||||
static fhandler_disk_file fh_paging_file (NULL);
|
static fhandler_disk_file fh_paging_file;
|
||||||
|
|
||||||
fhandler_base *
|
fhandler_base *
|
||||||
mmap_record::alloc_fh ()
|
mmap_record::alloc_fh ()
|
||||||
|
|
|
@ -506,12 +506,15 @@ cygwin_getprotobynumber (int number)
|
||||||
fhandler_socket *
|
fhandler_socket *
|
||||||
fdsock (int fd, const char *name, SOCKET soc)
|
fdsock (int fd, const char *name, SOCKET soc)
|
||||||
{
|
{
|
||||||
|
SetResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "fdsock");
|
||||||
if (wsadata.wVersion < 512) /* < Winsock 2.0 */
|
if (wsadata.wVersion < 512) /* < Winsock 2.0 */
|
||||||
soc = set_socket_inheritance (soc);
|
soc = set_socket_inheritance (soc);
|
||||||
fhandler_socket *fh = (fhandler_socket *) cygheap->fdtab.build_fhandler (fd, FH_SOCKET, name);
|
fhandler_socket *fh = (fhandler_socket *) cygheap->fdtab.build_fhandler (fd, FH_SOCKET, name);
|
||||||
fh->set_io_handle ((HANDLE) soc);
|
fh->set_io_handle ((HANDLE) soc);
|
||||||
fh->set_flags (O_RDWR);
|
fh->set_flags (O_RDWR);
|
||||||
cygheap->fdtab.inc_need_fixup_before ();
|
cygheap->fdtab.inc_need_fixup_before ();
|
||||||
|
fh->set_name (name, name);
|
||||||
|
ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "fdsock");
|
||||||
return fh;
|
return fh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -701,6 +701,10 @@ out:
|
||||||
set_has_buggy_open (strcmp (fs_name, "SUNWNFS") == 0);
|
set_has_buggy_open (strcmp (fs_name, "SUNWNFS") == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
|
if (issocket ())
|
||||||
|
devn = FH_SOCKET;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!(opt & PC_FULL))
|
if (!(opt & PC_FULL))
|
||||||
{
|
{
|
||||||
|
|
|
@ -293,8 +293,8 @@ winpids::add (DWORD& nelem, bool winpid, DWORD pid)
|
||||||
if (nelem >= npidlist)
|
if (nelem >= npidlist)
|
||||||
{
|
{
|
||||||
npidlist += slop_pidlist;
|
npidlist += slop_pidlist;
|
||||||
pidlist = (DWORD *) realloc (pidlist, size_pidlist (npidlist));
|
pidlist = (DWORD *) realloc (pidlist, size_pidlist (npidlist + 1));
|
||||||
pinfolist = (pinfo *) realloc (pinfolist, size_pinfolist (npidlist));
|
pinfolist = (pinfo *) realloc (pinfolist, size_pinfolist (npidlist + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
pinfolist[nelem].init (cygpid, PID_NOREDIR);
|
pinfolist[nelem].init (cygpid, PID_NOREDIR);
|
||||||
|
@ -324,7 +324,7 @@ winpids::enumNT (bool winpid)
|
||||||
|
|
||||||
DWORD nelem = 0;
|
DWORD nelem = 0;
|
||||||
if (!szprocs)
|
if (!szprocs)
|
||||||
procs = (SYSTEM_PROCESSES *) malloc (szprocs = 200 * sizeof (*procs));
|
procs = (SYSTEM_PROCESSES *) malloc (sizeof (*procs) + (szprocs = 200 * sizeof (*procs)));
|
||||||
|
|
||||||
NTSTATUS res;
|
NTSTATUS res;
|
||||||
for (;;)
|
for (;;)
|
||||||
|
@ -387,7 +387,8 @@ void
|
||||||
winpids::init (bool winpid)
|
winpids::init (bool winpid)
|
||||||
{
|
{
|
||||||
npids = (this->*enum_processes) (winpid);
|
npids = (this->*enum_processes) (winpid);
|
||||||
pidlist[npids] = 0;
|
if (pidlist)
|
||||||
|
pidlist[npids] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
|
|
|
@ -25,9 +25,8 @@ details. */
|
||||||
static unsigned pipecount;
|
static unsigned pipecount;
|
||||||
static const NO_COPY char pipeid_fmt[] = "stupid_pipe.%u.%u";
|
static const NO_COPY char pipeid_fmt[] = "stupid_pipe.%u.%u";
|
||||||
|
|
||||||
fhandler_pipe::fhandler_pipe (const char *name, DWORD devtype) :
|
fhandler_pipe::fhandler_pipe (DWORD devtype)
|
||||||
fhandler_base (devtype, name),
|
: fhandler_base (devtype), guard (0), writepipe_exists(0), orig_pid (0), id (0)
|
||||||
guard (0), writepipe_exists(0), orig_pid (0), id (0)
|
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,4 +265,8 @@ extern bool cygwin_testing;
|
||||||
extern unsigned _cygwin_testing_magic;
|
extern unsigned _cygwin_testing_magic;
|
||||||
extern HMODULE cygwin_hmodule;
|
extern HMODULE cygwin_hmodule;
|
||||||
|
|
||||||
|
#define winsock2_active (wsadata.wVersion >= 512)
|
||||||
|
#define winsock_active (wsadata.wVersion < 512)
|
||||||
|
extern struct WSAData wsadata;
|
||||||
|
|
||||||
#endif /* defined __cplusplus */
|
#endif /* defined __cplusplus */
|
||||||
|
|
Loading…
Reference in New Issue