* cygheap.cc (cygheap_root::set): Avoid treating '/' specially.

* fhandler.cc (fhandler_base::fcntl): Only set specific O_NDELAY style flag
passed in from application.
* fhandler_socket.cc (fhandler_socket::fcntl): Ditto.
* fhandler.h: Set constant for future use.
* winsup.h: Define OLD_O_NDELAY only for old programs.
* include/cygwin/version.h: Define CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK.
This commit is contained in:
Christopher Faylor 2001-08-07 00:01:42 +00:00
parent 386abb05d9
commit 96a3f4ae68
9 changed files with 57 additions and 30 deletions

View File

@ -1,3 +1,15 @@
Mon Aug 6 19:58:43 2001 Christopher Faylor <cgf@cygnus.com>
* cygheap.cc (cygheap_root::set): Avoid treating '/' specially.
* fhandler.cc (fhandler_base::fcntl): Only set specific O_NDELAY style
flag passed in from application.
* fhandler_socket.cc (fhandler_socket::fcntl): Ditto.
* fhandler.h: Set constant for future use.
* winsup.h: Define OLD_O_NDELAY only for old programs.
* include/cygwin/version.h: Define
CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK.
Sat Aug 4 16:52:03 2001 Christopher Faylor <cgf@cygnus.com>
Throughout, change check for running under Windows NT to 'iswinnt'.

View File

@ -330,6 +330,15 @@ cstrdup1 (const char *s)
void
cygheap_root::set (const char *posix, const char *native)
{
if (*posix == '/' && posix[1] == '\0')
{
if (m)
{
cfree (m);
m = NULL;
}
return;
}
if (!m)
m = (struct cygheap_root_mount_info *) ccalloc (HEAP_MOUNT, 1, sizeof (*m));
strcpy (m->posix_path, posix);

View File

@ -18,6 +18,7 @@ details. */
#include "cygerrno.h"
#include "perprocess.h"
#include "security.h"
#include "cygwin/version.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
@ -1084,15 +1085,13 @@ int fhandler_base::fcntl (int cmd, void *arg)
* ignored as well.
*/
const int allowed_flags = O_APPEND | O_NONBLOCK | OLD_O_NDELAY;
/* Care for the old O_NDELAY flag. If one of the flags is set,
both flags are set. */
int new_flags = (int) arg;
if (new_flags & (O_NONBLOCK | OLD_O_NDELAY))
new_flags |= O_NONBLOCK | OLD_O_NDELAY;
int flags = get_flags () & ~allowed_flags;
set_flags (flags | (new_flags & allowed_flags));
int new_flags = (int) arg & allowed_flags;
/* Carefully test for the O_NONBLOCK or deprecated OLD_O_NDELAY flag.
Set only the flag that has been passed in. If both are set, just
record O_NONBLOCK. */
if ((new_flags & OLD_O_NDELAY) && (new_flags & O_NONBLOCK))
new_flags = O_NONBLOCK;
set_flags ((get_flags () & ~allowed_flags) | new_flags);
}
res = 0;
break;

View File

@ -57,7 +57,7 @@ enum
FH_WBINSET = 0x00010000, /* binary write mode has been explicitly set */
FH_APPEND = 0x00020000, /* always append */
FH_ASYNC = 0x00040000, /* async I/O */
FH_HADEOF = 0x00080000, /* EOF seen */
FH_SIGCLOSE = 0x00080000, /* signal handler should close fd on interrupt */
FH_SYMLINK = 0x00100000, /* is a symlink */
FH_EXECABL = 0x00200000, /* file looked like it would run:

View File

@ -24,6 +24,8 @@
#include <winsock2.h>
#include "cygerrno.h"
#include "security.h"
#include "cygwin/version.h"
#include "perprocess.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
@ -412,17 +414,18 @@ fhandler_socket::fcntl (int cmd, void *arg)
{
/* Care for the old O_NDELAY flag. If one of the flags is set,
both flags are set. */
int new_flags = (int) arg;
if (new_flags & (O_NONBLOCK | OLD_O_NDELAY))
new_flags |= O_NONBLOCK | OLD_O_NDELAY;
request = (new_flags & O_NONBLOCK) ? 1 : 0;
current = (get_flags () & O_NONBLOCK) ? 1 : 0;
if (request != current && (res = ioctl (FIONBIO, &request)))
const int allowed_flags = O_NONBLOCK | OLD_O_NDELAY;
/* Carefully test for the O_NONBLOCK or deprecated OLD_O_NDELAY flag.
Set only the flag that has been passed in. If both are set, just
record O_NONBLOCK. */
int new_flags = (int) arg & allowed_flags;
if ((new_flags & OLD_O_NDELAY) && (new_flags & O_NONBLOCK))
new_flags = O_NONBLOCK;
current = get_flags () & allowed_flags;
if (!!current != !!new_flags && (res = ioctl (FIONBIO, &request)))
break;
if (request)
set_flags (get_flags () | O_NONBLOCK | OLD_O_NDELAY);
else
set_flags (get_flags () & ~(O_NONBLOCK | OLD_O_NDELAY));
set_flags ((get_flags () & ~allowed_flags) | new_flags);
break;
}
default:

