* dtable.cc (dtable::build_fhandler): Remove debugging output which uses 'cb'.
* exec.cc (execvp): New function.
(execvpe): Ditto.
* fhandler.cc (fhandler_base::fhandler_base): Use constructor initialization.
* fhandler.h (fhandler_tty_common::fhandler_tty_common): Ditto.
* fhandler_clipboard.cc (fhandler_dev_clipboard::fhandler_dev_clipboard):
Ditto.
* fhandler_console.cc (fhandler_console::fhandler_console): Ditto.
* fhandler_raw.cc (fhandler_dev_raw::fhandler_dev_raw): Ditto.
* fhandler_serial.cc (fhandler_serial::fhandler_serial): Ditto.
* fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Ditto.
(fhandler_tty_slave::fhandler_tty_slave): Ditto.
(fhandler_pty_master::fhandler_pty_master): Ditto.
* fhandler_windows.cc (fhandler_windows::fhandler_windows): Ditto.
+2001-10-22 Christopher Faylor <cgf@redhat.com>
+
+ Remove 'cb' parameter and modify fhandler_* constructors throughout.
+ * dtable.cc (dtable::build_fhandler): Remove debugging output which
+ uses 'cb'.
+ * exec.cc (execvp): New function.
+ (execvpe): Ditto.
+ * fhandler.cc (fhandler_base::fhandler_base): Use constructor
+ initialization.
+ * fhandler.h (fhandler_tty_common::fhandler_tty_common): Ditto.
+ * fhandler_clipboard.cc (fhandler_dev_clipboard::fhandler_dev_clipboard):
+ Ditto.
+ * fhandler_console.cc (fhandler_console::fhandler_console): Ditto.
+ * fhandler_raw.cc (fhandler_dev_raw::fhandler_dev_raw): Ditto.
+ * fhandler_serial.cc (fhandler_serial::fhandler_serial): Ditto.
+ * fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Ditto.
+ (fhandler_tty_slave::fhandler_tty_slave): Ditto.
+ (fhandler_pty_master::fhandler_pty_master): Ditto.
+ * fhandler_windows.cc (fhandler_windows::fhandler_windows): Ditto.
+
2001-10-22 Corinna Vinschen <corinna@vinschen.de>
Patch suggested by Ian Ray <ian.ray@nokia.com>:
2001-10-22 Corinna Vinschen <corinna@vinschen.de>
+>>>>>>> 1.975
* net.cc (get_2k_ifconf): Change multiple IP address naming scheme
to Linux style.
}
}
- debug_printf ("%s - cb %d, fd %d, fh %p", fh->get_name () ?: "", fh->cb,
- fd, fh);
+ debug_printf ("%s - fd %d, fh %p", fh->get_name () ?: "", fd, fh);
return fd >= 0 ? (fds[fd] = fh) : fh;
}
/* This is called _execve and not execve because the real execve is defined
in libc/posix/execve.c. It calls us. */
-extern "C"
-int
+extern "C" int
_execve (const char *path, char *const argv[], char *const envp[])
{
static char *const empty_env[] = { 0 };
return _spawnve (NULL, _P_OVERLAY, path, argv, envp);
}
-extern "C"
-int
+extern "C" int
execl (const char *path, const char *arg0, ...)
{
int i;
return _execve (path, (char * const *) argv, cur_environ ());
}
-extern "C"
-int
+extern "C" int
execv (const char *path, char * const *argv)
{
MALLOC_CHECK;
/* the same as a standard exec() calls family, but with NT security support */
-extern "C"
-pid_t
+extern "C" pid_t
sexecve (HANDLE hToken, const char *path, const char *const argv[],
const char *const envp[])
{
return -1;
}
-extern "C"
-int
+extern "C" int
sexecl (HANDLE hToken, const char *path, const char *arg0, ...)
{
int i;
return sexecve (hToken, path, (char * const *) argv, cur_environ ());
}
-extern "C"
-int
+extern "C" int
sexecle (HANDLE hToken, const char *path, const char *arg0, ...)
{
int i;
return sexecve(hToken, path, (char * const *) argv, (char * const *) envp);
}
-extern "C"
-int
+extern "C" int
sexeclp (HANDLE hToken, const char *path, const char *arg0, ...)
{
int i;
return sexecvpe (hToken, path, (const char * const *) argv, cur_environ ());
}
-extern "C"
-int
+extern "C" int
sexeclpe (HANDLE hToken, const char *path, const char *arg0, ...)
{
int i;
return sexecvpe (hToken, path, argv, envp);
}
-extern "C"
-int
+extern "C" int
sexecv (HANDLE hToken, const char *path, const char * const *argv)
{
MALLOC_CHECK;
return sexecve (hToken, path, argv, cur_environ ());
}
-extern "C"
-int
+extern "C" int
sexecp (HANDLE hToken, const char *path, const char * const *argv)
{
MALLOC_CHECK;
return s1;
}
-extern "C"
-int
+extern "C" int
sexecvpe (HANDLE hToken, const char *file, const char * const *argv,
const char *const *envp)
{
MALLOC_CHECK;
return sexecve (hToken, find_exec (file, buf), argv, envp);
}
+
+extern "C" int
+execvp (const char *path, char * const *argv)
+{
+ path_conv buf;
+ return execv (find_exec (path, buf), argv);
+}
+
+extern "C" int
+execvpe (const char *path, char * const *argv, char *const *envp)
+{
+ path_conv buf;
+ return execve (find_exec (path, buf), argv, envp);
+}
/* Normal I/O constructor */
fhandler_base::fhandler_base (DWORD devtype, int unit):
+ status (devtype),
access (0),
io_handle (NULL),
namehash (0),
win32_path_name (NULL),
open_status (0)
{
- status = devtype;
int bin = __fmode & O_TEXT ? 0 : 1;
if (status != FH_DISK && status != FH_CONSOLE)
{
fhandler_disk_file::fhandler_disk_file () :
fhandler_base (FH_DISK)
{
- set_cb (sizeof *this);
}
int
fhandler_dev_null::fhandler_dev_null () :
fhandler_base (FH_NULL)
{
- set_cb (sizeof *this);
}
void
protected:
DWORD status;
public:
- int cb;
private:
int access;
HANDLE io_handle;
/* Non-virtual simple accessor functions. */
void set_io_handle (HANDLE x) { io_handle = x; }
- void set_cb (size_t size) { cb = size; }
DWORD get_device () { return status & FH_DEVMASK; }
virtual int get_unit () { return 0; }
virtual BOOL is_slow () { return get_device () < FH_SLOW; }
{
public:
fhandler_tty_common (DWORD dev, int unit = 0)
- : fhandler_termios (dev, unit), ttynum (unit)
+ : 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)
{
// nothing to do
}
HANDLE output_mutex, input_mutex;
HANDLE input_available_event;
HANDLE inuse; // used to indicate that a tty is in use
-
+ int ttynum; // Master tty num.
DWORD __acquire_output_mutex (const char *fn, int ln, DWORD ms);
void __release_output_mutex (const char *fn, int ln);
- int ttynum; // Master tty num.
virtual int dup (fhandler_base *child);
tty *get_ttyp () { return (tty *)tc; }
{
public:
/* Constructor */
- fhandler_tty_master (int unit);
fhandler_console *console; // device handler to perform real i/o.
HANDLE hThread; // process_output thread handle.
+ fhandler_tty_master (int unit);
int init (int);
int init_console ();
void fixup_after_fork (HANDLE parent);
/* this is MT safe because windows format id's are atomic */
static UINT cygnativeformat;
-fhandler_dev_clipboard::fhandler_dev_clipboard ():
-fhandler_base (FH_CLIPBOARD)
+fhandler_dev_clipboard::fhandler_dev_clipboard ()
+ : fhandler_base (FH_CLIPBOARD), pos (0), membuffer (NULL), msize (0),
+ eof (true)
{
- set_cb (sizeof *this);
- eof = true;
- pos = 0;
- membuffer = NULL;
- msize = 0;
/* FIXME: check for errors and loop until we can open the clipboard */
OpenClipboard (NULL);
cygnativeformat = RegisterClipboardFormat (CYGWIN_NATIVE);
return res;
}
-/*
- * Constructor.
- */
-
fhandler_console::fhandler_console () :
- fhandler_termios (FH_CONSOLE, -1)
+ fhandler_termios (FH_CONSOLE, -1),
+ default_color (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE),
+ underline_color (FOREGROUND_GREEN | FOREGROUND_BLUE),
+ dim_color (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE),
+ meta_mask (LEFT_ALT_PRESSED), state_ (normal), nargs_ (0), savex (0),
+ savey (0), savebuf (NULL), dwLastButtonState (0), nModifiers (0),
+ insert_mode (false), use_mouse (false), raw_win32_keyboard_mode (false)
{
- set_cb (sizeof *this);
- default_color = dim_color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
- underline_color = FOREGROUND_GREEN | FOREGROUND_BLUE;
- state_ = normal;
- nargs_ = 0;
for (int i = 0; i < MAXARGS; i++) args_ [i] = 0;
- savex = savey = 0;
savebufsiz.X = savebufsiz.Y = 0;
- savebuf = NULL;
scroll_region.Top = 0;
scroll_region.Bottom = -1;
dwLastCursorPosition.X = -1;
dwLastCursorPosition.Y = -1;
- dwLastButtonState = 0;
- nModifiers = 0;
- insert_mode = use_mouse = raw_win32_keyboard_mode = FALSE;
/* Set the mask that determines if an input keystroke is modified by
META. We set this based on the keyboard layout language loaded
for the current thread. The left <ALT> key always generates
language-specific characters (umlaut, accent grave, etc.). On
these keyboards right <ALT> (called AltGr) is used to produce the
shell symbols and should not be interpreted as META. */
- meta_mask = LEFT_ALT_PRESSED;
if (PRIMARYLANGID (LOWORD (GetKeyboardLayout (0))) == LANG_ENGLISH)
meta_mask |= RIGHT_ALT_PRESSED;
fhandler_dev_dsp::fhandler_dev_dsp ():
fhandler_base (FH_OSS_DSP)
{
- set_cb (sizeof *this);
}
fhandler_dev_dsp::~fhandler_dev_dsp ()
fhandler_dev_floppy::fhandler_dev_floppy (int unit) : fhandler_dev_raw (FH_FLOPPY, unit)
{
- set_cb (sizeof *this);
}
int
#define PSEUDO_SHIFTVAL (21)
fhandler_dev_random::fhandler_dev_random (int nunit)
- : fhandler_base (FH_RANDOM), unit(nunit), crypt_prov((HCRYPTPROV)NULL)
+ : fhandler_base (FH_RANDOM), unit(nunit), crypt_prov((HCRYPTPROV) NULL)
{
- set_cb (sizeof *this);
}
int
return ret;
}
-fhandler_dev_raw::fhandler_dev_raw (DWORD devtype, int unit)
- : fhandler_base (devtype)
+fhandler_dev_raw::fhandler_dev_raw (DWORD devtype, int nunit)
+ : fhandler_base (devtype), unit (nunit)
{
clear ();
- this->unit = unit;
set_need_fork_fixup ();
}
/**********************************************************************/
/* fhandler_serial */
-fhandler_serial::fhandler_serial (DWORD devtype, int unit) :
- fhandler_base (devtype, unit)
+fhandler_serial::fhandler_serial (DWORD devtype, int unit)
+ : fhandler_base (devtype, unit), vmin_ (0), vtime_ (0), pgrp_ (myself->pgid)
{
- set_cb (sizeof *this);
- vmin_ = 0;
- vtime_ = 0;
- pgrp_ = myself->pgid;
set_need_fork_fixup ();
}
fhandler_socket::fhandler_socket () :
fhandler_base (FH_SOCKET)
{
- set_cb (sizeof *this);
set_need_fork_fixup ();
prot_info_ptr = (LPWSAPROTOCOL_INFOA) cmalloc (HEAP_BUF,
sizeof (WSAPROTOCOL_INFOA));
fhandler_dev_tape::fhandler_dev_tape (int unit)
: fhandler_dev_raw (FH_TAPE, unit)
{
- set_cb (sizeof *this);
}
int
static DWORD WINAPI process_ioctl (void *); // Ioctl requests thread
fhandler_tty_master::fhandler_tty_master (int unit) :
- fhandler_pty_master (FH_TTYM, unit)
+ fhandler_pty_master (FH_TTYM, unit), console (NULL), hThread (NULL)
{
- set_cb (sizeof *this);
- console = NULL;
- hThread = NULL;
}
int
fhandler_tty_slave::fhandler_tty_slave (int num)
: fhandler_tty_common (FH_TTYS, num)
{
- set_cb (sizeof *this);
- ttynum = num;
- debug_printf ("unix '%s', win32 '%s'", unix_path_name, win32_path_name);
- inuse = NULL;
}
fhandler_tty_slave::fhandler_tty_slave ()
: fhandler_tty_common (FH_TTYS, 0)
{
- set_cb (sizeof *this);
- inuse = NULL;
}
/* FIXME: This function needs to close handles when it has
fhandler_pty_master::fhandler_pty_master (DWORD devtype, int unit)
: fhandler_tty_common (devtype, unit)
{
- set_cb (sizeof *this);
- ioctl_request_event = NULL;
- ioctl_done_event = NULL;
- pktmode = need_nl = 0;
- inuse = NULL;
}
int
*/
fhandler_windows::fhandler_windows ()
- : fhandler_base (FH_WINDOWS)
+ : fhandler_base (FH_WINDOWS), hWnd_ (NULL), method_ (WINDOWS_POST)
{
- set_cb (sizeof *this);
- hWnd_ = NULL;
- method_ = WINDOWS_POST;
}
int
fhandler_dev_zero::fhandler_dev_zero ()
: fhandler_base (FH_ZERO)
{
- set_cb (sizeof *this);
}
int
fhandler_pipe::fhandler_pipe (DWORD devtype)
: fhandler_base (devtype), guard (0), writepipe_exists(0), orig_pid (0), id (0)
{
- set_cb (sizeof *this);
}
off_t