whitespace elimination
This commit is contained in:
parent
daf7238603
commit
b86f999af1
|
@ -28,11 +28,11 @@ __set_ctype (const char *charset)
|
|||
idx = __iso_8859_index (charset + 9);
|
||||
/* Our ctype table has a leading ISO-8859-1 element. */
|
||||
if (idx < 0)
|
||||
idx = 0;
|
||||
idx = 0;
|
||||
else
|
||||
++idx;
|
||||
if (CYGWIN_VERSION_CHECK_FOR_OLD_CTYPE)
|
||||
{
|
||||
{
|
||||
memcpy (_ctype_b, __ctype_iso[idx], 128);
|
||||
memcpy (_ctype_b + 256, __ctype_iso[idx] + 256, 128);
|
||||
}
|
||||
|
|
|
@ -446,7 +446,7 @@ cygheap_user::set_name (const char *new_name)
|
|||
if (allocated)
|
||||
{
|
||||
/* Windows user names are case-insensitive. Here we want the correct
|
||||
username, though, even if it only differs by case. */
|
||||
username, though, even if it only differs by case. */
|
||||
if (!strcmp (new_name, pname))
|
||||
return;
|
||||
cfree (pname);
|
||||
|
|
|
@ -181,7 +181,7 @@ public:
|
|||
if (curr_imp_token != NO_IMPERSONATION)
|
||||
CloseHandle (curr_imp_token);
|
||||
if (curr_primary_token != NO_IMPERSONATION
|
||||
&& curr_primary_token != external_token
|
||||
&& curr_primary_token != external_token
|
||||
&& curr_primary_token != internal_token)
|
||||
CloseHandle (curr_primary_token);
|
||||
if (external_token != NO_IMPERSONATION)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* cygxdr.cc:
|
||||
/* cygxdr.cc:
|
||||
|
||||
Copyright 2010 Red Hat, Inc.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* cygxdr.h:
|
||||
/* cygxdr.h:
|
||||
|
||||
Copyright 2010 Red Hat, Inc.
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ globify (char *word, char **&argv, int &argc, int &argvlen)
|
|||
else
|
||||
{
|
||||
--s;
|
||||
while (cnt-- > 0)
|
||||
while (cnt-- > 0)
|
||||
*p++ = *++s;
|
||||
}
|
||||
}
|
||||
|
@ -643,7 +643,7 @@ child_info_spawn::handle_spawn ()
|
|||
fixup_lockf_after_exec ();
|
||||
}
|
||||
|
||||
/* Retrieve and store system directory for later use. Note that the
|
||||
/* Retrieve and store system directory for later use. Note that the
|
||||
directory is stored with a trailing backslash! */
|
||||
static void
|
||||
init_windows_system_directory ()
|
||||
|
|
|
@ -303,7 +303,7 @@ mkdir (const char *dir, mode_t mode)
|
|||
char *p = stpcpy (buf = tp.c_get (), dir) - 1;
|
||||
dir = buf;
|
||||
while (p > dir && isdirsep (*p))
|
||||
*p-- = '\0';
|
||||
*p-- = '\0';
|
||||
}
|
||||
if (!(fh = build_fh_name (dir, PC_SYM_NOFOLLOW)))
|
||||
goto done; /* errno already set */;
|
||||
|
|
|
@ -76,7 +76,7 @@ dlopen (const char *name, int)
|
|||
{
|
||||
ret = (void *) GetModuleHandle (NULL); /* handle for the current module */
|
||||
if (!ret)
|
||||
__seterrno ();
|
||||
__seterrno ();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -471,7 +471,7 @@ void dll_list::load_after_fork_impl (HANDLE parent, dll* d, int retries)
|
|||
if (!retries && !VirtualFree (d->handle, 0, MEM_RELEASE))
|
||||
api_fatal ("unable to release protective reservation for %W (%08lx), %E",
|
||||
d->modname, d->handle);
|
||||
|
||||
|
||||
HMODULE h = LoadLibraryExW (d->name, NULL, DONT_RESOLVE_DLL_REFERENCES);
|
||||
if (!h)
|
||||
api_fatal ("unable to create interim mapping for %W, %E", d->name);
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
void topsort ();
|
||||
void topsort_visit (dll* d, bool goto_tail);
|
||||
void append (dll* d);
|
||||
|
||||
|
||||
dll *inext ()
|
||||
{
|
||||
while ((hold = hold->next))
|
||||
|
|
|
@ -306,7 +306,7 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
|
|||
dev = *pipew_dev;
|
||||
}
|
||||
else if (GetConsoleScreenBufferInfo (handle, &buf)
|
||||
|| GetNumberOfConsoleInputEvents (handle, (DWORD *) &buf))
|
||||
|| GetNumberOfConsoleInputEvents (handle, (DWORD *) &buf))
|
||||
{
|
||||
/* Console I/O */
|
||||
if (!ISSTATE (myself, PID_USETTY))
|
||||
|
@ -352,7 +352,7 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
|
|||
by NtQueryInformationFile is meaningless. CMD always hands down
|
||||
stdin handles as R/O handles, but our tty slave sides are R/W. */
|
||||
if (dev == FH_TTY || dev == FH_CONSOLE || dev.get_major () == DEV_TTYS_MAJOR)
|
||||
access |= GENERIC_READ | GENERIC_WRITE;
|
||||
access |= GENERIC_READ | GENERIC_WRITE;
|
||||
else if (NT_SUCCESS (NtQueryInformationFile (handle, &io, &fai,
|
||||
sizeof fai,
|
||||
FileAccessInformation)))
|
||||
|
@ -950,11 +950,12 @@ dtable::fixup_before_fork (DWORD target_proc_id)
|
|||
for (size_t i = 0; i < size; i++)
|
||||
if ((fh = fds[i]) != NULL)
|
||||
{
|
||||
debug_printf ("fd %d (%s)", i, fh->get_name ());
|
||||
fh->fixup_before_fork_exec (target_proc_id);
|
||||
debug_printf ("fd %d (%s)", i, fh->get_name ());
|
||||
fh->fixup_before_fork_exec (target_proc_id);
|
||||
}
|
||||
unlock ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dtable::fixup_before_exec (DWORD target_proc_id)
|
||||
{
|
||||
|
@ -963,9 +964,8 @@ dtable::fixup_before_exec (DWORD target_proc_id)
|
|||
for (size_t i = 0; i < size; i++)
|
||||
if ((fh = fds[i]) != NULL && !fh->close_on_exec ())
|
||||
{
|
||||
debug_printf ("fd %d (%s)", i, fh->get_name ());
|
||||
fh->fixup_before_fork_exec (target_proc_id);
|
||||
debug_printf ("fd %d (%s)", i, fh->get_name ());
|
||||
fh->fixup_before_fork_exec (target_proc_id);
|
||||
}
|
||||
unlock ();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -382,10 +382,10 @@ _strerror_r (struct _reent *, int errnum, int internal, int *errptr)
|
|||
if (!errstr)
|
||||
{
|
||||
errstr = internal ? _my_tls.locals.strerror_r_buf
|
||||
: _my_tls.locals.strerror_buf;
|
||||
: _my_tls.locals.strerror_buf;
|
||||
__small_sprintf (errstr, "Unknown error %d", errnum);
|
||||
if (errptr)
|
||||
*errptr = EINVAL;
|
||||
*errptr = EINVAL;
|
||||
}
|
||||
return errstr;
|
||||
}
|
||||
|
@ -493,9 +493,9 @@ error_at_line (int status, int errnum, const char *filename, unsigned int lineno
|
|||
|
||||
/* strcmp(3) will SEGV if filename or last_filename are NULL */
|
||||
if (lineno == last_lineno
|
||||
&& ((!filename && !last_filename)
|
||||
|| (filename && last_filename && strcmp (filename, last_filename) == 0)))
|
||||
return;
|
||||
&& ((!filename && !last_filename)
|
||||
|| (filename && last_filename && strcmp (filename, last_filename) == 0)))
|
||||
return;
|
||||
|
||||
last_filename = filename;
|
||||
last_lineno = lineno;
|
||||
|
|
|
@ -688,8 +688,8 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, void
|
|||
}
|
||||
|
||||
si.si_addr = (si.si_signo == SIGSEGV || si.si_signo == SIGBUS
|
||||
? (void *) e->ExceptionInformation[1]
|
||||
: (void *) in->Eip);
|
||||
? (void *) e->ExceptionInformation[1]
|
||||
: (void *) in->Eip);
|
||||
si.si_errno = si.si_pid = si.si_uid = 0;
|
||||
me.incyg++;
|
||||
sig_send (NULL, si, &me); // Signal myself
|
||||
|
|
|
@ -227,7 +227,7 @@ feclearexcept (int excepts)
|
|||
return fesetenv (&fenv);
|
||||
}
|
||||
|
||||
/* This function raises the supported exceptions indicated by
|
||||
/* This function raises the supported exceptions indicated by
|
||||
excepts. If more than one exception bit in excepts is set the order
|
||||
in which the exceptions are raised is undefined except that overflow
|
||||
(FE_OVERFLOW) or underflow (FE_UNDERFLOW) are raised before inexact
|
||||
|
|
|
@ -99,7 +99,7 @@ set_clipboard (const void *buf, size_t len)
|
|||
HANDLE ret = SetClipboardData (cygnativeformat, hmem);
|
||||
CloseClipboard ();
|
||||
/* According to MSDN, hmem must not be free'd after transferring the
|
||||
data to the clipboard via SetClipboardData. */
|
||||
data to the clipboard via SetClipboardData. */
|
||||
/* GlobalFree (hmem); */
|
||||
if (!ret)
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ set_clipboard (const void *buf, size_t len)
|
|||
HANDLE ret = SetClipboardData (CF_UNICODETEXT, hmem);
|
||||
CloseClipboard ();
|
||||
/* According to MSDN, hmem must not be free'd after transferring the
|
||||
data to the clipboard via SetClipboardData. */
|
||||
data to the clipboard via SetClipboardData. */
|
||||
/* GlobalFree (hmem); */
|
||||
if (!ret)
|
||||
{
|
||||
|
@ -163,7 +163,7 @@ fhandler_dev_clipboard::write (const void *buf, size_t len)
|
|||
if (set_clipboard (membuffer, msize))
|
||||
{
|
||||
/* FIXME: membuffer is now out of sync with pos, but msize
|
||||
is used above */
|
||||
is used above */
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ fhandler_console::open_shared_console (HWND hw, HANDLE& h, bool& create)
|
|||
|
||||
shared_locations m = create ? SH_JUSTCREATE: SH_JUSTOPEN;
|
||||
console_state *res = (console_state *)
|
||||
open_shared (namebuf, 0, h, sizeof (*shared_console_info), &m);
|
||||
open_shared (namebuf, 0, h, sizeof (*shared_console_info), &m);
|
||||
create = m == SH_JUSTCREATE;
|
||||
return res;
|
||||
}
|
||||
|
@ -300,9 +300,9 @@ fhandler_console::mouse_aware (MOUSE_EVENT_RECORD& mouse_event)
|
|||
|| mouse_event.dwEventFlags == MOUSE_WHEELED
|
||||
|| (mouse_event.dwEventFlags == MOUSE_MOVED
|
||||
&& (dev_state.dwMousePosition.X != dev_state.dwLastMousePosition.X
|
||||
|| dev_state.dwMousePosition.Y != dev_state.dwLastMousePosition.Y)
|
||||
|| dev_state.dwMousePosition.Y != dev_state.dwLastMousePosition.Y)
|
||||
&& ((dev_state.use_mouse >= 2 && mouse_event.dwButtonState)
|
||||
|| dev_state.use_mouse >= 3));
|
||||
|| dev_state.use_mouse >= 3));
|
||||
}
|
||||
|
||||
void __stdcall
|
||||
|
@ -516,14 +516,14 @@ restart:
|
|||
send_winch_maybe ();
|
||||
{
|
||||
MOUSE_EVENT_RECORD& mouse_event = input_rec.Event.MouseEvent;
|
||||
/* As a unique guard for mouse report generation,
|
||||
call mouse_aware() which is common with select(), so the result
|
||||
of select() and the actual read() will be consistent on the
|
||||
issue of whether input (i.e. a mouse escape sequence) will
|
||||
/* As a unique guard for mouse report generation,
|
||||
call mouse_aware() which is common with select(), so the result
|
||||
of select() and the actual read() will be consistent on the
|
||||
issue of whether input (i.e. a mouse escape sequence) will
|
||||
be available or not */
|
||||
if (mouse_aware (mouse_event))
|
||||
{
|
||||
/* Note: Reported mouse position was already retrieved by
|
||||
/* Note: Reported mouse position was already retrieved by
|
||||
mouse_aware() and adjusted by window scroll buffer offset */
|
||||
|
||||
/* Treat the double-click event like a regular button press */
|
||||
|
@ -1223,7 +1223,7 @@ bool fhandler_console::write_console (PWCHAR buf, DWORD len, DWORD& done)
|
|||
: dev_state.vt100_graphics_mode_G0)
|
||||
for (DWORD i = 0; i < len; i ++)
|
||||
if (buf[i] >= (unsigned char) '`' && buf[i] <= (unsigned char) '~')
|
||||
buf[i] = __vt100_conv[buf[i] - (unsigned char) '`'];
|
||||
buf[i] = __vt100_conv[buf[i] - (unsigned char) '`'];
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
|
@ -1613,15 +1613,15 @@ fhandler_console::char_command (char c)
|
|||
break;
|
||||
case 'c': /* u9 - Terminal enquire string */
|
||||
if (dev_state.saw_greater_than_sign)
|
||||
/* Generate Secondary Device Attribute report, using 67 = ASCII 'C'
|
||||
to indicate Cygwin (convention used by Rxvt, Urxvt, Screen, Mintty),
|
||||
/* Generate Secondary Device Attribute report, using 67 = ASCII 'C'
|
||||
to indicate Cygwin (convention used by Rxvt, Urxvt, Screen, Mintty),
|
||||
and cygwin version for terminal version. */
|
||||
__small_sprintf (buf, "\033[>67;%d%02d;0c", CYGWIN_VERSION_DLL_MAJOR, CYGWIN_VERSION_DLL_MINOR);
|
||||
else
|
||||
strcpy (buf, "\033[?6c");
|
||||
/* The generated report needs to be injected for read-ahead into the
|
||||
fhandler_console object associated with standard input.
|
||||
The current call does not work. */
|
||||
/* The generated report needs to be injected for read-ahead into the
|
||||
fhandler_console object associated with standard input.
|
||||
The current call does not work. */
|
||||
puts_readahead (buf);
|
||||
break;
|
||||
case 'n':
|
||||
|
@ -2117,16 +2117,16 @@ get_nonascii_key (INPUT_RECORD& input_rec, char *tmp)
|
|||
for (int i = 0; keytable[i].vk; i++)
|
||||
if (input_rec.Event.KeyEvent.wVirtualKeyCode == keytable[i].vk)
|
||||
{
|
||||
if ((input_rec.Event.KeyEvent.dwControlKeyState &
|
||||
if ((input_rec.Event.KeyEvent.dwControlKeyState &
|
||||
(LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED))
|
||||
&& keytable[i].val[modifier_index] != NULL)
|
||||
{ /* Generic ESC prefixing if Alt is pressed */
|
||||
{ /* Generic ESC prefixing if Alt is pressed */
|
||||
tmp[0] = '\033';
|
||||
strcpy (tmp + 1, keytable[i].val[modifier_index]);
|
||||
return tmp;
|
||||
}
|
||||
else
|
||||
return keytable[i].val[modifier_index];
|
||||
}
|
||||
else
|
||||
return keytable[i].val[modifier_index];
|
||||
}
|
||||
|
||||
if (input_rec.Event.KeyEvent.uChar.AsciiChar)
|
||||
|
@ -2204,7 +2204,7 @@ fhandler_console::create_invisible_console (HWINSTA horig)
|
|||
termios_printf ("SetProcessWindowStation %d, %E", b);
|
||||
}
|
||||
b = AllocConsole (); /* will cause flashing if CreateWindowStation
|
||||
failed */
|
||||
failed */
|
||||
if (!h)
|
||||
SetParent (GetConsoleWindow (), HWND_MESSAGE);
|
||||
if (horig && h && h != horig && SetProcessWindowStation (horig))
|
||||
|
|
|
@ -172,7 +172,7 @@ readdir_check_reparse_point (POBJECT_ATTRIBUTES attr)
|
|||
{
|
||||
if (rp->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)
|
||||
{
|
||||
RtlInitCountedUnicodeString (&subst,
|
||||
RtlInitCountedUnicodeString (&subst,
|
||||
(WCHAR *)((char *)rp->MountPointReparseBuffer.PathBuffer
|
||||
+ rp->MountPointReparseBuffer.SubstituteNameOffset),
|
||||
rp->MountPointReparseBuffer.SubstituteNameLength);
|
||||
|
@ -180,7 +180,7 @@ readdir_check_reparse_point (POBJECT_ATTRIBUTES attr)
|
|||
if (RtlEqualUnicodePathPrefix (&subst, &ro_u_volume, TRUE))
|
||||
ret = DT_DIR;
|
||||
else
|
||||
ret = DT_LNK;
|
||||
ret = DT_LNK;
|
||||
}
|
||||
else if (rp->ReparseTag == IO_REPARSE_TAG_SYMLINK)
|
||||
ret = DT_LNK;
|
||||
|
@ -349,7 +349,7 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf)
|
|||
{
|
||||
PFILE_NETWORK_OPEN_INFORMATION pfnoi = pc.fnoi ();
|
||||
status = NtQueryInformationFile (h, &io, pfnoi, sizeof *pfnoi,
|
||||
FileNetworkOpenInformation);
|
||||
FileNetworkOpenInformation);
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
debug_printf ("%p = NtQueryInformationFile(%S, "
|
||||
|
@ -615,7 +615,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
|
|||
IO_STATUS_BLOCK io;
|
||||
|
||||
/* We have to re-open the file. Either the file is not opened
|
||||
for reading, or the read will change the file position of the
|
||||
for reading, or the read will change the file position of the
|
||||
original handle. */
|
||||
pc.init_reopen_attr (&attr, h);
|
||||
status = NtOpenFile (&h, SYNCHRONIZE | FILE_READ_DATA,
|
||||
|
@ -910,7 +910,7 @@ fhandler_disk_file::fchown (__uid32_t uid, __gid32_t gid)
|
|||
attrib = S_IFLNK | STD_RBITS | STD_WBITS;
|
||||
res = set_file_attribute (get_handle (), pc, uid, gid, attrib);
|
||||
/* If you're running a Samba server which has no winbidd running, the
|
||||
uid<->SID mapping is disfunctional. Even trying to chown to your
|
||||
uid<->SID mapping is disfunctional. Even trying to chown to your
|
||||
own account fails since the account used on the server is the UNIX
|
||||
account which gets used for the standard user mapping. This is a
|
||||
default mechanism which doesn't know your real Windows SID.
|
||||
|
@ -1036,7 +1036,7 @@ cant_access_acl:
|
|||
res = getacl (get_stat_handle (), pc, nentries, aclbufp);
|
||||
/* For this ENOSYS case, see security.cc:get_file_attribute(). */
|
||||
if (res == -1 && get_errno () == ENOSYS)
|
||||
goto cant_access_acl;
|
||||
goto cant_access_acl;
|
||||
break;
|
||||
case GETACLCNT:
|
||||
res = getacl (get_stat_handle (), pc, 0, NULL);
|
||||
|
@ -1611,7 +1611,8 @@ fhandler_disk_file::rmdir ()
|
|||
FILE_BASIC_INFORMATION fbi;
|
||||
NTSTATUS q_status;
|
||||
|
||||
q_status = NtQueryAttributesFile (pc.get_object_attr (attr, sec_none_nih), &fbi);
|
||||
q_status = NtQueryAttributesFile (pc.get_object_attr (attr, sec_none_nih),
|
||||
&fbi);
|
||||
if (!NT_SUCCESS (status) && q_status == STATUS_OBJECT_NAME_NOT_FOUND)
|
||||
status = STATUS_SUCCESS;
|
||||
else if (NT_SUCCESS (status) && NT_SUCCESS (q_status))
|
||||
|
@ -2104,9 +2105,9 @@ go_ahead:
|
|||
pc.objcaseinsensitive (),
|
||||
get_handle (), NULL);
|
||||
/* FILE_OPEN_REPARSE_POINT on NFS is a no-op, so the normal
|
||||
NtOpenFile here returns the inode number of the symlink target,
|
||||
NtOpenFile here returns the inode number of the symlink target,
|
||||
rather than the inode number of the symlink itself.
|
||||
|
||||
|
||||
Worse, trying to open a symlink without setting the special
|
||||
"ActOnSymlink" EA triggers a bug in Windows 7 which results
|
||||
in a timeout of up to 20 seconds, followed by two exceptions
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Fhandler_dev_dsp: code to emulate OSS sound model /dev/dsp
|
||||
/* fhandler_dev_dsp: code to emulate OSS sound model /dev/dsp
|
||||
|
||||
Copyright 2001, 2002, 2003, 2004, 2008, 2011 Red Hat, Inc
|
||||
|
||||
|
@ -867,7 +867,7 @@ fhandler_dev_dsp::Audio_in::read (char *pSampleData, int &nBytes)
|
|||
while (bytes_to_read != 0)
|
||||
{ // Block till next sound has been read
|
||||
if (!waitfordata ())
|
||||
{
|
||||
{
|
||||
if (nBytes)
|
||||
return true;
|
||||
nBytes = -1;
|
||||
|
|
|
@ -188,7 +188,7 @@ fhandler_dev_floppy::lock_partition (DWORD to_write)
|
|||
{
|
||||
DWORD bytes_read;
|
||||
|
||||
/* The simple case. We have only a single partition open anyway.
|
||||
/* The simple case. We have only a single partition open anyway.
|
||||
Try to lock the partition so that a subsequent write succeeds.
|
||||
If there's some file handle open on one of the affected partitions,
|
||||
this fails, but that's how it works on Vista and later... */
|
||||
|
@ -225,7 +225,7 @@ fhandler_dev_floppy::lock_partition (DWORD to_write)
|
|||
PDRIVE_LAYOUT_INFORMATION_EX pdlix = (PDRIVE_LAYOUT_INFORMATION_EX)
|
||||
alloca (size);
|
||||
BOOL found = FALSE;
|
||||
|
||||
|
||||
/* Fetch current file pointer position on disk. */
|
||||
status = NtQueryInformationFile (get_handle (), &io, &fpi, sizeof fpi,
|
||||
FilePositionInformation);
|
||||
|
@ -237,7 +237,7 @@ fhandler_dev_floppy::lock_partition (DWORD to_write)
|
|||
}
|
||||
/* Fetch drive layout to get start and end positions of partitions on disk. */
|
||||
if (!DeviceIoControl (get_handle (), IOCTL_DISK_GET_DRIVE_LAYOUT_EX, NULL, 0,
|
||||
pdlix, size, &bytes_read, NULL))
|
||||
pdlix, size, &bytes_read, NULL))
|
||||
{
|
||||
debug_printf ("DeviceIoControl(IOCTL_DISK_GET_DRIVE_LAYOUT_EX): %E");
|
||||
return FALSE;
|
||||
|
@ -250,7 +250,7 @@ fhandler_dev_floppy::lock_partition (DWORD to_write)
|
|||
/* A partition number of 0 denotes an extended partition or one of the
|
||||
aforementioned filler entries. Just skip. */
|
||||
if (ppie->PartitionNumber == 0)
|
||||
continue;
|
||||
continue;
|
||||
/* Check if our writing range affects this partition. */
|
||||
if (fpi.CurrentByteOffset.QuadPart < ppie->StartingOffset.QuadPart
|
||||
+ ppie->PartitionLength.QuadPart
|
||||
|
@ -376,7 +376,7 @@ fhandler_dev_floppy::open (int flags, mode_t)
|
|||
return 0;
|
||||
}
|
||||
/* If we're trying to access a CD/DVD drive, or an entire disk,
|
||||
make sure we're actually allowed to read *all* of the device.
|
||||
make sure we're actually allowed to read *all* of the device.
|
||||
This is actually documented in the MSDN CreateFile man page. */
|
||||
if (get_major () != DEV_FLOPPY_MAJOR
|
||||
&& (get_major () == DEV_CDROM_MAJOR || get_minor () % 16 == 0)
|
||||
|
|
|
@ -49,7 +49,7 @@ fhandler_mailslot::get_object_attr (OBJECT_ATTRIBUTES &attr,
|
|||
PUNICODE_STRING path,
|
||||
int flags)
|
||||
{
|
||||
|
||||
|
||||
RtlCopyUnicodeString (path, pc.get_nt_native_path ());
|
||||
RtlAppendUnicodeStringToString (path, &installation_key);
|
||||
InitializeObjectAttributes (&attr, path,
|
||||
|
@ -72,7 +72,7 @@ fhandler_mailslot::open (int flags, mode_t mode)
|
|||
UNICODE_STRING path;
|
||||
|
||||
tp.u_get (&path);
|
||||
|
||||
|
||||
switch (flags & O_ACCMODE)
|
||||
{
|
||||
case O_RDONLY: /* Server */
|
||||
|
|
|
@ -391,8 +391,8 @@ format_proc_loadavg (void *, char *&destbuf)
|
|||
switch (get_process_state (i)) {
|
||||
case 'O':
|
||||
case 'R':
|
||||
running++;
|
||||
break;
|
||||
running++;
|
||||
break;
|
||||
}
|
||||
|
||||
destbuf = (char *) crealloc_abort (destbuf, 16);
|
||||
|
@ -514,7 +514,7 @@ format_proc_stat (void *, char *&destbuf)
|
|||
if (!NT_SUCCESS (ret))
|
||||
{
|
||||
debug_printf ("NtQuerySystemInformation(SystemPerformanceInformation)"
|
||||
", status %p", ret);
|
||||
", status %p", ret);
|
||||
memset (spi, 0, sizeof_spi);
|
||||
}
|
||||
ret = NtQuerySystemInformation (SystemTimeOfDayInformation,
|
||||
|
@ -1241,8 +1241,8 @@ format_proc_filesystems (void *, char *&destbuf)
|
|||
/* start at 1 to skip type "none" */
|
||||
for (int i = 1; fs_names[i].name; i++)
|
||||
bufptr += __small_sprintf(bufptr, "%s\t%s\n",
|
||||
fs_names[i].block_device ? "" : "nodev",
|
||||
fs_names[i].name);
|
||||
fs_names[i].block_device ? "" : "nodev",
|
||||
fs_names[i].name);
|
||||
|
||||
destbuf = (char *) crealloc_abort (destbuf, bufptr - buf);
|
||||
memcpy (destbuf, buf, bufptr - buf);
|
||||
|
@ -1279,7 +1279,7 @@ format_proc_swaps (void *, char *&destbuf)
|
|||
}
|
||||
|
||||
bufptr += __small_sprintf (bufptr,
|
||||
"Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n");
|
||||
"Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n");
|
||||
|
||||
if (spi && !ret && GetLastError () != ERROR_PROC_NOT_FOUND)
|
||||
{
|
||||
|
@ -1294,7 +1294,7 @@ format_proc_swaps (void *, char *&destbuf)
|
|||
cygwin_conv_path (CCP_WIN_W_TO_POSIX, spp->FileName.Buffer, filename, filename_len);
|
||||
|
||||
bufptr += sprintf (bufptr, "%-40s%-16s%-8llu%-8llu%-8d\n",
|
||||
filename, "file", total >> 10, used >> 10, 0);
|
||||
filename, "file", total >> 10, used >> 10, 0);
|
||||
}
|
||||
while (spp->NextEntryOffset
|
||||
&& (spp = (PSYSTEM_PAGEFILE_INFORMATION)
|
||||
|
|
|
@ -330,7 +330,7 @@ fhandler_process::fill_filebuf ()
|
|||
if (process_tab[fileid].format_func)
|
||||
{
|
||||
if (process_tab[fileid].fhandler == FH_PROCESSFD)
|
||||
{
|
||||
{
|
||||
process_fd_t fd = { path, p };
|
||||
filesize = process_tab[fileid].format_func (&fd, filebuf);
|
||||
}
|
||||
|
@ -540,7 +540,7 @@ struct dos_drive_mappings
|
|||
wchar_t mapping[1];
|
||||
};
|
||||
mapping *mappings;
|
||||
|
||||
|
||||
dos_drive_mappings ()
|
||||
: mappings(0)
|
||||
{
|
||||
|
@ -552,7 +552,7 @@ struct dos_drive_mappings
|
|||
The annoying part is, QueryDosDeviceW wants only "x:" rather
|
||||
than the "x:\" we get back from GetLogicalDriveStringsW, so
|
||||
we'll have to strip out the trailing slash for each mapping.
|
||||
|
||||
|
||||
The returned mapping a native NT pathname (\Device\...) which
|
||||
we can use to fix up the output of GetMappedFileNameW
|
||||
*/
|
||||
|
@ -588,7 +588,7 @@ struct dos_drive_mappings
|
|||
debug_printf ("Unable to determine the native mapping for %ls "
|
||||
"(error %lu)", drive, GetLastError ());
|
||||
}
|
||||
|
||||
|
||||
wchar_t *fixup_if_match (wchar_t *path)
|
||||
{
|
||||
for (mapping *m = mappings; m; m = m->next)
|
||||
|
@ -601,7 +601,7 @@ struct dos_drive_mappings
|
|||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
~dos_drive_mappings ()
|
||||
{
|
||||
mapping *n = 0;
|
||||
|
@ -640,7 +640,7 @@ struct heap_info
|
|||
if (NT_SUCCESS (status)
|
||||
&& (harray = (PDEBUG_HEAP_ARRAY) buf->HeapInformation) != NULL)
|
||||
for (ULONG hcnt = 0; hcnt < harray->Count; ++hcnt)
|
||||
{
|
||||
{
|
||||
PDEBUG_HEAP_BLOCK barray = (PDEBUG_HEAP_BLOCK)
|
||||
harray->Heaps[hcnt].Blocks;
|
||||
if (!barray)
|
||||
|
@ -662,7 +662,7 @@ struct heap_info
|
|||
}
|
||||
RtlDestroyQueryDebugBuffer (buf);
|
||||
}
|
||||
|
||||
|
||||
char *fill_if_match (char *base, ULONG type, char *dest)
|
||||
{
|
||||
for (heap *h = heap_vm_chunks; h; h = h->next)
|
||||
|
@ -686,8 +686,8 @@ struct heap_info
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
~heap_info ()
|
||||
|
||||
~heap_info ()
|
||||
{
|
||||
heap *n = 0;
|
||||
for (heap *m = heap_vm_chunks; m; m = n)
|
||||
|
@ -725,7 +725,7 @@ struct thread_info
|
|||
buf = realloc (buf, size);
|
||||
status = NtQuerySystemInformation (SystemProcessesAndThreadsInformation,
|
||||
buf, size, NULL);
|
||||
size <<= 1;
|
||||
size <<= 1;
|
||||
}
|
||||
while (status == STATUS_INFO_LENGTH_MISMATCH);
|
||||
if (!NT_SUCCESS (status))
|
||||
|
@ -753,7 +753,7 @@ struct thread_info
|
|||
THREAD_BASIC_INFORMATION tbi;
|
||||
TEB teb;
|
||||
HANDLE thread_h;
|
||||
|
||||
|
||||
if (!(thread_h = OpenThread (THREAD_QUERY_INFORMATION, FALSE,
|
||||
(ULONG) thread[i].ClientId.UniqueThread)))
|
||||
continue;
|
||||
|
@ -787,7 +787,7 @@ struct thread_info
|
|||
}
|
||||
free (buf);
|
||||
}
|
||||
|
||||
|
||||
char *fill_if_match (char *base, ULONG type, char *dest)
|
||||
{
|
||||
for (region *r = regions; r; r = r->next)
|
||||
|
@ -807,8 +807,8 @@ struct thread_info
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
~thread_info ()
|
||||
|
||||
~thread_info ()
|
||||
{
|
||||
region *n = 0;
|
||||
for (region *m = regions; m; m = n)
|
||||
|
@ -844,7 +844,7 @@ format_process_maps (void *data, char *&destbuf)
|
|||
proc_pinfo.preserve ();
|
||||
|
||||
_off64_t len = 0;
|
||||
|
||||
|
||||
union access
|
||||
{
|
||||
char flags[8];
|
||||
|
@ -857,7 +857,7 @@ format_process_maps (void *data, char *&destbuf)
|
|||
char *rbase;
|
||||
char *rend;
|
||||
} cur = {{{'\0'}}, (char *)1, 0, 0};
|
||||
|
||||
|
||||
MEMORY_BASIC_INFORMATION mb;
|
||||
dos_drive_mappings drive_maps;
|
||||
heap_info heaps (p->dwProcessId);
|
||||
|
@ -875,7 +875,7 @@ format_process_maps (void *data, char *&destbuf)
|
|||
cfree (destbuf);
|
||||
destbuf = NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Iterate over each VM region in the address space, coalescing
|
||||
memory regions with the same permissions. Once we run out, do one
|
||||
last_pass to trigger output of the last accumulated region. */
|
||||
|
@ -884,7 +884,7 @@ format_process_maps (void *data, char *&destbuf)
|
|||
i = cur.rend)
|
||||
{
|
||||
if (last_pass)
|
||||
posix_modname[0] = '\0';
|
||||
posix_modname[0] = '\0';
|
||||
if (mb.State == MEM_FREE)
|
||||
a.word = 0;
|
||||
else if (mb.State == MEM_RESERVE)
|
||||
|
@ -913,7 +913,7 @@ format_process_maps (void *data, char *&destbuf)
|
|||
(char *) mb.BaseAddress,
|
||||
(char *) mb.BaseAddress+mb.RegionSize
|
||||
};
|
||||
|
||||
|
||||
/* Windows permissions are more fine-grained than the unix rwxp,
|
||||
so we reduce clutter by manually coalescing regions sharing
|
||||
the same allocation base and effective permissions. */
|
||||
|
@ -944,7 +944,7 @@ format_process_maps (void *data, char *&destbuf)
|
|||
}
|
||||
// start of a new region (but possibly still the same allocation)
|
||||
cur = next;
|
||||
// if a new allocation, figure out what kind it is
|
||||
// if a new allocation, figure out what kind it is
|
||||
if (newbase && !last_pass && mb.State != MEM_FREE)
|
||||
{
|
||||
st.st_dev = 0;
|
||||
|
@ -1247,7 +1247,7 @@ format_process_mounts (void *data, char *&destbuf)
|
|||
cygsid p_sid;
|
||||
|
||||
if (!p_sid.getfrompw (internal_getpwuid (p->uid)))
|
||||
return 0;
|
||||
return 0;
|
||||
p_sid.string (sid_string);
|
||||
u_shared = (user_info *) open_shared (sid_string, USER_VERSION, u_hdl,
|
||||
sizeof (user_info), SH_JUSTOPEN,
|
||||
|
@ -1322,7 +1322,7 @@ get_process_state (DWORD dwProcessId)
|
|||
state = 'S';
|
||||
for (unsigned i = 0; i < sp->ThreadCount; i++)
|
||||
{
|
||||
/* FIXME: at some point we should consider generating 'O' */
|
||||
/* FIXME: at some point we should consider generating 'O' */
|
||||
if (st->State == StateRunning ||
|
||||
st->State == StateReady)
|
||||
{
|
||||
|
@ -1369,7 +1369,7 @@ get_mem_values (DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss,
|
|||
(PVOID) p, n, (length = ULONG_MAX, &length));
|
||||
if (ret == STATUS_INFO_LENGTH_MISMATCH
|
||||
|| (!NT_SUCCESS (ret) && length > n))
|
||||
{
|
||||
{
|
||||
ret = STATUS_INFO_LENGTH_MISMATCH;
|
||||
n <<= 1;
|
||||
PMEMORY_WORKING_SET_LIST new_p = (PMEMORY_WORKING_SET_LIST)
|
||||
|
|
|
@ -39,10 +39,10 @@ static _off64_t format_procnet_ifinet6 (void *, char *&);
|
|||
|
||||
static const virt_tab_t procnet_tab[] =
|
||||
{
|
||||
{ _VN ("."), FH_PROCNET, virt_directory, NULL },
|
||||
{ _VN ("."), FH_PROCNET, virt_directory, NULL },
|
||||
{ _VN (".."), FH_PROCNET, virt_directory, NULL },
|
||||
{ _VN ("if_inet6"), FH_PROCNET, virt_file, format_procnet_ifinet6 },
|
||||
{ NULL, 0, FH_BAD, virt_none, NULL }
|
||||
{ NULL, 0, FH_BAD, virt_none, NULL }
|
||||
};
|
||||
|
||||
static const int PROCNET_LINK_COUNT =
|
||||
|
|
|
@ -90,7 +90,7 @@ fhandler_procsys::exists (struct __stat64 *buf)
|
|||
{
|
||||
/* If requested, check permissions. */
|
||||
if (buf)
|
||||
get_object_attribute (h, &buf->st_uid, &buf->st_gid, &buf->st_mode);
|
||||
get_object_attribute (h, &buf->st_uid, &buf->st_gid, &buf->st_mode);
|
||||
NtClose (h);
|
||||
return virt_symlink;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ fhandler_procsys::exists (struct __stat64 *buf)
|
|||
{
|
||||
/* If requested, check permissions. */
|
||||
if (buf)
|
||||
get_object_attribute (h, &buf->st_uid, &buf->st_gid, &buf->st_mode);
|
||||
get_object_attribute (h, &buf->st_uid, &buf->st_gid, &buf->st_mode);
|
||||
NtClose (h);
|
||||
return virt_directory;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ fhandler_procsys::exists (struct __stat64 *buf)
|
|||
/* If requested, check permissions. If this is a parent handle from
|
||||
the above desperate parent check, skip. */
|
||||
if (buf && !desperate_parent_check)
|
||||
get_object_attribute (h, &buf->st_uid, &buf->st_gid, &buf->st_mode);
|
||||
get_object_attribute (h, &buf->st_uid, &buf->st_gid, &buf->st_mode);
|
||||
|
||||
/* Check for the device type. */
|
||||
status = NtQueryVolumeInformationFile (h, &io, &ffdi, sizeof ffdi,
|
||||
|
|
|
@ -44,12 +44,12 @@ static _off64_t format_procsysvipc_shm (void *, char *&);
|
|||
|
||||
static const virt_tab_t procsysvipc_tab[] =
|
||||
{
|
||||
{ _VN ("."), FH_PROCSYSVIPC, virt_directory, NULL },
|
||||
{ _VN (".."), FH_PROCSYSVIPC, virt_directory, NULL },
|
||||
{ _VN ("msg"), FH_PROCSYSVIPC, virt_file, format_procsysvipc_msg },
|
||||
{ _VN ("sem"), FH_PROCSYSVIPC, virt_file, format_procsysvipc_sem },
|
||||
{ _VN ("shm"), FH_PROCSYSVIPC, virt_file, format_procsysvipc_shm },
|
||||
{ NULL, 0, FH_BAD, virt_none, NULL }
|
||||
{ _VN ("."), FH_PROCSYSVIPC, virt_directory, NULL },
|
||||
{ _VN (".."), FH_PROCSYSVIPC, virt_directory, NULL },
|
||||
{ _VN ("msg"), FH_PROCSYSVIPC, virt_file, format_procsysvipc_msg },
|
||||
{ _VN ("sem"), FH_PROCSYSVIPC, virt_file, format_procsysvipc_sem },
|
||||
{ _VN ("shm"), FH_PROCSYSVIPC, virt_file, format_procsysvipc_shm },
|
||||
{ NULL, 0, FH_BAD, virt_none, NULL }
|
||||
};
|
||||
|
||||
static const int PROCSYSVIPC_LINK_COUNT =
|
||||
|
@ -77,10 +77,10 @@ fhandler_procsysvipc::exists ()
|
|||
if (entry)
|
||||
{
|
||||
if (entry->type == virt_file)
|
||||
{
|
||||
if (cygserver_running != CYGSERVER_OK)
|
||||
return virt_none;
|
||||
}
|
||||
{
|
||||
if (cygserver_running != CYGSERVER_OK)
|
||||
return virt_none;
|
||||
}
|
||||
fileid = entry - procsysvipc_tab;
|
||||
return entry->type;
|
||||
}
|
||||
|
@ -233,26 +233,26 @@ format_procsysvipc_msg (void *, char *&destbuf)
|
|||
msgctl (msginfo.msgmni, IPC_INFO, (struct msqid_ds *) xmsqids);
|
||||
|
||||
bufptr += __small_sprintf (bufptr,
|
||||
" key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n");
|
||||
" key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n");
|
||||
|
||||
for (int i = 0; i < msginfo.msgmni; i++) {
|
||||
if (xmsqids[i].msg_qbytes != 0) {
|
||||
bufptr += sprintf (bufptr,
|
||||
"%10llu %10u %5o %11lu %10lu %5d %5d %5lu %5lu %5lu %5lu %10ld %10ld %10ld\n",
|
||||
xmsqids[i].msg_perm.key,
|
||||
IXSEQ_TO_IPCID(i, xmsqids[i].msg_perm),
|
||||
xmsqids[i].msg_perm.mode,
|
||||
xmsqids[i].msg_cbytes,
|
||||
xmsqids[i].msg_qnum,
|
||||
xmsqids[i].msg_lspid,
|
||||
xmsqids[i].msg_lrpid,
|
||||
xmsqids[i].msg_perm.uid,
|
||||
xmsqids[i].msg_perm.gid,
|
||||
xmsqids[i].msg_perm.cuid,
|
||||
xmsqids[i].msg_perm.cgid,
|
||||
xmsqids[i].msg_stime,
|
||||
xmsqids[i].msg_rtime,
|
||||
xmsqids[i].msg_ctime);
|
||||
"%10llu %10u %5o %11lu %10lu %5d %5d %5lu %5lu %5lu %5lu %10ld %10ld %10ld\n",
|
||||
xmsqids[i].msg_perm.key,
|
||||
IXSEQ_TO_IPCID(i, xmsqids[i].msg_perm),
|
||||
xmsqids[i].msg_perm.mode,
|
||||
xmsqids[i].msg_cbytes,
|
||||
xmsqids[i].msg_qnum,
|
||||
xmsqids[i].msg_lspid,
|
||||
xmsqids[i].msg_lrpid,
|
||||
xmsqids[i].msg_perm.uid,
|
||||
xmsqids[i].msg_perm.gid,
|
||||
xmsqids[i].msg_perm.cuid,
|
||||
xmsqids[i].msg_perm.cgid,
|
||||
xmsqids[i].msg_stime,
|
||||
xmsqids[i].msg_rtime,
|
||||
xmsqids[i].msg_ctime);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,21 +280,21 @@ format_procsysvipc_sem (void *, char *&destbuf)
|
|||
semctl (seminfo.semmni, 0, IPC_INFO, semun);
|
||||
|
||||
bufptr += __small_sprintf (bufptr,
|
||||
" key semid perms nsems uid gid cuid cgid otime ctime\n");
|
||||
" key semid perms nsems uid gid cuid cgid otime ctime\n");
|
||||
for (int i = 0; i < seminfo.semmni; i++) {
|
||||
if ((xsemids[i].sem_perm.mode & SEM_ALLOC) != 0) {
|
||||
bufptr += sprintf (bufptr,
|
||||
"%10llu %10u %5o %10d %5lu %5lu %5lu %5lu %10ld %10ld\n",
|
||||
xsemids[i].sem_perm.key,
|
||||
IXSEQ_TO_IPCID(i, xsemids[i].sem_perm),
|
||||
xsemids[i].sem_perm.mode,
|
||||
xsemids[i].sem_nsems,
|
||||
xsemids[i].sem_perm.uid,
|
||||
xsemids[i].sem_perm.gid,
|
||||
xsemids[i].sem_perm.cuid,
|
||||
xsemids[i].sem_perm.cgid,
|
||||
xsemids[i].sem_otime,
|
||||
xsemids[i].sem_ctime);
|
||||
"%10llu %10u %5o %10d %5lu %5lu %5lu %5lu %10ld %10ld\n",
|
||||
xsemids[i].sem_perm.key,
|
||||
IXSEQ_TO_IPCID(i, xsemids[i].sem_perm),
|
||||
xsemids[i].sem_perm.mode,
|
||||
xsemids[i].sem_nsems,
|
||||
xsemids[i].sem_perm.uid,
|
||||
xsemids[i].sem_perm.gid,
|
||||
xsemids[i].sem_perm.cuid,
|
||||
xsemids[i].sem_perm.cgid,
|
||||
xsemids[i].sem_otime,
|
||||
xsemids[i].sem_ctime);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,25 +319,25 @@ format_procsysvipc_shm (void *, char *&destbuf)
|
|||
shmctl (shminfo.shmmni, IPC_INFO, (struct shmid_ds *) xshmids);
|
||||
|
||||
bufptr += __small_sprintf (bufptr,
|
||||
" key shmid perms size cpid lpid nattch uid gid cuid cgid atime dtime ctime\n");
|
||||
" key shmid perms size cpid lpid nattch uid gid cuid cgid atime dtime ctime\n");
|
||||
for (int i = 0; i < shminfo.shmmni; i++) {
|
||||
if (xshmids[i].shm_perm.mode & 0x0800) {
|
||||
bufptr += sprintf (bufptr,
|
||||
"%10llu %10u %5o %10u %5d %5d %6u %5lu %5lu %5lu %5lu %10ld %10ld %10ld\n",
|
||||
xshmids[i].shm_perm.key,
|
||||
IXSEQ_TO_IPCID(i, xshmids[i].shm_perm),
|
||||
xshmids[i].shm_perm.mode,
|
||||
xshmids[i].shm_segsz,
|
||||
xshmids[i].shm_cpid,
|
||||
xshmids[i].shm_lpid,
|
||||
xshmids[i].shm_nattch,
|
||||
xshmids[i].shm_perm.uid,
|
||||
xshmids[i].shm_perm.gid,
|
||||
xshmids[i].shm_perm.cuid,
|
||||
xshmids[i].shm_perm.cgid,
|
||||
xshmids[i].shm_atime,
|
||||
xshmids[i].shm_dtime,
|
||||
xshmids[i].shm_ctime);
|
||||
"%10llu %10u %5o %10u %5d %5d %6u %5lu %5lu %5lu %5lu %10ld %10ld %10ld\n",
|
||||
xshmids[i].shm_perm.key,
|
||||
IXSEQ_TO_IPCID(i, xshmids[i].shm_perm),
|
||||
xshmids[i].shm_perm.mode,
|
||||
xshmids[i].shm_segsz,
|
||||
xshmids[i].shm_cpid,
|
||||
xshmids[i].shm_lpid,
|
||||
xshmids[i].shm_nattch,
|
||||
xshmids[i].shm_perm.uid,
|
||||
xshmids[i].shm_perm.gid,
|
||||
xshmids[i].shm_perm.cuid,
|
||||
xshmids[i].shm_perm.cgid,
|
||||
xshmids[i].shm_atime,
|
||||
xshmids[i].shm_dtime,
|
||||
xshmids[i].shm_ctime);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ fhandler_dev_raw::ioctl (unsigned int cmd, void *buf)
|
|||
|| (op->rd_parm > 1 && (op->rd_parm % 512))
|
||||
|| (get_flags () & O_DIRECT))
|
||||
/* The conditions for a *valid* parameter are these:
|
||||
- If there's still data in the current buffer, it must
|
||||
- If there's still data in the current buffer, it must
|
||||
fit in the new buffer.
|
||||
- The new size is either 0 or 1, both indicating unbufferd
|
||||
I/O, or the new buffersize must be a multiple of 512.
|
||||
|
|
|
@ -330,11 +330,11 @@ fhandler_registry::exists ()
|
|||
if (hKey == HKEY_PERFORMANCE_DATA)
|
||||
{
|
||||
/* RegEnumValue () returns garbage for this key.
|
||||
RegQueryValueEx () returns a PERF_DATA_BLOCK even
|
||||
if a value does not contain any counter objects.
|
||||
So allow access to the generic names and to
|
||||
(blank separated) lists of counter numbers.
|
||||
Never allow access to "Add", see above comment. */
|
||||
RegQueryValueEx () returns a PERF_DATA_BLOCK even
|
||||
if a value does not contain any counter objects.
|
||||
So allow access to the generic names and to
|
||||
(blank separated) lists of counter numbers.
|
||||
Never allow access to "Add", see above comment. */
|
||||
for (int i = 0; i < PERF_DATA_FILE_COUNT
|
||||
&& file_type == virt_none; i++)
|
||||
{
|
||||
|
@ -574,7 +574,7 @@ fhandler_registry::readdir (DIR *dir, dirent *de)
|
|||
if ((HKEY) dir->__handle == HKEY_PERFORMANCE_DATA)
|
||||
{
|
||||
/* RegEnumValue () returns garbage for this key,
|
||||
simulate only a minimal listing of the generic names. */
|
||||
simulate only a minimal listing of the generic names. */
|
||||
if (dir->__d_position >= SPECIAL_DOT_FILE_COUNT + PERF_DATA_FILE_COUNT)
|
||||
goto out;
|
||||
strcpy (de->d_name, perf_data_files[dir->__d_position - SPECIAL_DOT_FILE_COUNT]);
|
||||
|
|
|
@ -508,7 +508,7 @@ search_wsa_event_slot (LONG new_serial_number)
|
|||
{
|
||||
HANDLE searchmtx;
|
||||
RtlInitUnicodeString (&uname, sock_shared_name (searchname,
|
||||
wsa_events[slot].serial_number));
|
||||
wsa_events[slot].serial_number));
|
||||
InitializeObjectAttributes (&attr, &uname, 0, get_session_parent_dir (),
|
||||
NULL);
|
||||
status = NtOpenMutant (&searchmtx, READ_CONTROL, &attr);
|
||||
|
@ -723,7 +723,7 @@ fhandler_socket::fixup_after_fork (HANDLE parent)
|
|||
fhandler_base::fixup_after_fork (parent);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SOCKET new_sock = WSASocketW (FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO,
|
||||
FROM_PROTOCOL_INFO, prot_info_ptr, 0,
|
||||
WSA_FLAG_OVERLAPPED);
|
||||
|
@ -735,7 +735,7 @@ fhandler_socket::fixup_after_fork (HANDLE parent)
|
|||
else
|
||||
{
|
||||
/* Even though the original socket was not inheritable, the duplicated
|
||||
socket is potentially inheritable again. */
|
||||
socket is potentially inheritable again. */
|
||||
SetHandleInformation ((HANDLE) new_sock, HANDLE_FLAG_INHERIT, 0);
|
||||
set_io_handle ((HANDLE) new_sock);
|
||||
debug_printf ("WSASocket succeeded (%lx)", new_sock);
|
||||
|
@ -1219,7 +1219,7 @@ fhandler_socket::accept4 (struct sockaddr *peer, int *len, int flags)
|
|||
if (peer)
|
||||
{
|
||||
if (get_addr_family () == AF_LOCAL)
|
||||
{
|
||||
{
|
||||
/* FIXME: Right now we have no way to determine the
|
||||
bound socket name of the peer's socket. For now
|
||||
we just fake an unbound socket on the other side. */
|
||||
|
@ -1257,7 +1257,7 @@ fhandler_socket::getsockname (struct sockaddr *name, int *namelen)
|
|||
sun.sun_family = AF_LOCAL;
|
||||
sun.sun_path[0] = '\0';
|
||||
if (get_sun_path ())
|
||||
strncat (sun.sun_path, get_sun_path (), UNIX_PATH_LEN - 1);
|
||||
strncat (sun.sun_path, get_sun_path (), UNIX_PATH_LEN - 1);
|
||||
memcpy (name, &sun, min (*namelen, (int) SUN_LEN (&sun) + 1));
|
||||
*namelen = (int) SUN_LEN (&sun) + (get_sun_path () ? 1 : 0);
|
||||
res = 0;
|
||||
|
@ -1331,7 +1331,7 @@ fhandler_socket::getpeername (struct sockaddr *name, int *namelen)
|
|||
sun.sun_family = AF_LOCAL;
|
||||
sun.sun_path[0] = '\0';
|
||||
if (get_peer_sun_path ())
|
||||
strncat (sun.sun_path, get_peer_sun_path (), UNIX_PATH_LEN - 1);
|
||||
strncat (sun.sun_path, get_peer_sun_path (), UNIX_PATH_LEN - 1);
|
||||
memcpy (name, &sun, min (*namelen, (int) SUN_LEN (&sun) + 1));
|
||||
*namelen = (int) SUN_LEN (&sun) + (get_peer_sun_path () ? 1 : 0);
|
||||
}
|
||||
|
@ -1437,7 +1437,7 @@ fhandler_socket::recv_internal (LPWSAMSG wsamsg)
|
|||
res = WSARecvMsg (get_socket (), wsamsg, &wret, NULL, NULL);
|
||||
/* This is working around a really weird problem in WinSock.
|
||||
|
||||
Assume you create a socket, fork the process (thus duplicating
|
||||
Assume you create a socket, fork the process (thus duplicating
|
||||
the socket), connect the socket in the child, then call recv
|
||||
on the original socket handle in the parent process.
|
||||
In this scenario, calls to WinSock's recvfrom and WSARecvFrom
|
||||
|
@ -1449,7 +1449,7 @@ fhandler_socket::recv_internal (LPWSAMSG wsamsg)
|
|||
is bound locally, but in the parent process, WinSock doesn't know
|
||||
about that and fails, while the same test is omitted in the recv
|
||||
functions.
|
||||
|
||||
|
||||
This also covers another weird case: Winsock returns WSAEFAULT if
|
||||
namelen is a valid pointer while name is NULL. Both parameters are
|
||||
ignored for TCP sockets, so this only occurs when using UDP socket. */
|
||||
|
@ -1610,7 +1610,7 @@ fhandler_socket::send_internal (struct _WSAMSG *wsamsg, int flags)
|
|||
/* FIXME: Look for a way to split a message into the least number of
|
||||
pieces to minimize the number of WsaSendTo calls. */
|
||||
if (get_socket_type () == SOCK_STREAM)
|
||||
{
|
||||
{
|
||||
buf.buf = wsamsg->lpBuffers[i].buf + off;
|
||||
buf.len = wsamsg->lpBuffers[i].len - off;
|
||||
/* See net.cc:fdsock() and MSDN KB 823764 */
|
||||
|
@ -1811,7 +1811,7 @@ fhandler_socket::close ()
|
|||
#define CONV_OLD_TO_NEW_SIO(old) (((old)&0xff00ffff)|(((long)sizeof(struct ifreq)&IOCPARM_MASK)<<16))
|
||||
|
||||
struct __old_ifreq {
|
||||
#define __OLD_IFNAMSIZ 16
|
||||
#define __OLD_IFNAMSIZ 16
|
||||
union {
|
||||
char ifrn_name[__OLD_IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
} ifr_ifrn;
|
||||
|
|
|
@ -1449,7 +1449,7 @@ fhandler_dev_tape::dup (fhandler_base *child)
|
|||
lock (-1);
|
||||
fhandler_dev_tape *fh = (fhandler_dev_tape *) child;
|
||||
if (!DuplicateHandle (GetCurrentProcess (), mt_mtx,
|
||||
GetCurrentProcess (), &fh->mt_mtx,
|
||||
GetCurrentProcess (), &fh->mt_mtx,
|
||||
0, TRUE, DUPLICATE_SAME_ACCESS))
|
||||
{
|
||||
debug_printf ("dup(%s) failed, mutex handle %x, %E",
|
||||
|
|
|
@ -145,13 +145,13 @@ tty_min::is_orphaned_process_group (int pgid)
|
|||
_pinfo *p = pids[i];
|
||||
termios_printf ("checking pid %d - has pgid %d\n", p->pid, p->pgid);
|
||||
if (!p || !p->exists () || p->pgid != pgid)
|
||||
continue;
|
||||
continue;
|
||||
pinfo ppid (p->ppid);
|
||||
if (!ppid)
|
||||
continue;
|
||||
termios_printf ("ppid->pgid %d, ppid->sid %d", ppid->pgid, ppid->sid);
|
||||
if (ppid->pgid != pgid && ppid->sid == myself->sid)
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ fhandler_termios::bg_check (int sig)
|
|||
kill_pgrp (myself->pgid, si);
|
||||
}
|
||||
return bg_signalled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define set_input_done(x) input_done = input_done || (x)
|
||||
|
|
|
@ -1233,7 +1233,7 @@ fhandler_tty_slave::fstat (struct __stat64 *st)
|
|||
&st->st_mode))
|
||||
{
|
||||
/* If we can't access the ACL, or if the tty doesn't actually exist,
|
||||
then fake uid and gid to strict, system-like values. */
|
||||
then fake uid and gid to strict, system-like values. */
|
||||
st->st_mode = S_IFCHR | S_IRUSR | S_IWUSR;
|
||||
st->st_uid = 18;
|
||||
st->st_gid = 544;
|
||||
|
@ -1690,7 +1690,7 @@ fhandler_pty_master::pty_master_thread ()
|
|||
HANDLE client = NULL;
|
||||
|
||||
if (!ReadFile (master_ctl, &req, sizeof req, &len, NULL))
|
||||
{
|
||||
{
|
||||
termios_printf ("ReadFile, %E");
|
||||
goto reply;
|
||||
}
|
||||
|
|
|
@ -216,17 +216,17 @@ get_obj_handle_count (HANDLE h)
|
|||
class lockf_t
|
||||
{
|
||||
public:
|
||||
short lf_flags; /* Semantics: F_POSIX, F_FLOCK, F_WAIT */
|
||||
short lf_type; /* Lock type: F_RDLCK, F_WRLCK */
|
||||
_off64_t lf_start; /* Byte # of the start of the lock */
|
||||
_off64_t lf_end; /* Byte # of the end of the lock (-1=EOF) */
|
||||
short lf_flags; /* Semantics: F_POSIX, F_FLOCK, F_WAIT */
|
||||
short lf_type; /* Lock type: F_RDLCK, F_WRLCK */
|
||||
_off64_t lf_start; /* Byte # of the start of the lock */
|
||||
_off64_t lf_end; /* Byte # of the end of the lock (-1=EOF) */
|
||||
long long lf_id; /* Cygwin PID for POSIX locks, a unique id per
|
||||
file table entry for BSD flock locks. */
|
||||
DWORD lf_wid; /* Win PID of the resource holding the lock */
|
||||
DWORD lf_wid; /* Win PID of the resource holding the lock */
|
||||
class lockf_t **lf_head; /* Back pointer to the head of the lockf_t list */
|
||||
class inode_t *lf_inode; /* Back pointer to the inode_t */
|
||||
class lockf_t *lf_next; /* Pointer to the next lock on this inode_t */
|
||||
HANDLE lf_obj; /* Handle to the lock event object. */
|
||||
HANDLE lf_obj; /* Handle to the lock event object. */
|
||||
|
||||
lockf_t ()
|
||||
: lf_flags (0), lf_type (0), lf_start (0), lf_end (0), lf_id (0),
|
||||
|
@ -263,17 +263,17 @@ class inode_t
|
|||
|
||||
public:
|
||||
LIST_ENTRY (inode_t) i_next;
|
||||
lockf_t *i_lockf; /* List of locks of this process. */
|
||||
lockf_t *i_all_lf; /* Temp list of all locks for this file. */
|
||||
lockf_t *i_lockf; /* List of locks of this process. */
|
||||
lockf_t *i_all_lf; /* Temp list of all locks for this file. */
|
||||
|
||||
__dev32_t i_dev; /* Device ID */
|
||||
__ino64_t i_ino; /* inode number */
|
||||
__dev32_t i_dev; /* Device ID */
|
||||
__ino64_t i_ino; /* inode number */
|
||||
|
||||
private:
|
||||
HANDLE i_dir;
|
||||
HANDLE i_mtx;
|
||||
unsigned long i_wait; /* Number of blocked threads waiting for
|
||||
a blocking lock. */
|
||||
HANDLE i_dir;
|
||||
HANDLE i_mtx;
|
||||
unsigned long i_wait; /* Number of blocked threads waiting for
|
||||
a blocking lock. */
|
||||
|
||||
public:
|
||||
inode_t (__dev32_t dev, __ino64_t ino);
|
||||
|
|
|
@ -368,7 +368,7 @@ frok::parent (volatile char * volatile stack_here)
|
|||
in the child. */
|
||||
PTEB teb = NtCurrentTeb ();
|
||||
if (!teb->DeallocationStack)
|
||||
{
|
||||
{
|
||||
/* Pthread with application-provided stack. Don't set up a
|
||||
PAGE_GUARD page. guardsize == -1 is used in alloc_stack_hard_way
|
||||
to recognize this type of stack. */
|
||||
|
|
|
@ -86,9 +86,9 @@ char *old_title;
|
|||
Rather, the strings are placed in the R/O section .rdata, so we get
|
||||
a SEGV if some code erroneously tries to overwrite these strings. */
|
||||
#define _ROU(_s) \
|
||||
{ Length: sizeof (_s) - sizeof (WCHAR), \
|
||||
MaximumLength: sizeof (_s), \
|
||||
Buffer: (PWSTR) (_s) }
|
||||
{ Length: sizeof (_s) - sizeof (WCHAR), \
|
||||
MaximumLength: sizeof (_s), \
|
||||
Buffer: (PWSTR) (_s) }
|
||||
UNICODE_STRING _RDATA ro_u_empty = _ROU (L"");
|
||||
UNICODE_STRING _RDATA ro_u_lnk = _ROU (L".lnk");
|
||||
UNICODE_STRING _RDATA ro_u_exe = _ROU (L".exe");
|
||||
|
|
|
@ -346,7 +346,7 @@ internal_getgroups (int gidsetsize, __gid32_t *grouplist, cygpsid * srchsid)
|
|||
hToken = cygheap->user.primary_token ();
|
||||
else
|
||||
hToken = hProcToken;
|
||||
|
||||
|
||||
status = NtQueryInformationToken (hToken, TokenGroups, NULL, 0, &size);
|
||||
if (NT_SUCCESS (status) || status == STATUS_BUFFER_TOO_SMALL)
|
||||
{
|
||||
|
|
|
@ -76,7 +76,7 @@ heap_init ()
|
|||
}
|
||||
}
|
||||
/* Since VirtualAlloc only reserves at allocation granularity
|
||||
boundaries, we round up here, too. Otherwise we might end
|
||||
boundaries, we round up here, too. Otherwise we might end
|
||||
up at a bogus page-aligned address. */
|
||||
start_address = roundup2 (start_address + mbi.RegionSize,
|
||||
wincap.allocation_granularity ());
|
||||
|
|
|
@ -510,7 +510,7 @@ CygwinCreateThread (LPTHREAD_START_ROUTINE thread_func, PVOID thread_arg,
|
|||
ULONG real_guardsize = 0;
|
||||
thread_wrapper_arg *wrapper_arg;
|
||||
HANDLE thread = NULL;
|
||||
|
||||
|
||||
wrapper_arg = (thread_wrapper_arg *) ccalloc (HEAP_STR, 1,
|
||||
sizeof *wrapper_arg);
|
||||
if (!wrapper_arg)
|
||||
|
@ -549,9 +549,9 @@ CygwinCreateThread (LPTHREAD_START_ROUTINE thread_func, PVOID thread_arg,
|
|||
real_stacksize = roundup2 (real_stacksize,
|
||||
wincap.allocation_granularity ());
|
||||
/* Reserve stack.
|
||||
FIXME? If the TOP_DOWN method tends to collide too much with
|
||||
other stuff, we should provide our own mechanism to find a
|
||||
suitable place for the stack. Top down from the start of
|
||||
FIXME? If the TOP_DOWN method tends to collide too much with
|
||||
other stuff, we should provide our own mechanism to find a
|
||||
suitable place for the stack. Top down from the start of
|
||||
the Cygwin DLL comes to mind. */
|
||||
real_stackaddr = VirtualAlloc (NULL, real_stacksize,
|
||||
MEM_RESERVE | MEM_TOP_DOWN,
|
||||
|
|
|
@ -222,7 +222,7 @@ MapView (HANDLE h, void *addr, size_t len, DWORD openflags,
|
|||
SetLastError (RtlNtStatusToDosError (ret));
|
||||
}
|
||||
debug_printf ("%p (status %p) = NtMapViewOfSection (h:%x, addr:%x, len:%u,"
|
||||
" off:%X, protect:%x, type:%x)",
|
||||
" off:%X, protect:%x, type:%x)",
|
||||
base, ret, h, addr, len, off, protect, 0);
|
||||
return base;
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ details. */
|
|||
continue; \
|
||||
case MMAP_RAISE_SIGBUS: \
|
||||
raise(SIGBUS); \
|
||||
default: \
|
||||
break; \
|
||||
default: \
|
||||
break; \
|
||||
} \
|
||||
break; \
|
||||
} \
|
||||
|
|
|
@ -132,7 +132,7 @@ fs_info_cache::genhash (PFILE_FS_VOLUME_INFORMATION pffvi)
|
|||
uint32_t hash = 0;
|
||||
const uint16_t *p = (const uint16_t *) pffvi;
|
||||
const uint16_t *end = (const uint16_t *)
|
||||
((const uint8_t *) p + sizeof *pffvi
|
||||
((const uint8_t *) p + sizeof *pffvi
|
||||
+ pffvi->VolumeLabelLength - sizeof (WCHAR));
|
||||
pffvi->__dummy = 0; /* This member can have random values! */
|
||||
while (p < end)
|
||||
|
@ -193,14 +193,14 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
|
|||
InitializeObjectAttributes (&attr, upath, OBJ_CASE_INSENSITIVE, NULL,
|
||||
NULL);
|
||||
/* Note: Don't use the FILE_OPEN_REPARSE_POINT flag here. The reason
|
||||
is that symlink_info::check relies on being able to open a handle
|
||||
is that symlink_info::check relies on being able to open a handle
|
||||
to the target of a volume mount point. */
|
||||
status = NtOpenFile (&vol, access, &attr, &io, FILE_SHARE_VALID_FLAGS,
|
||||
FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
/* At least one filesystem (HGFS, VMware shared folders) doesn't like
|
||||
to be opened with access set to just READ_CONTROL. */
|
||||
to be opened with access set to just READ_CONTROL. */
|
||||
if (status == STATUS_INVALID_PARAMETER)
|
||||
{
|
||||
{
|
||||
access |= FILE_READ_DATA;
|
||||
status = NtOpenFile (&vol, access, &attr, &io, FILE_SHARE_VALID_FLAGS,
|
||||
FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
|
@ -405,7 +405,7 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
|
|||
if (!got_fs ())
|
||||
{
|
||||
/* The filesystem name is only used in fillout_mntent and only if
|
||||
the filesystem isn't one of the well-known filesystems anyway. */
|
||||
the filesystem isn't one of the well-known filesystems anyway. */
|
||||
sys_wcstombs (fsn, sizeof fsn, ffai_buf.ffai.FileSystemName,
|
||||
ffai_buf.ffai.FileSystemNameLength / sizeof (WCHAR));
|
||||
strlwr (fsn);
|
||||
|
@ -1083,7 +1083,7 @@ fstab_list_flags ()
|
|||
{
|
||||
char *bp = buf;
|
||||
for (o = oopts; o < (oopts + (sizeof (oopts) / sizeof (oopts[0]))); o++)
|
||||
{
|
||||
{
|
||||
bp = stpcpy (bp, o->name);
|
||||
*bp++ = ',';
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ class fs_info
|
|||
void clear ()
|
||||
{
|
||||
memset (&status, 0 , sizeof status);
|
||||
sernum = 0UL;
|
||||
sernum = 0UL;
|
||||
fsn[0] = '\0';
|
||||
}
|
||||
fs_info () { clear (); }
|
||||
|
|
|
@ -498,12 +498,12 @@ fdsock (cygheap_fdmanip& fd, const device *dev, SOCKET soc)
|
|||
scanners or other network-oriented software replace normal sockets
|
||||
with their own kind, which is running through a filter driver called
|
||||
"layered service provider" (LSP).
|
||||
|
||||
|
||||
LSP sockets are not kernel objects. They are typically not marked as
|
||||
inheritable, nor are they IFS handles. They are in fact not inheritable
|
||||
to child processes, and it does not help to mark them inheritable via
|
||||
SetHandleInformation. Subsequent socket calls in the child process fail
|
||||
with error 10038, WSAENOTSOCK.
|
||||
with error 10038, WSAENOTSOCK.
|
||||
|
||||
The only way up to Windows Server 2003 to make these sockets usable in
|
||||
child processes is to duplicate them via WSADuplicateSocket/WSASocket
|
||||
|
@ -511,7 +511,7 @@ fdsock (cygheap_fdmanip& fd, const device *dev, SOCKET soc)
|
|||
we only do this on affected systems. If we recognize a non-inheritable
|
||||
socket we switch to inheritance/dup via WSADuplicateSocket/WSASocket for
|
||||
that socket.
|
||||
|
||||
|
||||
Starting with Vista there's another neat way to workaround these annoying
|
||||
LSP sockets. WSAIoctl allows to fetch the underlying base socket, which
|
||||
is a normal, inheritable IFS handle. So we fetch the base socket,
|
||||
|
@ -531,7 +531,7 @@ fdsock (cygheap_fdmanip& fd, const device *dev, SOCKET soc)
|
|||
ret = WSAIoctl (soc, SIO_BASE_HANDLE, NULL, 0, (void *) &base_soc,
|
||||
sizeof (base_soc), &bret, NULL, NULL);
|
||||
if (ret)
|
||||
debug_printf ("WSAIoctl: %lu", WSAGetLastError ());
|
||||
debug_printf ("WSAIoctl: %lu", WSAGetLastError ());
|
||||
else if (base_soc != soc
|
||||
&& GetHandleInformation ((HANDLE) base_soc, &flags)
|
||||
&& (flags & HANDLE_FLAG_INHERIT))
|
||||
|
@ -728,7 +728,7 @@ cygwin_setsockopt (int fd, int level, int optname, const void *optval,
|
|||
optname = convert_ws1_ip_optname (optname);
|
||||
|
||||
/* Per POSIX we must not be able to reuse a complete duplicate of a
|
||||
local TCP address (same IP, same port), even if SO_REUSEADDR has been
|
||||
local TCP address (same IP, same port), even if SO_REUSEADDR has been
|
||||
set. That's unfortunately possible in WinSock, and this has never
|
||||
been changed to maintain backward compatibility. Instead, the
|
||||
SO_EXCLUSIVEADDRUSE option has been added to allow an application to
|
||||
|
@ -842,7 +842,7 @@ cygwin_getsockopt (int fd, int level, int optname, void *optval,
|
|||
case SO_KEEPALIVE:
|
||||
case SO_DONTROUTE:
|
||||
/* Regression in Vista and later: instead of a 4 byte BOOL
|
||||
value, a 1 byte BOOLEAN value is returned, in contrast
|
||||
value, a 1 byte BOOLEAN value is returned, in contrast
|
||||
to older systems and the documentation. Since an int
|
||||
type is expected by the calling application, we convert
|
||||
the result here. */
|
||||
|
|
|
@ -116,7 +116,7 @@ __get_lcid_from_locale (const char *name)
|
|||
{ "tg-TJ" , L"tg-Cyrl-TJ" },
|
||||
{ "tzm-DZ", L"tzm-Latn-DZ" },
|
||||
{ "uz-UZ" , L"uz-Latn-UZ" },
|
||||
{ NULL , NULL }
|
||||
{ NULL , NULL }
|
||||
};
|
||||
for (int i = 0; sc_only_locale[i].loc
|
||||
&& sc_only_locale[i].loc[0] <= locale[0]; ++i)
|
||||
|
@ -197,8 +197,8 @@ __get_lcid_from_locale (const char *name)
|
|||
LCID lcid;
|
||||
} ambiguous_locale[] = {
|
||||
{ "bs_BA", MAKELANGID (LANG_BOSNIAN, 0x05) },
|
||||
{ "nn_NO", MAKELANGID (LANG_NORWEGIAN, SUBLANG_NORWEGIAN_NYNORSK) },
|
||||
{ "no_NO", MAKELANGID (LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL) },
|
||||
{ "nn_NO", MAKELANGID (LANG_NORWEGIAN, SUBLANG_NORWEGIAN_NYNORSK) },
|
||||
{ "no_NO", MAKELANGID (LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL) },
|
||||
{ "sr_BA", MAKELANGID (LANG_BOSNIAN,
|
||||
SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC) },
|
||||
{ "sr_CS", MAKELANGID (LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC) },
|
||||
|
@ -300,16 +300,16 @@ lc_mbstowcs (mbtowc_p f_mbtowc, const char *charset,
|
|||
while (n > 0)
|
||||
{
|
||||
bytes = f_mbtowc (_REENT, pwcs, t, 6 /* fake, always enough */,
|
||||
charset, &state);
|
||||
charset, &state);
|
||||
if (bytes == (size_t) -1)
|
||||
{
|
||||
state.__count = 0;
|
||||
bytes = 1;
|
||||
{
|
||||
state.__count = 0;
|
||||
bytes = 1;
|
||||
if (pwcs)
|
||||
*pwcs = L' ';
|
||||
}
|
||||
}
|
||||
else if (bytes == 0)
|
||||
break;
|
||||
break;
|
||||
t += bytes;
|
||||
++ret;
|
||||
if (pwcs)
|
||||
|
@ -477,10 +477,10 @@ conv_grouping (LCID lcid, LCTYPE type, char **lc_ptr)
|
|||
for (char *c = buf; *c; ++c)
|
||||
{
|
||||
if (*c < '0' || *c > '9')
|
||||
continue;
|
||||
continue;
|
||||
char val = *c - '0';
|
||||
if (!val)
|
||||
{
|
||||
{
|
||||
repeat = true;
|
||||
break;
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ __set_lc_time_from_win (const char *name,
|
|||
/* codeset */
|
||||
_time_locale->codeset = lc_time_ptr;
|
||||
lc_time_ptr = stpcpy (lc_time_ptr, charset) + 1;
|
||||
|
||||
|
||||
if (lcid)
|
||||
{
|
||||
char locale[ENCODING_LEN + 1];
|
||||
|
@ -559,7 +559,7 @@ __set_lc_time_from_win (const char *name,
|
|||
The workaround is to use LOCALE_SMONTHNAME* in these locales,
|
||||
even for the abbreviated month name. */
|
||||
const LCTYPE mon_base =
|
||||
lcid == MAKELANGID (LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN)
|
||||
lcid == MAKELANGID (LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN)
|
||||
|| lcid == MAKELANGID (LANG_KOREAN, SUBLANG_KOREAN)
|
||||
? LOCALE_SMONTHNAME1 : LOCALE_SABBREVMONTHNAME1;
|
||||
for (int i = 0; i < 12; ++i)
|
||||
|
@ -726,12 +726,12 @@ __set_lc_time_from_win (const char *name,
|
|||
if (!era)
|
||||
{
|
||||
_time_locale->wera =
|
||||
_time_locale->wera_d_fmt =
|
||||
_time_locale->wera_d_fmt =
|
||||
_time_locale->wera_d_t_fmt =
|
||||
_time_locale->wera_t_fmt =
|
||||
_time_locale->walt_digits = (const wchar_t *) lc_time_ptr;
|
||||
_time_locale->era =
|
||||
_time_locale->era_d_fmt =
|
||||
_time_locale->era_d_fmt =
|
||||
_time_locale->era_d_t_fmt =
|
||||
_time_locale->era_t_fmt =
|
||||
_time_locale->alt_digits = (const char *) lc_time_ptr;
|
||||
|
@ -816,7 +816,7 @@ __set_lc_ctype_from_win (const char *name,
|
|||
}
|
||||
|
||||
char *tmp = (char *) realloc (new_lc_ctype_buf,
|
||||
lc_ctype_ptr - new_lc_ctype_buf);
|
||||
lc_ctype_ptr - new_lc_ctype_buf);
|
||||
if (!tmp)
|
||||
{
|
||||
free (new_lc_ctype_buf);
|
||||
|
@ -874,9 +874,9 @@ __set_lc_numeric_from_win (const char *name,
|
|||
/* codeset */
|
||||
_numeric_locale->codeset = lc_numeric_ptr;
|
||||
lc_numeric_ptr = stpcpy (lc_numeric_ptr, charset) + 1;
|
||||
|
||||
|
||||
char *tmp = (char *) realloc (new_lc_numeric_buf,
|
||||
lc_numeric_ptr - new_lc_numeric_buf);
|
||||
lc_numeric_ptr - new_lc_numeric_buf);
|
||||
if (!tmp)
|
||||
{
|
||||
free (new_lc_numeric_buf);
|
||||
|
@ -1003,7 +1003,7 @@ __set_lc_monetary_from_win (const char *name,
|
|||
lc_monetary_ptr = stpcpy (lc_monetary_ptr, charset) + 1;
|
||||
|
||||
char *tmp = (char *) realloc (new_lc_monetary_buf,
|
||||
lc_monetary_ptr - new_lc_monetary_buf);
|
||||
lc_monetary_ptr - new_lc_monetary_buf);
|
||||
if (!tmp)
|
||||
{
|
||||
free (new_lc_monetary_buf);
|
||||
|
@ -1298,7 +1298,7 @@ __set_charset_from_locale (const char *locale, char *charset)
|
|||
|| lcid == 0x241a /* sr_RS (Serbian Language/Serbia) */
|
||||
|| lcid == 0x2c1a /* sr_ME (Serbian Language/Montenegro)*/
|
||||
|| lcid == 0x0442) /* tk_TM (Turkmen/Turkmenistan) */
|
||||
cs = "UTF-8";
|
||||
cs = "UTF-8";
|
||||
else if (lcid == 0x041c) /* sq_AL (Albanian/Albania) */
|
||||
cs = "ISO-8859-1";
|
||||
else
|
||||
|
@ -1317,11 +1317,11 @@ __set_charset_from_locale (const char *locale, char *charset)
|
|||
IQTElif alphabet */
|
||||
|| (lcid == 0x0444 && has_modifier ("@iqtelif"))
|
||||
|| lcid == 0x0450) /* mn_MN (Mongolian/Mongolia) */
|
||||
cs = "UTF-8";
|
||||
cs = "UTF-8";
|
||||
else if (lcid == 0x0423) /* be_BY (Belarusian/Belarus) */
|
||||
cs = has_modifier ("@latin") ? "UTF-8" : "CP1251";
|
||||
else if (lcid == 0x0402) /* bg_BG (Bulgarian/Bulgaria) */
|
||||
cs = "CP1251";
|
||||
cs = "CP1251";
|
||||
else if (lcid == 0x0422) /* uk_UA (Ukrainian/Ukraine) */
|
||||
cs = "KOI8-U";
|
||||
else
|
||||
|
@ -1342,7 +1342,7 @@ __set_charset_from_locale (const char *locale, char *charset)
|
|||
|| lcid == 0x0488 /* wo_SN (Wolof/Senegal) */
|
||||
|| lcid == 0x046a /* yo_NG (Yoruba/Nigeria) */
|
||||
|| lcid == 0x085d) /* iu_CA (Inuktitut/Canada) */
|
||||
cs = "UTF-8";
|
||||
cs = "UTF-8";
|
||||
else if (lcid == 0x042e) /* hsb_DE (Upper Sorbian/Germany) */
|
||||
cs = "ISO-8859-2";
|
||||
else if (lcid == 0x0491 /* gd_GB (Scots Gaelic/Great Britain) */
|
||||
|
@ -1358,7 +1358,7 @@ __set_charset_from_locale (const char *locale, char *charset)
|
|||
break;
|
||||
case 1254:
|
||||
if (lcid == 0x042c) /* az_AZ (Azeri/Azerbaijan) */
|
||||
cs = "UTF-8";
|
||||
cs = "UTF-8";
|
||||
else if (lcid == 0x0443) /* uz_UZ (Uzbek/Uzbekistan) */
|
||||
cs = "ISO-8859-1";
|
||||
else
|
||||
|
@ -1406,7 +1406,7 @@ __set_charset_from_locale (const char *locale, char *charset)
|
|||
which is part of the gettext package, and if it finds the locale alias
|
||||
in that file, it replaces the locale with the correct locale string from
|
||||
that file.
|
||||
|
||||
|
||||
If successful, it returns a pointer to new_locale, NULL otherwise.*/
|
||||
extern "C" char *
|
||||
__set_locale_from_locale_alias (const char *locale, char *new_locale)
|
||||
|
|
|
@ -1024,7 +1024,7 @@ typedef enum _KEY_VALUE_INFORMATION_CLASS
|
|||
KeyValueFullInformation,
|
||||
KeyValuePartialInformation
|
||||
} KEY_VALUE_INFORMATION_CLASS, *PKEY_VALUE_INFORMATION_CLASS;
|
||||
|
||||
|
||||
typedef struct _KEY_VALUE_PARTIAL_INFORMATION
|
||||
{
|
||||
ULONG TitleIndex;
|
||||
|
@ -1204,7 +1204,7 @@ extern "C"
|
|||
BOOLEAN);
|
||||
NTSTATUS NTAPI RtlConvertSidToUnicodeString (PUNICODE_STRING, PSID, BOOLEAN);
|
||||
NTSTATUS NTAPI RtlConvertToAutoInheritSecurityObject (PSECURITY_DESCRIPTOR,
|
||||
PSECURITY_DESCRIPTOR,
|
||||
PSECURITY_DESCRIPTOR,
|
||||
PSECURITY_DESCRIPTOR *,
|
||||
GUID *, BOOLEAN,
|
||||
PGENERIC_MAPPING);
|
||||
|
@ -1237,9 +1237,9 @@ extern "C"
|
|||
NTSTATUS NTAPI RtlGetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR, PBOOLEAN,
|
||||
PACL *, PBOOLEAN);
|
||||
NTSTATUS NTAPI RtlGetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID *,
|
||||
PBOOLEAN);
|
||||
PBOOLEAN);
|
||||
NTSTATUS NTAPI RtlGetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID *,
|
||||
PBOOLEAN);
|
||||
PBOOLEAN);
|
||||
PSID_IDENTIFIER_AUTHORITY NTAPI RtlIdentifierAuthoritySid (PSID);
|
||||
VOID NTAPI RtlInitEmptyUnicodeString (PUNICODE_STRING, PCWSTR, USHORT);
|
||||
NTSTATUS NTAPI RtlInitializeSid (PSID, PSID_IDENTIFIER_AUTHORITY, UCHAR);
|
||||
|
@ -1268,9 +1268,9 @@ extern "C"
|
|||
NTSTATUS NTAPI RtlSetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR, BOOLEAN,
|
||||
PACL, BOOLEAN);
|
||||
NTSTATUS NTAPI RtlSetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID,
|
||||
BOOLEAN);
|
||||
BOOLEAN);
|
||||
NTSTATUS NTAPI RtlSetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID,
|
||||
BOOLEAN);
|
||||
BOOLEAN);
|
||||
PUCHAR NTAPI RtlSubAuthorityCountSid (PSID);
|
||||
PULONG NTAPI RtlSubAuthoritySid (PSID, ULONG);
|
||||
NTSTATUS NTAPI RtlUnicodeStringToAnsiString (PANSI_STRING, PUNICODE_STRING,
|
||||
|
|
|
@ -78,7 +78,7 @@ read_ea (HANDLE hdl, path_conv &pc, const char *name, char *value, size_t size)
|
|||
size_t nlen;
|
||||
|
||||
/* For compatibility with Linux, we only allow user xattrs and
|
||||
return EOPNOTSUPP otherwise. */
|
||||
return EOPNOTSUPP otherwise. */
|
||||
if (ascii_strncasematch (name, "user.", 5))
|
||||
name += 5;
|
||||
else
|
||||
|
|
|
@ -427,7 +427,7 @@ get_nt_native_path (const char *path, UNICODE_STRING& upath, bool dos)
|
|||
if (dos)
|
||||
{
|
||||
/* Unfortunately we can't just use transform_chars with the tfx_rev_chars
|
||||
table since only leading and trainlig spaces and dots are affected.
|
||||
table since only leading and trainlig spaces and dots are affected.
|
||||
So we step to every backslash and fix surrounding dots and spaces.
|
||||
That makes these broken filesystems a bit slower, but, hey. */
|
||||
PWCHAR cp = upath.Buffer + 7;
|
||||
|
@ -442,7 +442,7 @@ get_nt_native_path (const char *path, UNICODE_STRING& upath, bool dos)
|
|||
*++cp |= 0xf000;
|
||||
}
|
||||
while (*--cp == L'.' || *cp == L' ')
|
||||
*cp |= 0xf000;
|
||||
*cp |= 0xf000;
|
||||
}
|
||||
return &upath;
|
||||
}
|
||||
|
@ -917,7 +917,7 @@ is_virtual_symlink:
|
|||
information any longer. */
|
||||
fs.clear ();
|
||||
/* Close handle, if we have any. Otherwise we're collecting
|
||||
handles while following symlinks. */
|
||||
handles while following symlinks. */
|
||||
conv_handle.close ();
|
||||
break;
|
||||
}
|
||||
|
@ -1020,7 +1020,7 @@ out:
|
|||
else if (isproc_dev (dev) && fileattr == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
/* FIXME: Usually we don't set error to ENOENT if a file doesn't
|
||||
exist. This is typically indicated by the fileattr content.
|
||||
exist. This is typically indicated by the fileattr content.
|
||||
So, why here? The downside is that cygwin_conv_path just gets
|
||||
an error for these paths so it reports the error back to the
|
||||
application. Unlike in all other cases of non-existant files,
|
||||
|
@ -1855,7 +1855,7 @@ symlink_info::check_sysfile (HANDLE h)
|
|||
pflags |= PATH_SYMLINK;
|
||||
interix_symlink = true;
|
||||
/* Interix symlink cookies are shorter than Cygwin symlink cookies, so
|
||||
in case of an Interix symlink cooky we have read too far into the
|
||||
in case of an Interix symlink cooky we have read too far into the
|
||||
file. Set file pointer back to the position right after the cookie. */
|
||||
off.QuadPart = sizeof (INTERIX_SYMLINK_COOKIE) - 1;
|
||||
}
|
||||
|
@ -1920,7 +1920,7 @@ symlink_info::check_reparse_point (HANDLE h)
|
|||
rp->SymbolicLinkReparseBuffer.SubstituteNameLength);
|
||||
else if (rp->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)
|
||||
{
|
||||
RtlInitCountedUnicodeString (&subst,
|
||||
RtlInitCountedUnicodeString (&subst,
|
||||
(WCHAR *)((char *)rp->MountPointReparseBuffer.PathBuffer
|
||||
+ rp->MountPointReparseBuffer.SubstituteNameOffset),
|
||||
rp->MountPointReparseBuffer.SubstituteNameLength);
|
||||
|
@ -2358,7 +2358,7 @@ restart:
|
|||
if (!restarted && !*ext_here && !(pflags & PATH_DOS) && !fs.inited ())
|
||||
{
|
||||
/* Check for trailing dot or space or leading space in
|
||||
last component. */
|
||||
last component. */
|
||||
char *p = ext_here - 1;
|
||||
if (*p != '.' && *p != ' ')
|
||||
{
|
||||
|
@ -2376,7 +2376,7 @@ restart:
|
|||
if (fs.has_dos_filenames_only ())
|
||||
{
|
||||
/* If so, try again. Since we now know the FS, the
|
||||
filenames will be tweaked to follow DOS rules via the
|
||||
filenames will be tweaked to follow DOS rules via the
|
||||
third parameter in the call to get_nt_native_path. */
|
||||
pflags |= PATH_DOS;
|
||||
restarted = true;
|
||||
|
@ -2532,7 +2532,7 @@ restart:
|
|||
fileattr = fdi_buf.fdi.FileAttributes;
|
||||
memcpy (pfnoi, &fdi_buf.fdi.CreationTime, sizeof *pfnoi);
|
||||
/* Amazing, but true: The FILE_NETWORK_OPEN_INFORMATION
|
||||
structure has the AllocationSize and EndOfFile members
|
||||
structure has the AllocationSize and EndOfFile members
|
||||
interchanged relative to the directory information
|
||||
classes. */
|
||||
pfnoi->AllocationSize.QuadPart
|
||||
|
@ -2550,7 +2550,7 @@ restart:
|
|||
|
||||
ext_tacked_on = !!*ext_here;
|
||||
/* Don't allow to returns directories with appended suffix. If we found
|
||||
a directory with a suffix which has been appended here, then this
|
||||
a directory with a suffix which has been appended here, then this
|
||||
directory doesn't match the request. So, just do as usual if file
|
||||
hasn't been found. */
|
||||
if (ext_tacked_on && !had_ext && (fileattr & FILE_ATTRIBUTE_DIRECTORY))
|
||||
|
@ -2586,7 +2586,7 @@ restart:
|
|||
handle without FILE_OPEN_REPARSE_POINT. */
|
||||
fs.update (&upath, NULL);
|
||||
/* Make sure the open handle is not used in later stat calls.
|
||||
The handle has been opened with the FILE_OPEN_REPARSE_POINT
|
||||
The handle has been opened with the FILE_OPEN_REPARSE_POINT
|
||||
flag, so it's a handle to the reparse point, not a handle
|
||||
to the volumes root dir. */
|
||||
pflags &= ~PC_KEEP_HANDLE;
|
||||
|
@ -2636,7 +2636,7 @@ restart:
|
|||
/* If searching for `foo' and then finding a `foo.lnk' which is
|
||||
no shortcut, return the same as if file not found. */
|
||||
else if (suffix.lnk_match () && ext_tacked_on)
|
||||
{
|
||||
{
|
||||
fileattr = INVALID_FILE_ATTRIBUTES;
|
||||
set_error (ENOENT);
|
||||
continue;
|
||||
|
@ -2940,7 +2940,7 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
|||
}
|
||||
else if (*buf == '\\')
|
||||
{
|
||||
/* Device name points to somewhere else in the NT namespace.
|
||||
/* Device name points to somewhere else in the NT namespace.
|
||||
Use GLOBALROOT prefix to convert to Win32 path. */
|
||||
char *p = buf + sys_wcstombs (buf, NT_MAX_PATH,
|
||||
ro_u_globalroot.Buffer,
|
||||
|
@ -3004,7 +3004,7 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
|||
}
|
||||
else if (*path == L'\\')
|
||||
{
|
||||
/* Device name points to somewhere else in the NT namespace.
|
||||
/* Device name points to somewhere else in the NT namespace.
|
||||
Use GLOBALROOT prefix to convert to Win32 path. */
|
||||
to = (void *) wcpcpy ((wchar_t *) to, ro_u_globalroot.Buffer);
|
||||
lsiz += ro_u_globalroot.Length / sizeof (WCHAR);
|
||||
|
@ -3012,7 +3012,7 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
|||
/* TODO: Same ".\\" band-aid as in CCP_POSIX_TO_WIN_A case. */
|
||||
if (relative && !strcmp ((const char *) from, ".")
|
||||
&& !wcscmp (path, L".\\"))
|
||||
{
|
||||
{
|
||||
lsiz = 2;
|
||||
path[1] = L'\0';
|
||||
}
|
||||
|
@ -3455,7 +3455,7 @@ typedef struct _FAST_CWD_OLD {
|
|||
static PFAST_CWD *fast_cwd_ptr
|
||||
__attribute__((section (".cygwin_dll_common"), shared)) = (PFAST_CWD *) -1;
|
||||
/* Type of FAST_CWD used on this system. Keeping this information available
|
||||
in shared memory avoids to test for the version every time around.
|
||||
in shared memory avoids to test for the version every time around.
|
||||
Default to new version. */
|
||||
static int fast_cwd_version
|
||||
__attribute__((section (".cygwin_dll_common"), shared)) = 1;
|
||||
|
@ -3568,12 +3568,12 @@ find_fast_cwd ()
|
|||
if the directory doesn't exist. But *if* it happens, we have
|
||||
no valid FAST_CWD structure, even though upp_cwd_str.Buffer is
|
||||
not NULL in that case. So we let the OS create a valid
|
||||
FAST_CWD structure temporarily to have something to work with.
|
||||
FAST_CWD structure temporarily to have something to work with.
|
||||
We know the pipe FS works. */
|
||||
PEB &peb = *NtCurrentTeb ()->Peb;
|
||||
|
||||
if (f_cwd_ptr /* so *f_cwd_ptr == NULL */
|
||||
&& !NT_SUCCESS (RtlSetCurrentDirectory_U (&ro_u_pipedir)))
|
||||
&& !NT_SUCCESS (RtlSetCurrentDirectory_U (&ro_u_pipedir)))
|
||||
api_fatal ("Couldn't set directory to %S temporarily.\n"
|
||||
"Cannot continue.", &ro_u_pipedir);
|
||||
RtlEnterCriticalSection (peb.FastPebLock);
|
||||
|
@ -3635,7 +3635,7 @@ cwdstuff::override_win32_cwd (bool init, ULONG old_dismount_count)
|
|||
the directory handle.
|
||||
We don't call NtQueryVolumeInformationFile for the \\?\PIPE,
|
||||
though. It just returns STATUS_INVALID_HANDLE anyway. */
|
||||
f_cwd->FSCharacteristics =
|
||||
f_cwd->FSCharacteristics =
|
||||
(!error
|
||||
&& NT_SUCCESS (NtQueryVolumeInformationFile (dir, &io, &ffdi,
|
||||
sizeof ffdi, FileFsDeviceInformation)))
|
||||
|
@ -3714,11 +3714,11 @@ cwdstuff::override_win32_cwd (bool init, ULONG old_dismount_count)
|
|||
handle, the directory is locked against deletion or renaming
|
||||
between the RtlSetCurrentDirectory_U and the subsequent NtClose
|
||||
call.
|
||||
|
||||
|
||||
- When another thread calls SetCurrentDirectory at exactly the
|
||||
same time, a crash might occur, or worse, unrelated data could
|
||||
be overwritten or NtClose could be called on an unrelated handle.
|
||||
|
||||
|
||||
Therefore, use this *only* as a fallback. */
|
||||
if (!init)
|
||||
{
|
||||
|
@ -3760,10 +3760,10 @@ cwdstuff::override_win32_cwd (bool init, ULONG old_dismount_count)
|
|||
else
|
||||
{
|
||||
/* This method is used for all pre-Vista OSes. We simply set the values
|
||||
for the CWD in the user process parameter block entirely by ourselves
|
||||
for the CWD in the user process parameter block entirely by ourselves
|
||||
under PEB lock condition. This is how RtlSetCurrentDirectory_U worked
|
||||
in these older OSes, so we're safe.
|
||||
|
||||
|
||||
Note that we can't just RtlEnterCriticalSection (peb.FastPebLock)
|
||||
on pre-Vista. RtlAcquirePebLock was way more complicated back then. */
|
||||
RtlAcquirePebLock ();
|
||||
|
@ -3809,7 +3809,7 @@ cwdstuff::set (path_conv *nat_cwd, const char *posix_cwd)
|
|||
|
||||
/* Here are the problems with using SetCurrentDirectory. Just skip this
|
||||
comment if you don't like whining.
|
||||
|
||||
|
||||
- SetCurrentDirectory only supports paths of up to MAX_PATH - 1 chars,
|
||||
including a trailing backslash. That's an absolute restriction, even
|
||||
in the UNICODE API.
|
||||
|
@ -3884,7 +3884,7 @@ cwdstuff::set (path_conv *nat_cwd, const char *posix_cwd)
|
|||
nat_cwd->objcaseinsensitive () | OBJ_INHERIT,
|
||||
NULL, NULL);
|
||||
/* First try without FILE_OPEN_FOR_BACKUP_INTENT, to find out if the
|
||||
directory is valid for Win32 apps. And, no, we can't just call
|
||||
directory is valid for Win32 apps. And, no, we can't just call
|
||||
SetCurrentDirectory here, since that would potentially break
|
||||
case-sensitivity. */
|
||||
status = NtOpenFile (&h, SYNCHRONIZE | FILE_TRAVERSE, &attr, &io,
|
||||
|
@ -3892,7 +3892,7 @@ cwdstuff::set (path_conv *nat_cwd, const char *posix_cwd)
|
|||
FILE_DIRECTORY_FILE
|
||||
| FILE_SYNCHRONOUS_IO_NONALERT);
|
||||
if (status == STATUS_ACCESS_DENIED)
|
||||
{
|
||||
{
|
||||
status = NtOpenFile (&h, SYNCHRONIZE | FILE_TRAVERSE, &attr, &io,
|
||||
FILE_SHARE_VALID_FLAGS,
|
||||
FILE_DIRECTORY_FILE
|
||||
|
@ -3955,7 +3955,7 @@ cwdstuff::set (path_conv *nat_cwd, const char *posix_cwd)
|
|||
else
|
||||
{
|
||||
/* Path via native NT namespace. Prepend GLOBALROOT prefix
|
||||
to create a valid Win32 path. */
|
||||
to create a valid Win32 path. */
|
||||
PWCHAR buf = (PWCHAR) alloca (upath.Length
|
||||
+ ro_u_globalroot.Length
|
||||
+ sizeof (WCHAR));
|
||||
|
|
|
@ -224,7 +224,7 @@ restart1:
|
|||
break;
|
||||
case WAIT_OBJECT_0 + 2:
|
||||
if (timer_idx != 2)
|
||||
pthread::static_cancel_self ();
|
||||
pthread::static_cancel_self ();
|
||||
/*FALLTHRU*/
|
||||
case WAIT_OBJECT_0 + 3:
|
||||
ret = ETIMEDOUT;
|
||||
|
@ -587,7 +587,7 @@ err:
|
|||
if (mqinfo)
|
||||
{
|
||||
if (mqinfo->mqi_lock)
|
||||
ipc_mutex_close (mqinfo->mqi_lock);
|
||||
ipc_mutex_close (mqinfo->mqi_lock);
|
||||
if (mqinfo->mqi_waitsend)
|
||||
ipc_cond_close (mqinfo->mqi_waitsend);
|
||||
if (mqinfo->mqi_waitrecv)
|
||||
|
|
|
@ -227,7 +227,7 @@ do_pseudo_reloc (void * start, void * end, void * base)
|
|||
runtime_pseudo_reloc_item_v1 * o;
|
||||
for (o = (runtime_pseudo_reloc_item_v1 *) v2_hdr;
|
||||
o < (runtime_pseudo_reloc_item_v1 *)end;
|
||||
o++)
|
||||
o++)
|
||||
{
|
||||
DWORD newval;
|
||||
reloc_target = (ptrdiff_t) base + o->target;
|
||||
|
@ -272,7 +272,7 @@ do_pseudo_reloc (void * start, void * end, void * base)
|
|||
* supported.
|
||||
*/
|
||||
switch ((r->flags & 0xff))
|
||||
{
|
||||
{
|
||||
case 8:
|
||||
reldata = (ptrdiff_t) (*((unsigned char *)reloc_target));
|
||||
if ((reldata & 0x80) != 0)
|
||||
|
@ -300,7 +300,7 @@ do_pseudo_reloc (void * start, void * end, void * base)
|
|||
__report_error (" Unknown pseudo relocation bit size %d.\n",
|
||||
(int) (r->flags & 0xff));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Adjust the relocation value */
|
||||
reldata -= ((ptrdiff_t) base + r->sym);
|
||||
|
|
|
@ -189,7 +189,6 @@ reg_key::get_string (PCWSTR name, PWCHAR dst, size_t max, PCWSTR def)
|
|||
wcpncpy (dst, def, max);
|
||||
else
|
||||
wcpncpy (dst, (PWCHAR) vbuf->Data, max);
|
||||
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ open_local_policy (ACCESS_MASK access)
|
|||
{
|
||||
__seterrno_from_nt_status (status);
|
||||
/* Some versions of Windows set the lsa handle to NULL when
|
||||
LsaOpenPolicy fails. */
|
||||
LsaOpenPolicy fails. */
|
||||
lsa = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
return lsa;
|
||||
|
@ -340,7 +340,7 @@ get_user_local_groups (PWCHAR logonserver, PWCHAR domain,
|
|||
if (!bg_ptr)
|
||||
{
|
||||
/* Retrieve name of builtin group from system since it's
|
||||
localized. */
|
||||
localized. */
|
||||
glen = 2 * GNLEN + 2;
|
||||
if (!LookupAccountSidW (NULL, well_known_builtin_sid,
|
||||
builtin_grp, &glen, domain, &domlen, &use))
|
||||
|
@ -552,7 +552,7 @@ get_system_priv_list (size_t &size)
|
|||
{
|
||||
ULONG max_idx = 0;
|
||||
while (max_idx < SYSTEM_PRIVILEGES_COUNT
|
||||
&& sys_privs[max_idx] != wincap.max_sys_priv ())
|
||||
&& sys_privs[max_idx] != wincap.max_sys_priv ())
|
||||
++max_idx;
|
||||
if (max_idx >= SYSTEM_PRIVILEGES_COUNT)
|
||||
api_fatal ("Coding error: wincap privilege %u doesn't exist in sys_privs",
|
||||
|
|
|
@ -72,7 +72,7 @@ get_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd,
|
|||
pc.get_object_attr (attr, sec_none_nih), &io,
|
||||
FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
{
|
||||
sd.free ();
|
||||
__seterrno_from_nt_status (status);
|
||||
return -1;
|
||||
|
@ -167,7 +167,7 @@ get_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd,
|
|||
return 0;
|
||||
}
|
||||
/* ... and create a new security descriptor in which all inherited ACEs
|
||||
are marked with the INHERITED_ACE flag. For a description of the
|
||||
are marked with the INHERITED_ACE flag. For a description of the
|
||||
undocumented RtlConvertToAutoInheritSecurityObject function from
|
||||
ntdll.dll see the MSDN man page for the advapi32 function
|
||||
ConvertToAutoInheritPrivateObjectSecurity. Fortunately the latter
|
||||
|
@ -182,7 +182,7 @@ get_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd,
|
|||
return 0;
|
||||
}
|
||||
/* Eventually copy the new security descriptor into sd and delete the
|
||||
original one created by RtlConvertToAutoInheritSecurityObject from
|
||||
original one created by RtlConvertToAutoInheritSecurityObject from
|
||||
the heap. */
|
||||
len = RtlLengthSecurityDescriptor (nsd);
|
||||
memcpy ((PSECURITY_DESCRIPTOR) sd, nsd, len);
|
||||
|
@ -989,14 +989,14 @@ check_access (security_descriptor &sd, GENERIC_MAPPING &mapping,
|
|||
if (!tok)
|
||||
{
|
||||
if (!DuplicateTokenEx (hProcToken, MAXIMUM_ALLOWED, NULL,
|
||||
SecurityImpersonation, TokenImpersonation,
|
||||
SecurityImpersonation, TokenImpersonation,
|
||||
&hProcImpToken))
|
||||
{
|
||||
__seterrno ();
|
||||
return ret;
|
||||
}
|
||||
{
|
||||
__seterrno ();
|
||||
return ret;
|
||||
}
|
||||
tok = hProcImpToken;
|
||||
}
|
||||
}
|
||||
|
||||
status = NtAccessCheck (sd, tok, desired, &mapping, pset, &plen, &granted,
|
||||
&allow);
|
||||
|
|
|
@ -101,34 +101,34 @@ nanosleep (const struct timespec *rqtp, struct timespec *rmtp)
|
|||
while (!done)
|
||||
{
|
||||
/* Divide user's input into transactions no larger than 49.7
|
||||
days at a time. */
|
||||
days at a time. */
|
||||
if (sec > HIRES_DELAY_MAX / 1000)
|
||||
{
|
||||
req = ((HIRES_DELAY_MAX + resolution - 1)
|
||||
/ resolution * resolution);
|
||||
sec -= HIRES_DELAY_MAX / 1000;
|
||||
}
|
||||
{
|
||||
req = ((HIRES_DELAY_MAX + resolution - 1)
|
||||
/ resolution * resolution);
|
||||
sec -= HIRES_DELAY_MAX / 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
req = ((sec * 1000 + (rqtp->tv_nsec + 999999) / 1000000
|
||||
+ resolution - 1) / resolution) * resolution;
|
||||
sec = 0;
|
||||
done = true;
|
||||
}
|
||||
{
|
||||
req = ((sec * 1000 + (rqtp->tv_nsec + 999999) / 1000000
|
||||
+ resolution - 1) / resolution) * resolution;
|
||||
sec = 0;
|
||||
done = true;
|
||||
}
|
||||
|
||||
DWORD end_time = gtod.dmsecs () + req;
|
||||
syscall_printf ("nanosleep (%ld)", req);
|
||||
|
||||
int rc = cancelable_wait (signal_arrived, req);
|
||||
if ((rem = end_time - gtod.dmsecs ()) > HIRES_DELAY_MAX)
|
||||
rem = 0;
|
||||
rem = 0;
|
||||
if (rc == WAIT_OBJECT_0)
|
||||
{
|
||||
_my_tls.call_signal_handler ();
|
||||
set_errno (EINTR);
|
||||
res = -1;
|
||||
break;
|
||||
}
|
||||
{
|
||||
_my_tls.call_signal_handler ();
|
||||
set_errno (EINTR);
|
||||
res = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (rmtp)
|
||||
|
@ -136,14 +136,14 @@ nanosleep (const struct timespec *rqtp, struct timespec *rmtp)
|
|||
rmtp->tv_sec = sec + rem / 1000;
|
||||
rmtp->tv_nsec = (rem % 1000) * 1000000;
|
||||
if (sec)
|
||||
{
|
||||
rmtp->tv_nsec += rqtp->tv_nsec;
|
||||
if (rmtp->tv_nsec >= 1000000000)
|
||||
{
|
||||
rmtp->tv_nsec -= 1000000000;
|
||||
rmtp->tv_sec++;
|
||||
}
|
||||
}
|
||||
{
|
||||
rmtp->tv_nsec += rqtp->tv_nsec;
|
||||
if (rmtp->tv_nsec >= 1000000000)
|
||||
{
|
||||
rmtp->tv_nsec -= 1000000000;
|
||||
rmtp->tv_sec++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
syscall_printf ("%d = nanosleep (%ld, %ld)", res, req, rem);
|
||||
|
|
|
@ -914,7 +914,7 @@ child_info::proc_retry (HANDLE h)
|
|||
break;
|
||||
case EXITCODE_FORK_FAILED: /* windows prevented us from forking */
|
||||
break;
|
||||
|
||||
|
||||
/* Count down non-recognized exit codes more quickly since they aren't
|
||||
due to known conditions. */
|
||||
default:
|
||||
|
|
|
@ -190,7 +190,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
|
|||
if (l_opt && ((*(unsigned char *)s <= 0x1f && *s != '\n')
|
||||
|| *(unsigned char *)s >= 0x7f))
|
||||
{
|
||||
*dst++ = '\\';
|
||||
*dst++ = '\\';
|
||||
*dst++ = 'x';
|
||||
*dst++ = hex_str[*(unsigned char *)s >> 4];
|
||||
*dst++ = hex_str[*(unsigned char *)s++ & 0xf];
|
||||
|
|
|
@ -521,7 +521,7 @@ spawn_guts (const char *prog_arg, const char *const *argv,
|
|||
real_path.get_nt_native_path ());
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
set_errno (ENAMETOOLONG);
|
||||
res = -1;
|
||||
goto out;
|
||||
|
|
|
@ -25,7 +25,7 @@ details. */
|
|||
is affected as well, but we can't transform it as long as we accept Win32
|
||||
paths as input. */
|
||||
static const WCHAR tfx_chars[] = {
|
||||
0, 0xf000 | 1, 0xf000 | 2, 0xf000 | 3,
|
||||
0, 0xf000 | 1, 0xf000 | 2, 0xf000 | 3,
|
||||
0xf000 | 4, 0xf000 | 5, 0xf000 | 6, 0xf000 | 7,
|
||||
0xf000 | 8, 0xf000 | 9, 0xf000 | 10, 0xf000 | 11,
|
||||
0xf000 | 12, 0xf000 | 13, 0xf000 | 14, 0xf000 | 15,
|
||||
|
@ -33,29 +33,29 @@ static const WCHAR tfx_chars[] = {
|
|||
0xf000 | 20, 0xf000 | 21, 0xf000 | 22, 0xf000 | 23,
|
||||
0xf000 | 24, 0xf000 | 25, 0xf000 | 26, 0xf000 | 27,
|
||||
0xf000 | 28, 0xf000 | 29, 0xf000 | 30, 0xf000 | 31,
|
||||
' ', '!', 0xf000 | '"', '#',
|
||||
'$', '%', '&', 39,
|
||||
'(', ')', 0xf000 | '*', '+',
|
||||
',', '-', '.', '\\',
|
||||
'0', '1', '2', '3',
|
||||
'4', '5', '6', '7',
|
||||
'8', '9', 0xf000 | ':', ';',
|
||||
' ', '!', 0xf000 | '"', '#',
|
||||
'$', '%', '&', 39,
|
||||
'(', ')', 0xf000 | '*', '+',
|
||||
',', '-', '.', '\\',
|
||||
'0', '1', '2', '3',
|
||||
'4', '5', '6', '7',
|
||||
'8', '9', 0xf000 | ':', ';',
|
||||
0xf000 | '<', '=', 0xf000 | '>', 0xf000 | '?',
|
||||
'@', 'A', 'B', 'C',
|
||||
'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K',
|
||||
'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S',
|
||||
'T', 'U', 'V', 'W',
|
||||
'X', 'Y', 'Z', '[',
|
||||
'\\', ']', '^', '_',
|
||||
'`', 'a', 'b', 'c',
|
||||
'd', 'e', 'f', 'g',
|
||||
'h', 'i', 'j', 'k',
|
||||
'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's',
|
||||
't', 'u', 'v', 'w',
|
||||
'x', 'y', 'z', '{',
|
||||
'@', 'A', 'B', 'C',
|
||||
'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K',
|
||||
'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S',
|
||||
'T', 'U', 'V', 'W',
|
||||
'X', 'Y', 'Z', '[',
|
||||
'\\', ']', '^', '_',
|
||||
'`', 'a', 'b', 'c',
|
||||
'd', 'e', 'f', 'g',
|
||||
'h', 'i', 'j', 'k',
|
||||
'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's',
|
||||
't', 'u', 'v', 'w',
|
||||
'x', 'y', 'z', '{',
|
||||
0xf000 | '|', '}', '~', 127
|
||||
};
|
||||
|
||||
|
@ -64,7 +64,7 @@ static const WCHAR tfx_chars[] = {
|
|||
converting back space and dot on filesystems only supporting DOS
|
||||
filenames. */
|
||||
static const WCHAR tfx_rev_chars[] = {
|
||||
0, 0xf000 | 1, 0xf000 | 2, 0xf000 | 3,
|
||||
0, 0xf000 | 1, 0xf000 | 2, 0xf000 | 3,
|
||||
0xf000 | 4, 0xf000 | 5, 0xf000 | 6, 0xf000 | 7,
|
||||
0xf000 | 8, 0xf000 | 9, 0xf000 | 10, 0xf000 | 11,
|
||||
0xf000 | 12, 0xf000 | 13, 0xf000 | 14, 0xf000 | 15,
|
||||
|
@ -73,28 +73,28 @@ static const WCHAR tfx_rev_chars[] = {
|
|||
0xf000 | 24, 0xf000 | 25, 0xf000 | 26, 0xf000 | 27,
|
||||
0xf000 | 28, 0xf000 | 29, 0xf000 | 30, 0xf000 | 31,
|
||||
0xf000 | ' ', '!', 0xf000 | '"', '#',
|
||||
'$', '%', '&', 39,
|
||||
'(', ')', 0xf000 | '*', '+',
|
||||
',', '-', 0xf000 | '.', '\\',
|
||||
'0', '1', '2', '3',
|
||||
'4', '5', '6', '7',
|
||||
'8', '9', 0xf000 | ':', ';',
|
||||
'$', '%', '&', 39,
|
||||
'(', ')', 0xf000 | '*', '+',
|
||||
',', '-', 0xf000 | '.', '\\',
|
||||
'0', '1', '2', '3',
|
||||
'4', '5', '6', '7',
|
||||
'8', '9', 0xf000 | ':', ';',
|
||||
0xf000 | '<', '=', 0xf000 | '>', 0xf000 | '?',
|
||||
'@', 'A', 'B', 'C',
|
||||
'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K',
|
||||
'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S',
|
||||
'T', 'U', 'V', 'W',
|
||||
'X', 'Y', 'Z', '[',
|
||||
'\\', ']', '^', '_',
|
||||
'`', 'a', 'b', 'c',
|
||||
'd', 'e', 'f', 'g',
|
||||
'h', 'i', 'j', 'k',
|
||||
'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's',
|
||||
't', 'u', 'v', 'w',
|
||||
'x', 'y', 'z', '{',
|
||||
'@', 'A', 'B', 'C',
|
||||
'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K',
|
||||
'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S',
|
||||
'T', 'U', 'V', 'W',
|
||||
'X', 'Y', 'Z', '[',
|
||||
'\\', ']', '^', '_',
|
||||
'`', 'a', 'b', 'c',
|
||||
'd', 'e', 'f', 'g',
|
||||
'h', 'i', 'j', 'k',
|
||||
'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's',
|
||||
't', 'u', 'v', 'w',
|
||||
'x', 'y', 'z', '{',
|
||||
0xf000 | '|', '}', '~', 127
|
||||
};
|
||||
|
||||
|
@ -416,7 +416,7 @@ sys_cp_wcstombs (wctomb_p f_wctomb, const char *charset, char *dst, size_t len,
|
|||
unsigned char cwc;
|
||||
|
||||
/* Convert UNICODE private use area. Reverse functionality for the
|
||||
ASCII area <= 0x7f (only for path names) is transform_chars above.
|
||||
ASCII area <= 0x7f (only for path names) is transform_chars above.
|
||||
Reverse functionality for invalid bytes in a multibyte sequence is
|
||||
in sys_cp_mbstowcs below. */
|
||||
if ((pw & 0xff00) == 0xf000
|
||||
|
|
|
@ -557,7 +557,7 @@ unlink_nt (path_conv &pc)
|
|||
FILE_STANDARD_INFORMATION fsi;
|
||||
|
||||
/* If possible, hide the non-atomicity of the "remove R/O flag, remove
|
||||
link to file" operation behind a transaction. */
|
||||
link to file" operation behind a transaction. */
|
||||
if (wincap.has_transactions ()
|
||||
&& (pc.fs_flags () & FILE_SUPPORTS_TRANSACTIONS))
|
||||
start_transaction (old_trans, trans);
|
||||
|
@ -569,7 +569,7 @@ unlink_nt (path_conv &pc)
|
|||
NtSetAttributesFile (fh_ro, pc.file_attributes ()
|
||||
& ~FILE_ATTRIBUTE_READONLY);
|
||||
pc.init_reopen_attr (&attr, fh_ro);
|
||||
}
|
||||
}
|
||||
if (pc.is_lnk_symlink ())
|
||||
{
|
||||
status = NtQueryInformationFile (fh_ro, &io, &fsi, sizeof fsi,
|
||||
|
@ -598,7 +598,7 @@ unlink_nt (path_conv &pc)
|
|||
times out. Opening the file with FILE_SHARE_VALID_FLAGS will work,
|
||||
though, and it is then possible to delete the file quite normally.
|
||||
|
||||
NFS implements its own mechanism to remove in-use files which
|
||||
NFS implements its own mechanism to remove in-use files which
|
||||
looks quite similar to what we do in try_to_bin for remote files.
|
||||
That's why we don't call try_to_bin on NFS.
|
||||
|
||||
|
@ -711,7 +711,7 @@ unlink_nt (path_conv &pc)
|
|||
if (fh)
|
||||
{
|
||||
if (access & FILE_WRITE_ATTRIBUTES)
|
||||
{
|
||||
{
|
||||
/* Restore R/O attribute if setting the delete dispostion failed. */
|
||||
if (!NT_SUCCESS (status))
|
||||
NtSetAttributesFile (fh, pc.file_attributes ());
|
||||
|
@ -1547,11 +1547,11 @@ sync ()
|
|||
}
|
||||
/* Traverse \Device directory ... */
|
||||
PDIRECTORY_BASIC_INFORMATION dbi = (PDIRECTORY_BASIC_INFORMATION)
|
||||
alloca (640);
|
||||
alloca (640);
|
||||
BOOLEAN restart = TRUE;
|
||||
ULONG context = 0;
|
||||
while (NT_SUCCESS (NtQueryDirectoryObject (devhdl, dbi, 640, TRUE, restart,
|
||||
&context, NULL)))
|
||||
&context, NULL)))
|
||||
{
|
||||
restart = FALSE;
|
||||
/* ... and call sync_worker for each HarddiskVolumeX entry. */
|
||||
|
@ -1817,16 +1817,16 @@ rename (const char *oldpath, const char *newpath)
|
|||
char *p = stpcpy (buf = tp.c_get (), oldpath) - 1;
|
||||
oldpath = buf;
|
||||
while (p >= oldpath && isdirsep (*p))
|
||||
*p-- = '\0';
|
||||
*p-- = '\0';
|
||||
olen = p + 1 - oldpath;
|
||||
if (!olen)
|
||||
{
|
||||
/* The root directory cannot be renamed. This also rejects
|
||||
the corner case of rename("/","/"), even though it is the
|
||||
same file. */
|
||||
set_errno (EINVAL);
|
||||
goto out;
|
||||
}
|
||||
{
|
||||
/* The root directory cannot be renamed. This also rejects
|
||||
the corner case of rename("/","/"), even though it is the
|
||||
same file. */
|
||||
set_errno (EINVAL);
|
||||
goto out;
|
||||
}
|
||||
old_dir_requested = true;
|
||||
}
|
||||
oldpc.check (oldpath, PC_SYM_NOFOLLOW, stat_suffixes);
|
||||
|
@ -1874,13 +1874,13 @@ rename (const char *oldpath, const char *newpath)
|
|||
char *p = stpcpy (buf = tp.c_get (), newpath) - 1;
|
||||
newpath = buf;
|
||||
while (p >= newpath && isdirsep (*p))
|
||||
*p-- = '\0';
|
||||
*p-- = '\0';
|
||||
nlen = p + 1 - newpath;
|
||||
if (!nlen) /* The root directory is never empty. */
|
||||
{
|
||||
set_errno (ENOTEMPTY);
|
||||
goto out;
|
||||
}
|
||||
{
|
||||
set_errno (ENOTEMPTY);
|
||||
goto out;
|
||||
}
|
||||
new_dir_requested = true;
|
||||
}
|
||||
newpc.check (newpath, PC_SYM_NOFOLLOW, stat_suffixes);
|
||||
|
@ -1895,7 +1895,7 @@ rename (const char *oldpath, const char *newpath)
|
|||
goto out;
|
||||
}
|
||||
if (new_dir_requested && !(newpc.exists ()
|
||||
? newpc.isdir () : oldpc.isdir ()))
|
||||
? newpc.isdir () : oldpc.isdir ()))
|
||||
{
|
||||
/* Reject rename("file1","file2/"), but allow rename("dir","d/"). */
|
||||
set_errno (newpc.exists () ? ENOTDIR : ENOENT);
|
||||
|
@ -2844,11 +2844,11 @@ seteuid32 (__uid32_t uid)
|
|||
like this:
|
||||
|
||||
cygwin_internal(CW_SET_EXTERNAL_TOKEN, restricted_token,
|
||||
CW_TOKEN_RESTRICTED);
|
||||
CW_TOKEN_RESTRICTED);
|
||||
setuid (getuid ());
|
||||
[...do stuff with restricted rights...]
|
||||
cygwin_internal(CW_SET_EXTERNAL_TOKEN, INVALID_HANDLE_VALUE,
|
||||
CW_TOKEN_RESTRICTED);
|
||||
CW_TOKEN_RESTRICTED);
|
||||
setuid (getuid ());
|
||||
|
||||
Note that using the current uid is a requirement! Starting with Windows
|
||||
|
|
|
@ -376,9 +376,9 @@ sysinfo (struct sysinfo *info)
|
|||
debug_printf ("NtQuerySystemInformation(SystemPagefileInformation), "
|
||||
"status %p", ret);
|
||||
totalswap = (memory_status.ullTotalPageFile - memory_status.ullTotalPhys)
|
||||
/ getsystempagesize ();
|
||||
/ getsystempagesize ();
|
||||
freeswap = (memory_status.ullAvailPageFile - memory_status.ullTotalPhys)
|
||||
/ getsystempagesize ();
|
||||
/ getsystempagesize ();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1403,7 +1403,7 @@ pthread_rwlock::rdlock ()
|
|||
if (reader->n < ULONG_MAX)
|
||||
++reader->n;
|
||||
else
|
||||
errno = EAGAIN;
|
||||
errno = EAGAIN;
|
||||
goto DONE;
|
||||
}
|
||||
|
||||
|
@ -1546,7 +1546,7 @@ pthread_rwlock::unlock ()
|
|||
goto DONE;
|
||||
}
|
||||
if (--reader->n > 0)
|
||||
goto DONE;
|
||||
goto DONE;
|
||||
|
||||
remove_reader (reader);
|
||||
delete reader;
|
||||
|
@ -2247,9 +2247,9 @@ pthread_attr_setstack (pthread_attr_t *attr, void *addr, size_t size)
|
|||
if (!pthread_attr::is_good_object (attr))
|
||||
return EINVAL;
|
||||
if (addr == NULL)
|
||||
return EINVAL;
|
||||
return EINVAL;
|
||||
if (size < PTHREAD_STACK_MIN)
|
||||
return EINVAL;
|
||||
return EINVAL;
|
||||
(*attr)->stackaddr = addr;
|
||||
(*attr)->stacksize = size;
|
||||
return 0;
|
||||
|
@ -2272,7 +2272,7 @@ pthread_attr_setstackaddr (pthread_attr_t *attr, void *addr)
|
|||
if (!pthread_attr::is_good_object (attr))
|
||||
return EINVAL;
|
||||
if (addr == NULL)
|
||||
return EINVAL;
|
||||
return EINVAL;
|
||||
(*attr)->stackaddr = addr;
|
||||
return 0;
|
||||
}
|
||||
|
@ -2294,7 +2294,7 @@ pthread_attr_setstacksize (pthread_attr_t *attr, size_t size)
|
|||
if (!pthread_attr::is_good_object (attr))
|
||||
return EINVAL;
|
||||
if (size < PTHREAD_STACK_MIN)
|
||||
return EINVAL;
|
||||
return EINVAL;
|
||||
(*attr)->stacksize = size;
|
||||
return 0;
|
||||
}
|
||||
|
@ -2481,7 +2481,7 @@ pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
|
|||
|
||||
tbi = (PTHREAD_BASIC_INFORMATION) malloc (sizeof_tbi);
|
||||
ret = NtQueryInformationThread (thread->win32_obj_id, ThreadBasicInformation,
|
||||
tbi, sizeof_tbi, NULL);
|
||||
tbi, sizeof_tbi, NULL);
|
||||
|
||||
if (NT_SUCCESS (ret))
|
||||
{
|
||||
|
@ -2493,7 +2493,7 @@ pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
|
|||
else
|
||||
{
|
||||
debug_printf ("NtQueryInformationThread(ThreadBasicInformation), "
|
||||
"status %p", ret);
|
||||
"status %p", ret);
|
||||
(*attr)->stackaddr = thread->attr.stackaddr;
|
||||
(*attr)->stacksize = thread->attr.stacksize;
|
||||
}
|
||||
|
@ -3579,7 +3579,7 @@ semaphore::open (unsigned long long hash, LUID luid, int fd, int oflag,
|
|||
semaphores.mx.lock ();
|
||||
for (semaphore *sema = semaphores.head; sema; sema = sema->next)
|
||||
if (sema->fd >= 0 && sema->hash == hash
|
||||
&& sema->luid.HighPart == luid.HighPart
|
||||
&& sema->luid.HighPart == luid.HighPart
|
||||
&& sema->luid.LowPart == sema->luid.LowPart)
|
||||
{
|
||||
wasopen = true;
|
||||
|
|
|
@ -605,14 +605,14 @@ clock_gettime (clockid_t clk_id, struct timespec *tp)
|
|||
long long x;
|
||||
|
||||
if (pid == 0)
|
||||
pid = getpid ();
|
||||
pid = getpid ();
|
||||
|
||||
pinfo p (pid);
|
||||
if (!p->exists ())
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
hProcess = OpenProcess (PROCESS_QUERY_INFORMATION, 0, p->dwProcessId);
|
||||
NtQueryInformationProcess (hProcess, ProcessTimes, &kut, sizeof_kut, &sizeof_kut);
|
||||
|
@ -634,14 +634,14 @@ clock_gettime (clockid_t clk_id, struct timespec *tp)
|
|||
long long x;
|
||||
|
||||
if (thr_id == 0)
|
||||
thr_id = pthread::self ()->getsequence_np ();
|
||||
thr_id = pthread::self ()->getsequence_np ();
|
||||
|
||||
hThread = OpenThread (THREAD_QUERY_INFORMATION, 0, thr_id);
|
||||
if (!hThread)
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
NtQueryInformationThread (hThread, ThreadTimes, &kut, sizeof_kut, &sizeof_kut);
|
||||
|
||||
|
@ -656,29 +656,29 @@ clock_gettime (clockid_t clk_id, struct timespec *tp)
|
|||
switch (clk_id)
|
||||
{
|
||||
case CLOCK_REALTIME:
|
||||
{
|
||||
LONGLONG now = gtod.nsecs ();
|
||||
if (now == (LONGLONG) -1)
|
||||
return -1;
|
||||
tp->tv_sec = now / NSPERSEC;
|
||||
tp->tv_nsec = (now % NSPERSEC) * (1000000000 / NSPERSEC);
|
||||
break;
|
||||
}
|
||||
{
|
||||
LONGLONG now = gtod.nsecs ();
|
||||
if (now == (LONGLONG) -1)
|
||||
return -1;
|
||||
tp->tv_sec = now / NSPERSEC;
|
||||
tp->tv_nsec = (now % NSPERSEC) * (1000000000 / NSPERSEC);
|
||||
break;
|
||||
}
|
||||
|
||||
case CLOCK_MONOTONIC:
|
||||
{
|
||||
LONGLONG now = ntod.nsecs ();
|
||||
if (now == (LONGLONG) -1)
|
||||
return -1;
|
||||
{
|
||||
LONGLONG now = ntod.nsecs ();
|
||||
if (now == (LONGLONG) -1)
|
||||
return -1;
|
||||
|
||||
tp->tv_sec = now / 1000000000;
|
||||
tp->tv_nsec = (now % 1000000000);
|
||||
break;
|
||||
}
|
||||
tp->tv_sec = now / 1000000000;
|
||||
tp->tv_nsec = (now % 1000000000);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -784,24 +784,24 @@ clock_getres (clockid_t clk_id, struct timespec *tp)
|
|||
switch (clk_id)
|
||||
{
|
||||
case CLOCK_REALTIME:
|
||||
{
|
||||
DWORD period = gtod.resolution ();
|
||||
tp->tv_sec = period / 1000;
|
||||
tp->tv_nsec = (period % 1000) * 1000000;
|
||||
break;
|
||||
}
|
||||
{
|
||||
DWORD period = gtod.resolution ();
|
||||
tp->tv_sec = period / 1000;
|
||||
tp->tv_nsec = (period % 1000) * 1000000;
|
||||
break;
|
||||
}
|
||||
|
||||
case CLOCK_MONOTONIC:
|
||||
{
|
||||
LONGLONG period = ntod.resolution ();
|
||||
tp->tv_sec = period / 1000000000;
|
||||
tp->tv_nsec = period % 1000000000;
|
||||
break;
|
||||
}
|
||||
{
|
||||
LONGLONG period = ntod.resolution ();
|
||||
tp->tv_sec = period / 1000000000;
|
||||
tp->tv_nsec = period % 1000000000;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
int ioctl_retval;
|
||||
int write_error;
|
||||
|
||||
void setntty (_major_t t, int n) {ntty = (fh_devices) FHDEV (t, n);}
|
||||
void setntty (_major_t t, int n) {ntty = (fh_devices) FHDEV (t, n);}
|
||||
int getntty () const {return ntty;}
|
||||
int get_unit () const {return device::minor (ntty);}
|
||||
pid_t getpgid () const {return pgid;}
|
||||
|
|
|
@ -86,7 +86,7 @@ cygheap_user::init ()
|
|||
/* Standard way to build a security descriptor with the usual DACL */
|
||||
PSECURITY_ATTRIBUTES sa_buf = (PSECURITY_ATTRIBUTES) alloca (1024);
|
||||
psd = (PSECURITY_DESCRIPTOR)
|
||||
(sec_user_nih (sa_buf, sid()))->lpSecurityDescriptor;
|
||||
(sec_user_nih (sa_buf, sid()))->lpSecurityDescriptor;
|
||||
|
||||
BOOLEAN acl_exists, dummy;
|
||||
TOKEN_DEFAULT_DACL dacl;
|
||||
|
@ -326,7 +326,7 @@ cygheap_user::ontherange (homebodies what, struct passwd *pw)
|
|||
if (!(ret = NetUserGetInfo (wlogsrv, wuser, 3, (LPBYTE *) &ui)))
|
||||
{
|
||||
sys_wcstombs (homepath_env_buf, NT_MAX_PATH,
|
||||
ui->usri3_home_dir);
|
||||
ui->usri3_home_dir);
|
||||
if (!homepath_env_buf[0])
|
||||
{
|
||||
sys_wcstombs (homepath_env_buf, NT_MAX_PATH,
|
||||
|
|
Loading…
Reference in New Issue