View File

@ -82,6 +82,10 @@ details. */
#define CYGWIN_VERSION_CHECK_FOR_S_IEXEC \
(CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) >= \
36)
#define CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK \
(CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) <= \
28)
/* We used to use the DLL major/minor to track
non-backward-compatible interface changes to the API. Now we
use an API major/minor number for this purpose. */

View File

@ -904,9 +904,9 @@ cygwin_accept (int fd, struct sockaddr *peer, int *len)
struct sockaddr_in peer_dummy;
int len_dummy;
if (!peer)
peer = (struct sockaddr *) &peer_dummy;
peer = (struct sockaddr *) &peer_dummy;
if (!len)
{
{
len_dummy = sizeof (struct sockaddr_in);
len = &len_dummy;
}

View File

@ -1,6 +1,6 @@
/* pipe.cc: pipe for Cygwin.
Copyright 1996, 1998, 1999, 2000 Cygnus Solutions.
Copyright 1996, 1998, 1999, 2000, 2001 Cygnus Solutions.
This file is part of Cygwin.
@ -22,7 +22,7 @@ details. */
static int
make_pipe (int fildes[2], unsigned int psize, int mode)
{
SetResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," make_pipe");
SetResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "make_pipe");
HANDLE r, w;
int fdr = -1, fdw = -1;
@ -37,8 +37,8 @@ make_pipe (int fildes[2], unsigned int psize, int mode)
__seterrno ();
else
{
fhandler_base *fhr = cygheap->fdtab.build_fhandler (fdr, FH_PIPER, "/dev/piper");
fhandler_base *fhw = cygheap->fdtab.build_fhandler (fdw, FH_PIPEW, "/dev/pipew");
fhandler_pipe *fhr = (fhandler_pipe *) cygheap->fdtab.build_fhandler (fdr, FH_PIPER, "/dev/piper");
fhandler_pipe *fhw = (fhandler_pipe *) cygheap->fdtab.build_fhandler (fdw, FH_PIPEW, "/dev/pipew");
int binmode = mode & O_TEXT ? 0 : 1;
fhr->init (r, GENERIC_READ, binmode);
@ -56,7 +56,7 @@ make_pipe (int fildes[2], unsigned int psize, int mode)
}
syscall_printf ("%d = make_pipe ([%d, %d], %d, %p)", res, fdr, fdw, psize, mode);
ReleaseResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," make_pipe");
ReleaseResourceLock(LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "make_pipe");
return res;
}
@ -81,11 +81,11 @@ int
dup (int fd)
{
int res;
SetResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," dup");
SetResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "dup");
res = dup2 (fd, cygheap->fdtab.find_unused_handle ());
ReleaseResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," dup");
ReleaseResourceLock(LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "dup");
return res;
}

View File

@ -250,7 +250,7 @@ extern SYSTEM_INFO system_info;
/* newlib used to define O_NDELAY differently from O_NONBLOCK. Now it
properly defines both to be the same. Unfortunately, we have to
behave properly the old version, too, to accomodate older executables. */
#define OLD_O_NDELAY 4
#define OLD_O_NDELAY (CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK ? 4 : 0)
/* The title on program start. */
extern char *old_title;