revert premature checkin
This commit is contained in:
parent
a3ba550800
commit
9cd3ed2d10
winsup/cygwin
@ -41,17 +41,6 @@ static const NO_COPY DWORD std_consts[] = {STD_INPUT_HANDLE, STD_OUTPUT_HANDLE,
|
|||||||
|
|
||||||
static const char *handle_to_fn (HANDLE, char *);
|
static const char *handle_to_fn (HANDLE, char *);
|
||||||
|
|
||||||
#define DEVICE_PREFIX "\\device\\"
|
|
||||||
#define DEVICE_PREFIX_LEN sizeof (DEVICE_PREFIX) - 1
|
|
||||||
#define REMOTE "\\Device\\LanmanRedirector\\"
|
|
||||||
#define REMOTE_LEN sizeof (REMOTE) - 1
|
|
||||||
#define REMOTE1 "\\Device\\WinDfs\\Root\\"
|
|
||||||
#define REMOTE1_LEN sizeof (REMOTE1) - 1
|
|
||||||
#define NAMED_PIPE "\\Device\\NamedPipe\\"
|
|
||||||
#define NAMED_PIPE_LEN sizeof (NAMED_PIPE) - 1
|
|
||||||
#define POSIX_NAMED_PIPE "/Device/NamedPipe/"
|
|
||||||
#define POSIX_NAMED_PIPE_LEN sizeof (POSIX_NAMED_PIPE) - 1
|
|
||||||
|
|
||||||
/* Set aside space for the table of fds */
|
/* Set aside space for the table of fds */
|
||||||
void
|
void
|
||||||
dtable_init ()
|
dtable_init ()
|
||||||
@ -294,7 +283,7 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
|
|||||||
else
|
else
|
||||||
dev = *console_dev;
|
dev = *console_dev;
|
||||||
}
|
}
|
||||||
else if (0 && ft == FILE_TYPE_PIPE)
|
else if (ft == FILE_TYPE_PIPE)
|
||||||
{
|
{
|
||||||
if (fd == 0)
|
if (fd == 0)
|
||||||
dev = *piper_dev;
|
dev = *piper_dev;
|
||||||
@ -308,12 +297,7 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
name = handle_to_fn (handle, (char *) alloca (CYG_MAX_PATH + 100));
|
name = handle_to_fn (handle, (char *) alloca (CYG_MAX_PATH + 100));
|
||||||
if (!strncasematch (name, POSIX_NAMED_PIPE, POSIX_NAMED_PIPE_LEN))
|
bin = 0;
|
||||||
/* nothing */;
|
|
||||||
else if (fd == 0)
|
|
||||||
dev = *piper_dev;
|
|
||||||
else
|
|
||||||
dev = *pipew_dev;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,31 +308,25 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
|
|||||||
fhandler_base *fh;
|
fhandler_base *fh;
|
||||||
|
|
||||||
if (dev)
|
if (dev)
|
||||||
fh = build_fh_dev (dev, name);
|
fh = build_fh_dev (dev);
|
||||||
else
|
else
|
||||||
fh = build_fh_name (name);
|
fh = build_fh_name (name);
|
||||||
|
|
||||||
if (fh)
|
if (fh)
|
||||||
cygheap->fdtab[fd] = fh;
|
cygheap->fdtab[fd] = fh;
|
||||||
|
|
||||||
if (name)
|
if (!bin)
|
||||||
{
|
{
|
||||||
bin = fh->pc_binmode ();
|
bin = fh->get_default_fmode (O_RDWR);
|
||||||
if (!bin)
|
if (bin)
|
||||||
{
|
/* nothing */;
|
||||||
bin = fh->get_default_fmode (O_RDWR);
|
else if (dev)
|
||||||
if (!bin && dev)
|
bin = O_BINARY;
|
||||||
bin = O_BINARY;
|
else if (name != unknown_file)
|
||||||
}
|
bin = fh->pc_binmode ();
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD access;
|
fh->init (handle, GENERIC_READ | GENERIC_WRITE, bin);
|
||||||
if (fd == 0)
|
|
||||||
access = GENERIC_READ;
|
|
||||||
else
|
|
||||||
access = GENERIC_WRITE; /* Should be rdwr for stderr but not sure that's
|
|
||||||
possible for some versions of handles */
|
|
||||||
fh->init (handle, access, bin);
|
|
||||||
set_std_handle (fd);
|
set_std_handle (fd);
|
||||||
paranoid_printf ("fd %d, handle %p", fd, handle);
|
paranoid_printf ("fd %d, handle %p", fd, handle);
|
||||||
}
|
}
|
||||||
@ -847,6 +825,11 @@ dtable::vfork_child_fixup ()
|
|||||||
}
|
}
|
||||||
#endif /*NEWVFORK*/
|
#endif /*NEWVFORK*/
|
||||||
|
|
||||||
|
#define DEVICE_PREFIX "\\device\\"
|
||||||
|
#define DEVICE_PREFIX_LEN sizeof (DEVICE_PREFIX) - 1
|
||||||
|
#define REMOTE "\\Device\\LanmanRedirector\\"
|
||||||
|
#define REMOTE_LEN sizeof (REMOTE) - 1
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
handle_to_fn (HANDLE h, char *posix_fn)
|
handle_to_fn (HANDLE h, char *posix_fn)
|
||||||
{
|
{
|
||||||
@ -861,7 +844,7 @@ handle_to_fn (HANDLE h, char *posix_fn)
|
|||||||
NTSTATUS res = NtQueryObject (h, ObjectNameInformation, ntfn, sizeof (fnbuf),
|
NTSTATUS res = NtQueryObject (h, ObjectNameInformation, ntfn, sizeof (fnbuf),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!NT_SUCCESS (res))
|
if (NT_SUCCESS (res))
|
||||||
{
|
{
|
||||||
strcpy (posix_fn, unknown_file);
|
strcpy (posix_fn, unknown_file);
|
||||||
debug_printf ("NtQueryObject failed");
|
debug_printf ("NtQueryObject failed");
|
||||||
@ -918,7 +901,6 @@ handle_to_fn (HANDLE h, char *posix_fn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *w32 = win32_fn;
|
char *w32 = win32_fn;
|
||||||
bool justslash = false;
|
|
||||||
if (maxmatchlen)
|
if (maxmatchlen)
|
||||||
{
|
{
|
||||||
n = strlen (maxmatchdos);
|
n = strlen (maxmatchdos);
|
||||||
@ -928,38 +910,15 @@ handle_to_fn (HANDLE h, char *posix_fn)
|
|||||||
memcpy (w32, maxmatchdos, n);
|
memcpy (w32, maxmatchdos, n);
|
||||||
w32[n] = '\\';
|
w32[n] = '\\';
|
||||||
}
|
}
|
||||||
else if (strncasematch (w32, NAMED_PIPE, NAMED_PIPE_LEN))
|
|
||||||
{
|
|
||||||
debug_printf ("pipe");
|
|
||||||
justslash = true;
|
|
||||||
}
|
|
||||||
else if (strncasematch (w32, REMOTE, REMOTE_LEN))
|
else if (strncasematch (w32, REMOTE, REMOTE_LEN))
|
||||||
{
|
{
|
||||||
w32 += REMOTE_LEN - 2;
|
w32 += REMOTE_LEN - 2;
|
||||||
*w32 = '\\';
|
*w32 = '\\';
|
||||||
debug_printf ("remote drive");
|
debug_printf ("remote drive");
|
||||||
justslash = true;
|
|
||||||
}
|
|
||||||
else if (strncasematch (w32, REMOTE1, REMOTE1_LEN))
|
|
||||||
{
|
|
||||||
w32 += REMOTE1_LEN - 2;
|
|
||||||
*w32 = '\\';
|
|
||||||
debug_printf ("remote drive");
|
|
||||||
justslash = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!justslash)
|
|
||||||
cygwin_conv_to_full_posix_path (w32, posix_fn);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char *s, *d;
|
|
||||||
for (s = w32, d = posix_fn; *s; s++, d++)
|
|
||||||
if (*s == '\\')
|
|
||||||
*d = '/';
|
|
||||||
else
|
|
||||||
*d = *s;
|
|
||||||
}
|
|
||||||
|
|
||||||
debug_printf ("derived path '%s', posix '%s'", w32, posix_fn);
|
debug_printf ("derived path '%s'", w32);
|
||||||
|
cygwin_conv_to_full_posix_path (w32, posix_fn);
|
||||||
return posix_fn;
|
return posix_fn;
|
||||||
}
|
}
|
||||||
|
@ -1639,7 +1639,6 @@ fhandler_base::wait_overlapped (bool& res, bool writing, DWORD *bytes)
|
|||||||
switch (WaitForMultipleObjects (n, w4, false, INFINITE))
|
switch (WaitForMultipleObjects (n, w4, false, INFINITE))
|
||||||
{
|
{
|
||||||
case WAIT_OBJECT_0:
|
case WAIT_OBJECT_0:
|
||||||
debug_printf ("normal read");
|
|
||||||
if (!bytes ||
|
if (!bytes ||
|
||||||
GetOverlappedResult (h, get_overlapped (), bytes, false))
|
GetOverlappedResult (h, get_overlapped (), bytes, false))
|
||||||
res = 1;
|
res = 1;
|
||||||
@ -1650,14 +1649,12 @@ fhandler_base::wait_overlapped (bool& res, bool writing, DWORD *bytes)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WAIT_OBJECT_0 + 1:
|
case WAIT_OBJECT_0 + 1:
|
||||||
debug_printf ("got a signal");
|
|
||||||
CancelIo (h);
|
CancelIo (h);
|
||||||
set_errno (EINTR);
|
set_errno (EINTR);
|
||||||
res = 0;
|
res = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
err = GetLastError ();
|
err = GetLastError ();
|
||||||
debug_printf ("WFMO error, %E");
|
|
||||||
goto err;
|
goto err;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,6 @@ class fhandler_base
|
|||||||
path_conv pc;
|
path_conv pc;
|
||||||
|
|
||||||
virtual void set_name (path_conv &pc);
|
virtual void set_name (path_conv &pc);
|
||||||
virtual void set_name (const char *s) {pc.set_normalized_path (s, false);}
|
|
||||||
int error () const {return pc.error;}
|
int error () const {return pc.error;}
|
||||||
void set_error (int error) {pc.error = error;}
|
void set_error (int error) {pc.error = error;}
|
||||||
bool exists () const {return pc.exists ();}
|
bool exists () const {return pc.exists ();}
|
||||||
@ -547,7 +546,6 @@ public:
|
|||||||
int __stdcall fadvise (_off64_t, _off64_t, int) __attribute__ ((regparm (3)));
|
int __stdcall fadvise (_off64_t, _off64_t, int) __attribute__ ((regparm (3)));
|
||||||
int __stdcall ftruncate (_off64_t, bool) __attribute__ ((regparm (3)));
|
int __stdcall ftruncate (_off64_t, bool) __attribute__ ((regparm (3)));
|
||||||
int ready_for_read (int fd, DWORD howlong);
|
int ready_for_read (int fd, DWORD howlong);
|
||||||
void init (HANDLE, DWORD, mode_t);
|
|
||||||
static int create (fhandler_pipe *[2], unsigned, int);
|
static int create (fhandler_pipe *[2], unsigned, int);
|
||||||
static int create_selectable (LPSECURITY_ATTRIBUTES, HANDLE&, HANDLE&, DWORD);
|
static int create_selectable (LPSECURITY_ATTRIBUTES, HANDLE&, HANDLE&, DWORD);
|
||||||
};
|
};
|
||||||
|
@ -543,7 +543,7 @@ path_conv::set_normalized_path (const char *path_copy, bool strip_tail)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PUNICODE_STRING
|
PUNICODE_STRING
|
||||||
get_nt_native_path (const char *path, UNICODE_STRING& upath)
|
get_nt_native_path (const char *path, UNICODE_STRING &upath)
|
||||||
{
|
{
|
||||||
upath.Length = 0;
|
upath.Length = 0;
|
||||||
if (path[0] == '/') /* special path w/o NT path representation. */
|
if (path[0] == '/') /* special path w/o NT path representation. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user