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);
|
idx = __iso_8859_index (charset + 9);
|
||||||
/* Our ctype table has a leading ISO-8859-1 element. */
|
/* Our ctype table has a leading ISO-8859-1 element. */
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
idx = 0;
|
idx = 0;
|
||||||
else
|
else
|
||||||
++idx;
|
++idx;
|
||||||
if (CYGWIN_VERSION_CHECK_FOR_OLD_CTYPE)
|
if (CYGWIN_VERSION_CHECK_FOR_OLD_CTYPE)
|
||||||
{
|
{
|
||||||
memcpy (_ctype_b, __ctype_iso[idx], 128);
|
memcpy (_ctype_b, __ctype_iso[idx], 128);
|
||||||
memcpy (_ctype_b + 256, __ctype_iso[idx] + 256, 128);
|
memcpy (_ctype_b + 256, __ctype_iso[idx] + 256, 128);
|
||||||
}
|
}
|
||||||
|
|
|
@ -446,7 +446,7 @@ cygheap_user::set_name (const char *new_name)
|
||||||
if (allocated)
|
if (allocated)
|
||||||
{
|
{
|
||||||
/* Windows user names are case-insensitive. Here we want the correct
|
/* 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))
|
if (!strcmp (new_name, pname))
|
||||||
return;
|
return;
|
||||||
cfree (pname);
|
cfree (pname);
|
||||||
|
|
|
@ -181,7 +181,7 @@ public:
|
||||||
if (curr_imp_token != NO_IMPERSONATION)
|
if (curr_imp_token != NO_IMPERSONATION)
|
||||||
CloseHandle (curr_imp_token);
|
CloseHandle (curr_imp_token);
|
||||||
if (curr_primary_token != NO_IMPERSONATION
|
if (curr_primary_token != NO_IMPERSONATION
|
||||||
&& curr_primary_token != external_token
|
&& curr_primary_token != external_token
|
||||||
&& curr_primary_token != internal_token)
|
&& curr_primary_token != internal_token)
|
||||||
CloseHandle (curr_primary_token);
|
CloseHandle (curr_primary_token);
|
||||||
if (external_token != NO_IMPERSONATION)
|
if (external_token != NO_IMPERSONATION)
|
||||||
|
|
|
@ -239,7 +239,7 @@ globify (char *word, char **&argv, int &argc, int &argvlen)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
--s;
|
--s;
|
||||||
while (cnt-- > 0)
|
while (cnt-- > 0)
|
||||||
*p++ = *++s;
|
*p++ = *++s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,7 +303,7 @@ mkdir (const char *dir, mode_t mode)
|
||||||
char *p = stpcpy (buf = tp.c_get (), dir) - 1;
|
char *p = stpcpy (buf = tp.c_get (), dir) - 1;
|
||||||
dir = buf;
|
dir = buf;
|
||||||
while (p > dir && isdirsep (*p))
|
while (p > dir && isdirsep (*p))
|
||||||
*p-- = '\0';
|
*p-- = '\0';
|
||||||
}
|
}
|
||||||
if (!(fh = build_fh_name (dir, PC_SYM_NOFOLLOW)))
|
if (!(fh = build_fh_name (dir, PC_SYM_NOFOLLOW)))
|
||||||
goto done; /* errno already set */;
|
goto done; /* errno already set */;
|
||||||
|
|
|
@ -76,7 +76,7 @@ dlopen (const char *name, int)
|
||||||
{
|
{
|
||||||
ret = (void *) GetModuleHandle (NULL); /* handle for the current module */
|
ret = (void *) GetModuleHandle (NULL); /* handle for the current module */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
__seterrno ();
|
__seterrno ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -306,7 +306,7 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
|
||||||
dev = *pipew_dev;
|
dev = *pipew_dev;
|
||||||
}
|
}
|
||||||
else if (GetConsoleScreenBufferInfo (handle, &buf)
|
else if (GetConsoleScreenBufferInfo (handle, &buf)
|
||||||
|| GetNumberOfConsoleInputEvents (handle, (DWORD *) &buf))
|
|| GetNumberOfConsoleInputEvents (handle, (DWORD *) &buf))
|
||||||
{
|
{
|
||||||
/* Console I/O */
|
/* Console I/O */
|
||||||
if (!ISSTATE (myself, PID_USETTY))
|
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
|
by NtQueryInformationFile is meaningless. CMD always hands down
|
||||||
stdin handles as R/O handles, but our tty slave sides are R/W. */
|
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)
|
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,
|
else if (NT_SUCCESS (NtQueryInformationFile (handle, &io, &fai,
|
||||||
sizeof fai,
|
sizeof fai,
|
||||||
FileAccessInformation)))
|
FileAccessInformation)))
|
||||||
|
@ -950,11 +950,12 @@ dtable::fixup_before_fork (DWORD target_proc_id)
|
||||||
for (size_t i = 0; i < size; i++)
|
for (size_t i = 0; i < size; i++)
|
||||||
if ((fh = fds[i]) != NULL)
|
if ((fh = fds[i]) != NULL)
|
||||||
{
|
{
|
||||||
debug_printf ("fd %d (%s)", i, fh->get_name ());
|
debug_printf ("fd %d (%s)", i, fh->get_name ());
|
||||||
fh->fixup_before_fork_exec (target_proc_id);
|
fh->fixup_before_fork_exec (target_proc_id);
|
||||||
}
|
}
|
||||||
unlock ();
|
unlock ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dtable::fixup_before_exec (DWORD target_proc_id)
|
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++)
|
for (size_t i = 0; i < size; i++)
|
||||||
if ((fh = fds[i]) != NULL && !fh->close_on_exec ())
|
if ((fh = fds[i]) != NULL && !fh->close_on_exec ())
|
||||||
{
|
{
|
||||||
debug_printf ("fd %d (%s)", i, fh->get_name ());
|
debug_printf ("fd %d (%s)", i, fh->get_name ());
|
||||||
fh->fixup_before_fork_exec (target_proc_id);
|
fh->fixup_before_fork_exec (target_proc_id);
|
||||||
}
|
}
|
||||||
unlock ();
|
unlock ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -382,10 +382,10 @@ _strerror_r (struct _reent *, int errnum, int internal, int *errptr)
|
||||||
if (!errstr)
|
if (!errstr)
|
||||||
{
|
{
|
||||||
errstr = internal ? _my_tls.locals.strerror_r_buf
|
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);
|
__small_sprintf (errstr, "Unknown error %d", errnum);
|
||||||
if (errptr)
|
if (errptr)
|
||||||
*errptr = EINVAL;
|
*errptr = EINVAL;
|
||||||
}
|
}
|
||||||
return errstr;
|
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 */
|
/* strcmp(3) will SEGV if filename or last_filename are NULL */
|
||||||
if (lineno == last_lineno
|
if (lineno == last_lineno
|
||||||
&& ((!filename && !last_filename)
|
&& ((!filename && !last_filename)
|
||||||
|| (filename && last_filename && strcmp (filename, last_filename) == 0)))
|
|| (filename && last_filename && strcmp (filename, last_filename) == 0)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
last_filename = filename;
|
last_filename = filename;
|
||||||
last_lineno = lineno;
|
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
|
si.si_addr = (si.si_signo == SIGSEGV || si.si_signo == SIGBUS
|
||||||
? (void *) e->ExceptionInformation[1]
|
? (void *) e->ExceptionInformation[1]
|
||||||
: (void *) in->Eip);
|
: (void *) in->Eip);
|
||||||
si.si_errno = si.si_pid = si.si_uid = 0;
|
si.si_errno = si.si_pid = si.si_uid = 0;
|
||||||
me.incyg++;
|
me.incyg++;
|
||||||
sig_send (NULL, si, &me); // Signal myself
|
sig_send (NULL, si, &me); // Signal myself
|
||||||
|
|
|
@ -99,7 +99,7 @@ set_clipboard (const void *buf, size_t len)
|
||||||
HANDLE ret = SetClipboardData (cygnativeformat, hmem);
|
HANDLE ret = SetClipboardData (cygnativeformat, hmem);
|
||||||
CloseClipboard ();
|
CloseClipboard ();
|
||||||
/* According to MSDN, hmem must not be free'd after transferring the
|
/* 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); */
|
/* GlobalFree (hmem); */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
|
@ -130,7 +130,7 @@ set_clipboard (const void *buf, size_t len)
|
||||||
HANDLE ret = SetClipboardData (CF_UNICODETEXT, hmem);
|
HANDLE ret = SetClipboardData (CF_UNICODETEXT, hmem);
|
||||||
CloseClipboard ();
|
CloseClipboard ();
|
||||||
/* According to MSDN, hmem must not be free'd after transferring the
|
/* 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); */
|
/* GlobalFree (hmem); */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
|
@ -163,7 +163,7 @@ fhandler_dev_clipboard::write (const void *buf, size_t len)
|
||||||
if (set_clipboard (membuffer, msize))
|
if (set_clipboard (membuffer, msize))
|
||||||
{
|
{
|
||||||
/* FIXME: membuffer is now out of sync with pos, but msize
|
/* FIXME: membuffer is now out of sync with pos, but msize
|
||||||
is used above */
|
is used above */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -300,9 +300,9 @@ fhandler_console::mouse_aware (MOUSE_EVENT_RECORD& mouse_event)
|
||||||
|| mouse_event.dwEventFlags == MOUSE_WHEELED
|
|| mouse_event.dwEventFlags == MOUSE_WHEELED
|
||||||
|| (mouse_event.dwEventFlags == MOUSE_MOVED
|
|| (mouse_event.dwEventFlags == MOUSE_MOVED
|
||||||
&& (dev_state.dwMousePosition.X != dev_state.dwLastMousePosition.X
|
&& (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 >= 2 && mouse_event.dwButtonState)
|
||||||
|| dev_state.use_mouse >= 3));
|
|| dev_state.use_mouse >= 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
void __stdcall
|
void __stdcall
|
||||||
|
@ -1223,7 +1223,7 @@ bool fhandler_console::write_console (PWCHAR buf, DWORD len, DWORD& done)
|
||||||
: dev_state.vt100_graphics_mode_G0)
|
: dev_state.vt100_graphics_mode_G0)
|
||||||
for (DWORD i = 0; i < len; i ++)
|
for (DWORD i = 0; i < len; i ++)
|
||||||
if (buf[i] >= (unsigned char) '`' && buf[i] <= (unsigned char) '~')
|
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)
|
while (len > 0)
|
||||||
{
|
{
|
||||||
|
@ -1620,8 +1620,8 @@ fhandler_console::char_command (char c)
|
||||||
else
|
else
|
||||||
strcpy (buf, "\033[?6c");
|
strcpy (buf, "\033[?6c");
|
||||||
/* The generated report needs to be injected for read-ahead into the
|
/* The generated report needs to be injected for read-ahead into the
|
||||||
fhandler_console object associated with standard input.
|
fhandler_console object associated with standard input.
|
||||||
The current call does not work. */
|
The current call does not work. */
|
||||||
puts_readahead (buf);
|
puts_readahead (buf);
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
|
@ -2117,16 +2117,16 @@ get_nonascii_key (INPUT_RECORD& input_rec, char *tmp)
|
||||||
for (int i = 0; keytable[i].vk; i++)
|
for (int i = 0; keytable[i].vk; i++)
|
||||||
if (input_rec.Event.KeyEvent.wVirtualKeyCode == keytable[i].vk)
|
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))
|
(LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED))
|
||||||
&& keytable[i].val[modifier_index] != NULL)
|
&& keytable[i].val[modifier_index] != NULL)
|
||||||
{ /* Generic ESC prefixing if Alt is pressed */
|
{ /* Generic ESC prefixing if Alt is pressed */
|
||||||
tmp[0] = '\033';
|
tmp[0] = '\033';
|
||||||
strcpy (tmp + 1, keytable[i].val[modifier_index]);
|
strcpy (tmp + 1, keytable[i].val[modifier_index]);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return keytable[i].val[modifier_index];
|
return keytable[i].val[modifier_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input_rec.Event.KeyEvent.uChar.AsciiChar)
|
if (input_rec.Event.KeyEvent.uChar.AsciiChar)
|
||||||
|
@ -2204,7 +2204,7 @@ fhandler_console::create_invisible_console (HWINSTA horig)
|
||||||
termios_printf ("SetProcessWindowStation %d, %E", b);
|
termios_printf ("SetProcessWindowStation %d, %E", b);
|
||||||
}
|
}
|
||||||
b = AllocConsole (); /* will cause flashing if CreateWindowStation
|
b = AllocConsole (); /* will cause flashing if CreateWindowStation
|
||||||
failed */
|
failed */
|
||||||
if (!h)
|
if (!h)
|
||||||
SetParent (GetConsoleWindow (), HWND_MESSAGE);
|
SetParent (GetConsoleWindow (), HWND_MESSAGE);
|
||||||
if (horig && h && h != horig && SetProcessWindowStation (horig))
|
if (horig && h && h != horig && SetProcessWindowStation (horig))
|
||||||
|
|
|
@ -180,7 +180,7 @@ readdir_check_reparse_point (POBJECT_ATTRIBUTES attr)
|
||||||
if (RtlEqualUnicodePathPrefix (&subst, &ro_u_volume, TRUE))
|
if (RtlEqualUnicodePathPrefix (&subst, &ro_u_volume, TRUE))
|
||||||
ret = DT_DIR;
|
ret = DT_DIR;
|
||||||
else
|
else
|
||||||
ret = DT_LNK;
|
ret = DT_LNK;
|
||||||
}
|
}
|
||||||
else if (rp->ReparseTag == IO_REPARSE_TAG_SYMLINK)
|
else if (rp->ReparseTag == IO_REPARSE_TAG_SYMLINK)
|
||||||
ret = DT_LNK;
|
ret = DT_LNK;
|
||||||
|
@ -349,7 +349,7 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf)
|
||||||
{
|
{
|
||||||
PFILE_NETWORK_OPEN_INFORMATION pfnoi = pc.fnoi ();
|
PFILE_NETWORK_OPEN_INFORMATION pfnoi = pc.fnoi ();
|
||||||
status = NtQueryInformationFile (h, &io, pfnoi, sizeof *pfnoi,
|
status = NtQueryInformationFile (h, &io, pfnoi, sizeof *pfnoi,
|
||||||
FileNetworkOpenInformation);
|
FileNetworkOpenInformation);
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
{
|
{
|
||||||
debug_printf ("%p = NtQueryInformationFile(%S, "
|
debug_printf ("%p = NtQueryInformationFile(%S, "
|
||||||
|
@ -615,7 +615,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
|
||||||
IO_STATUS_BLOCK io;
|
IO_STATUS_BLOCK io;
|
||||||
|
|
||||||
/* We have to re-open the file. Either the file is not opened
|
/* 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. */
|
original handle. */
|
||||||
pc.init_reopen_attr (&attr, h);
|
pc.init_reopen_attr (&attr, h);
|
||||||
status = NtOpenFile (&h, SYNCHRONIZE | FILE_READ_DATA,
|
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;
|
attrib = S_IFLNK | STD_RBITS | STD_WBITS;
|
||||||
res = set_file_attribute (get_handle (), pc, uid, gid, attrib);
|
res = set_file_attribute (get_handle (), pc, uid, gid, attrib);
|
||||||
/* If you're running a Samba server which has no winbidd running, the
|
/* 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
|
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
|
account which gets used for the standard user mapping. This is a
|
||||||
default mechanism which doesn't know your real Windows SID.
|
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);
|
res = getacl (get_stat_handle (), pc, nentries, aclbufp);
|
||||||
/* For this ENOSYS case, see security.cc:get_file_attribute(). */
|
/* For this ENOSYS case, see security.cc:get_file_attribute(). */
|
||||||
if (res == -1 && get_errno () == ENOSYS)
|
if (res == -1 && get_errno () == ENOSYS)
|
||||||
goto cant_access_acl;
|
goto cant_access_acl;
|
||||||
break;
|
break;
|
||||||
case GETACLCNT:
|
case GETACLCNT:
|
||||||
res = getacl (get_stat_handle (), pc, 0, NULL);
|
res = getacl (get_stat_handle (), pc, 0, NULL);
|
||||||
|
@ -1611,7 +1611,8 @@ fhandler_disk_file::rmdir ()
|
||||||
FILE_BASIC_INFORMATION fbi;
|
FILE_BASIC_INFORMATION fbi;
|
||||||
NTSTATUS q_status;
|
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)
|
if (!NT_SUCCESS (status) && q_status == STATUS_OBJECT_NAME_NOT_FOUND)
|
||||||
status = STATUS_SUCCESS;
|
status = STATUS_SUCCESS;
|
||||||
else if (NT_SUCCESS (status) && NT_SUCCESS (q_status))
|
else if (NT_SUCCESS (status) && NT_SUCCESS (q_status))
|
||||||
|
@ -2104,7 +2105,7 @@ go_ahead:
|
||||||
pc.objcaseinsensitive (),
|
pc.objcaseinsensitive (),
|
||||||
get_handle (), NULL);
|
get_handle (), NULL);
|
||||||
/* FILE_OPEN_REPARSE_POINT on NFS is a no-op, so the normal
|
/* 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.
|
rather than the inode number of the symlink itself.
|
||||||
|
|
||||||
Worse, trying to open a symlink without setting the special
|
Worse, trying to open a symlink without setting the special
|
||||||
|
|
|
@ -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
|
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)
|
while (bytes_to_read != 0)
|
||||||
{ // Block till next sound has been read
|
{ // Block till next sound has been read
|
||||||
if (!waitfordata ())
|
if (!waitfordata ())
|
||||||
{
|
{
|
||||||
if (nBytes)
|
if (nBytes)
|
||||||
return true;
|
return true;
|
||||||
nBytes = -1;
|
nBytes = -1;
|
||||||
|
|
|
@ -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. */
|
/* 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,
|
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");
|
debug_printf ("DeviceIoControl(IOCTL_DISK_GET_DRIVE_LAYOUT_EX): %E");
|
||||||
return FALSE;
|
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
|
/* A partition number of 0 denotes an extended partition or one of the
|
||||||
aforementioned filler entries. Just skip. */
|
aforementioned filler entries. Just skip. */
|
||||||
if (ppie->PartitionNumber == 0)
|
if (ppie->PartitionNumber == 0)
|
||||||
continue;
|
continue;
|
||||||
/* Check if our writing range affects this partition. */
|
/* Check if our writing range affects this partition. */
|
||||||
if (fpi.CurrentByteOffset.QuadPart < ppie->StartingOffset.QuadPart
|
if (fpi.CurrentByteOffset.QuadPart < ppie->StartingOffset.QuadPart
|
||||||
+ ppie->PartitionLength.QuadPart
|
+ ppie->PartitionLength.QuadPart
|
||||||
|
@ -376,7 +376,7 @@ fhandler_dev_floppy::open (int flags, mode_t)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* If we're trying to access a CD/DVD drive, or an entire disk,
|
/* 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. */
|
This is actually documented in the MSDN CreateFile man page. */
|
||||||
if (get_major () != DEV_FLOPPY_MAJOR
|
if (get_major () != DEV_FLOPPY_MAJOR
|
||||||
&& (get_major () == DEV_CDROM_MAJOR || get_minor () % 16 == 0)
|
&& (get_major () == DEV_CDROM_MAJOR || get_minor () % 16 == 0)
|
||||||
|
|
|
@ -391,8 +391,8 @@ format_proc_loadavg (void *, char *&destbuf)
|
||||||
switch (get_process_state (i)) {
|
switch (get_process_state (i)) {
|
||||||
case 'O':
|
case 'O':
|
||||||
case 'R':
|
case 'R':
|
||||||
running++;
|
running++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
destbuf = (char *) crealloc_abort (destbuf, 16);
|
destbuf = (char *) crealloc_abort (destbuf, 16);
|
||||||
|
@ -514,7 +514,7 @@ format_proc_stat (void *, char *&destbuf)
|
||||||
if (!NT_SUCCESS (ret))
|
if (!NT_SUCCESS (ret))
|
||||||
{
|
{
|
||||||
debug_printf ("NtQuerySystemInformation(SystemPerformanceInformation)"
|
debug_printf ("NtQuerySystemInformation(SystemPerformanceInformation)"
|
||||||
", status %p", ret);
|
", status %p", ret);
|
||||||
memset (spi, 0, sizeof_spi);
|
memset (spi, 0, sizeof_spi);
|
||||||
}
|
}
|
||||||
ret = NtQuerySystemInformation (SystemTimeOfDayInformation,
|
ret = NtQuerySystemInformation (SystemTimeOfDayInformation,
|
||||||
|
@ -1241,8 +1241,8 @@ format_proc_filesystems (void *, char *&destbuf)
|
||||||
/* start at 1 to skip type "none" */
|
/* start at 1 to skip type "none" */
|
||||||
for (int i = 1; fs_names[i].name; i++)
|
for (int i = 1; fs_names[i].name; i++)
|
||||||
bufptr += __small_sprintf(bufptr, "%s\t%s\n",
|
bufptr += __small_sprintf(bufptr, "%s\t%s\n",
|
||||||
fs_names[i].block_device ? "" : "nodev",
|
fs_names[i].block_device ? "" : "nodev",
|
||||||
fs_names[i].name);
|
fs_names[i].name);
|
||||||
|
|
||||||
destbuf = (char *) crealloc_abort (destbuf, bufptr - buf);
|
destbuf = (char *) crealloc_abort (destbuf, bufptr - buf);
|
||||||
memcpy (destbuf, buf, bufptr - buf);
|
memcpy (destbuf, buf, bufptr - buf);
|
||||||
|
@ -1279,7 +1279,7 @@ format_proc_swaps (void *, char *&destbuf)
|
||||||
}
|
}
|
||||||
|
|
||||||
bufptr += __small_sprintf (bufptr,
|
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)
|
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);
|
cygwin_conv_path (CCP_WIN_W_TO_POSIX, spp->FileName.Buffer, filename, filename_len);
|
||||||
|
|
||||||
bufptr += sprintf (bufptr, "%-40s%-16s%-8llu%-8llu%-8d\n",
|
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
|
while (spp->NextEntryOffset
|
||||||
&& (spp = (PSYSTEM_PAGEFILE_INFORMATION)
|
&& (spp = (PSYSTEM_PAGEFILE_INFORMATION)
|
||||||
|
|
|
@ -330,7 +330,7 @@ fhandler_process::fill_filebuf ()
|
||||||
if (process_tab[fileid].format_func)
|
if (process_tab[fileid].format_func)
|
||||||
{
|
{
|
||||||
if (process_tab[fileid].fhandler == FH_PROCESSFD)
|
if (process_tab[fileid].fhandler == FH_PROCESSFD)
|
||||||
{
|
{
|
||||||
process_fd_t fd = { path, p };
|
process_fd_t fd = { path, p };
|
||||||
filesize = process_tab[fileid].format_func (&fd, filebuf);
|
filesize = process_tab[fileid].format_func (&fd, filebuf);
|
||||||
}
|
}
|
||||||
|
@ -640,7 +640,7 @@ struct heap_info
|
||||||
if (NT_SUCCESS (status)
|
if (NT_SUCCESS (status)
|
||||||
&& (harray = (PDEBUG_HEAP_ARRAY) buf->HeapInformation) != NULL)
|
&& (harray = (PDEBUG_HEAP_ARRAY) buf->HeapInformation) != NULL)
|
||||||
for (ULONG hcnt = 0; hcnt < harray->Count; ++hcnt)
|
for (ULONG hcnt = 0; hcnt < harray->Count; ++hcnt)
|
||||||
{
|
{
|
||||||
PDEBUG_HEAP_BLOCK barray = (PDEBUG_HEAP_BLOCK)
|
PDEBUG_HEAP_BLOCK barray = (PDEBUG_HEAP_BLOCK)
|
||||||
harray->Heaps[hcnt].Blocks;
|
harray->Heaps[hcnt].Blocks;
|
||||||
if (!barray)
|
if (!barray)
|
||||||
|
@ -725,7 +725,7 @@ struct thread_info
|
||||||
buf = realloc (buf, size);
|
buf = realloc (buf, size);
|
||||||
status = NtQuerySystemInformation (SystemProcessesAndThreadsInformation,
|
status = NtQuerySystemInformation (SystemProcessesAndThreadsInformation,
|
||||||
buf, size, NULL);
|
buf, size, NULL);
|
||||||
size <<= 1;
|
size <<= 1;
|
||||||
}
|
}
|
||||||
while (status == STATUS_INFO_LENGTH_MISMATCH);
|
while (status == STATUS_INFO_LENGTH_MISMATCH);
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
|
@ -884,7 +884,7 @@ format_process_maps (void *data, char *&destbuf)
|
||||||
i = cur.rend)
|
i = cur.rend)
|
||||||
{
|
{
|
||||||
if (last_pass)
|
if (last_pass)
|
||||||
posix_modname[0] = '\0';
|
posix_modname[0] = '\0';
|
||||||
if (mb.State == MEM_FREE)
|
if (mb.State == MEM_FREE)
|
||||||
a.word = 0;
|
a.word = 0;
|
||||||
else if (mb.State == MEM_RESERVE)
|
else if (mb.State == MEM_RESERVE)
|
||||||
|
@ -1247,7 +1247,7 @@ format_process_mounts (void *data, char *&destbuf)
|
||||||
cygsid p_sid;
|
cygsid p_sid;
|
||||||
|
|
||||||
if (!p_sid.getfrompw (internal_getpwuid (p->uid)))
|
if (!p_sid.getfrompw (internal_getpwuid (p->uid)))
|
||||||
return 0;
|
return 0;
|
||||||
p_sid.string (sid_string);
|
p_sid.string (sid_string);
|
||||||
u_shared = (user_info *) open_shared (sid_string, USER_VERSION, u_hdl,
|
u_shared = (user_info *) open_shared (sid_string, USER_VERSION, u_hdl,
|
||||||
sizeof (user_info), SH_JUSTOPEN,
|
sizeof (user_info), SH_JUSTOPEN,
|
||||||
|
@ -1322,7 +1322,7 @@ get_process_state (DWORD dwProcessId)
|
||||||
state = 'S';
|
state = 'S';
|
||||||
for (unsigned i = 0; i < sp->ThreadCount; i++)
|
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 ||
|
if (st->State == StateRunning ||
|
||||||
st->State == StateReady)
|
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));
|
(PVOID) p, n, (length = ULONG_MAX, &length));
|
||||||
if (ret == STATUS_INFO_LENGTH_MISMATCH
|
if (ret == STATUS_INFO_LENGTH_MISMATCH
|
||||||
|| (!NT_SUCCESS (ret) && length > n))
|
|| (!NT_SUCCESS (ret) && length > n))
|
||||||
{
|
{
|
||||||
ret = STATUS_INFO_LENGTH_MISMATCH;
|
ret = STATUS_INFO_LENGTH_MISMATCH;
|
||||||
n <<= 1;
|
n <<= 1;
|
||||||
PMEMORY_WORKING_SET_LIST new_p = (PMEMORY_WORKING_SET_LIST)
|
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[] =
|
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 (".."), FH_PROCNET, virt_directory, NULL },
|
||||||
{ _VN ("if_inet6"), FH_PROCNET, virt_file, format_procnet_ifinet6 },
|
{ _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 =
|
static const int PROCNET_LINK_COUNT =
|
||||||
|
|
|
@ -90,7 +90,7 @@ fhandler_procsys::exists (struct __stat64 *buf)
|
||||||
{
|
{
|
||||||
/* If requested, check permissions. */
|
/* If requested, check permissions. */
|
||||||
if (buf)
|
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);
|
NtClose (h);
|
||||||
return virt_symlink;
|
return virt_symlink;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ fhandler_procsys::exists (struct __stat64 *buf)
|
||||||
{
|
{
|
||||||
/* If requested, check permissions. */
|
/* If requested, check permissions. */
|
||||||
if (buf)
|
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);
|
NtClose (h);
|
||||||
return virt_directory;
|
return virt_directory;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ fhandler_procsys::exists (struct __stat64 *buf)
|
||||||
/* If requested, check permissions. If this is a parent handle from
|
/* If requested, check permissions. If this is a parent handle from
|
||||||
the above desperate parent check, skip. */
|
the above desperate parent check, skip. */
|
||||||
if (buf && !desperate_parent_check)
|
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. */
|
/* Check for the device type. */
|
||||||
status = NtQueryVolumeInformationFile (h, &io, &ffdi, sizeof ffdi,
|
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[] =
|
static const virt_tab_t procsysvipc_tab[] =
|
||||||
{
|
{
|
||||||
{ _VN ("."), FH_PROCSYSVIPC, virt_directory, NULL },
|
{ _VN ("."), FH_PROCSYSVIPC, virt_directory, NULL },
|
||||||
{ _VN (".."), FH_PROCSYSVIPC, virt_directory, NULL },
|
{ _VN (".."), FH_PROCSYSVIPC, virt_directory, NULL },
|
||||||
{ _VN ("msg"), FH_PROCSYSVIPC, virt_file, format_procsysvipc_msg },
|
{ _VN ("msg"), FH_PROCSYSVIPC, virt_file, format_procsysvipc_msg },
|
||||||
{ _VN ("sem"), FH_PROCSYSVIPC, virt_file, format_procsysvipc_sem },
|
{ _VN ("sem"), FH_PROCSYSVIPC, virt_file, format_procsysvipc_sem },
|
||||||
{ _VN ("shm"), FH_PROCSYSVIPC, virt_file, format_procsysvipc_shm },
|
{ _VN ("shm"), FH_PROCSYSVIPC, virt_file, format_procsysvipc_shm },
|
||||||
{ NULL, 0, FH_BAD, virt_none, NULL }
|
{ NULL, 0, FH_BAD, virt_none, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int PROCSYSVIPC_LINK_COUNT =
|
static const int PROCSYSVIPC_LINK_COUNT =
|
||||||
|
@ -77,10 +77,10 @@ fhandler_procsysvipc::exists ()
|
||||||
if (entry)
|
if (entry)
|
||||||
{
|
{
|
||||||
if (entry->type == virt_file)
|
if (entry->type == virt_file)
|
||||||
{
|
{
|
||||||
if (cygserver_running != CYGSERVER_OK)
|
if (cygserver_running != CYGSERVER_OK)
|
||||||
return virt_none;
|
return virt_none;
|
||||||
}
|
}
|
||||||
fileid = entry - procsysvipc_tab;
|
fileid = entry - procsysvipc_tab;
|
||||||
return entry->type;
|
return entry->type;
|
||||||
}
|
}
|
||||||
|
@ -233,26 +233,26 @@ format_procsysvipc_msg (void *, char *&destbuf)
|
||||||
msgctl (msginfo.msgmni, IPC_INFO, (struct msqid_ds *) xmsqids);
|
msgctl (msginfo.msgmni, IPC_INFO, (struct msqid_ds *) xmsqids);
|
||||||
|
|
||||||
bufptr += __small_sprintf (bufptr,
|
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++) {
|
for (int i = 0; i < msginfo.msgmni; i++) {
|
||||||
if (xmsqids[i].msg_qbytes != 0) {
|
if (xmsqids[i].msg_qbytes != 0) {
|
||||||
bufptr += sprintf (bufptr,
|
bufptr += sprintf (bufptr,
|
||||||
"%10llu %10u %5o %11lu %10lu %5d %5d %5lu %5lu %5lu %5lu %10ld %10ld %10ld\n",
|
"%10llu %10u %5o %11lu %10lu %5d %5d %5lu %5lu %5lu %5lu %10ld %10ld %10ld\n",
|
||||||
xmsqids[i].msg_perm.key,
|
xmsqids[i].msg_perm.key,
|
||||||
IXSEQ_TO_IPCID(i, xmsqids[i].msg_perm),
|
IXSEQ_TO_IPCID(i, xmsqids[i].msg_perm),
|
||||||
xmsqids[i].msg_perm.mode,
|
xmsqids[i].msg_perm.mode,
|
||||||
xmsqids[i].msg_cbytes,
|
xmsqids[i].msg_cbytes,
|
||||||
xmsqids[i].msg_qnum,
|
xmsqids[i].msg_qnum,
|
||||||
xmsqids[i].msg_lspid,
|
xmsqids[i].msg_lspid,
|
||||||
xmsqids[i].msg_lrpid,
|
xmsqids[i].msg_lrpid,
|
||||||
xmsqids[i].msg_perm.uid,
|
xmsqids[i].msg_perm.uid,
|
||||||
xmsqids[i].msg_perm.gid,
|
xmsqids[i].msg_perm.gid,
|
||||||
xmsqids[i].msg_perm.cuid,
|
xmsqids[i].msg_perm.cuid,
|
||||||
xmsqids[i].msg_perm.cgid,
|
xmsqids[i].msg_perm.cgid,
|
||||||
xmsqids[i].msg_stime,
|
xmsqids[i].msg_stime,
|
||||||
xmsqids[i].msg_rtime,
|
xmsqids[i].msg_rtime,
|
||||||
xmsqids[i].msg_ctime);
|
xmsqids[i].msg_ctime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,21 +280,21 @@ format_procsysvipc_sem (void *, char *&destbuf)
|
||||||
semctl (seminfo.semmni, 0, IPC_INFO, semun);
|
semctl (seminfo.semmni, 0, IPC_INFO, semun);
|
||||||
|
|
||||||
bufptr += __small_sprintf (bufptr,
|
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++) {
|
for (int i = 0; i < seminfo.semmni; i++) {
|
||||||
if ((xsemids[i].sem_perm.mode & SEM_ALLOC) != 0) {
|
if ((xsemids[i].sem_perm.mode & SEM_ALLOC) != 0) {
|
||||||
bufptr += sprintf (bufptr,
|
bufptr += sprintf (bufptr,
|
||||||
"%10llu %10u %5o %10d %5lu %5lu %5lu %5lu %10ld %10ld\n",
|
"%10llu %10u %5o %10d %5lu %5lu %5lu %5lu %10ld %10ld\n",
|
||||||
xsemids[i].sem_perm.key,
|
xsemids[i].sem_perm.key,
|
||||||
IXSEQ_TO_IPCID(i, xsemids[i].sem_perm),
|
IXSEQ_TO_IPCID(i, xsemids[i].sem_perm),
|
||||||
xsemids[i].sem_perm.mode,
|
xsemids[i].sem_perm.mode,
|
||||||
xsemids[i].sem_nsems,
|
xsemids[i].sem_nsems,
|
||||||
xsemids[i].sem_perm.uid,
|
xsemids[i].sem_perm.uid,
|
||||||
xsemids[i].sem_perm.gid,
|
xsemids[i].sem_perm.gid,
|
||||||
xsemids[i].sem_perm.cuid,
|
xsemids[i].sem_perm.cuid,
|
||||||
xsemids[i].sem_perm.cgid,
|
xsemids[i].sem_perm.cgid,
|
||||||
xsemids[i].sem_otime,
|
xsemids[i].sem_otime,
|
||||||
xsemids[i].sem_ctime);
|
xsemids[i].sem_ctime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,25 +319,25 @@ format_procsysvipc_shm (void *, char *&destbuf)
|
||||||
shmctl (shminfo.shmmni, IPC_INFO, (struct shmid_ds *) xshmids);
|
shmctl (shminfo.shmmni, IPC_INFO, (struct shmid_ds *) xshmids);
|
||||||
|
|
||||||
bufptr += __small_sprintf (bufptr,
|
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++) {
|
for (int i = 0; i < shminfo.shmmni; i++) {
|
||||||
if (xshmids[i].shm_perm.mode & 0x0800) {
|
if (xshmids[i].shm_perm.mode & 0x0800) {
|
||||||
bufptr += sprintf (bufptr,
|
bufptr += sprintf (bufptr,
|
||||||
"%10llu %10u %5o %10u %5d %5d %6u %5lu %5lu %5lu %5lu %10ld %10ld %10ld\n",
|
"%10llu %10u %5o %10u %5d %5d %6u %5lu %5lu %5lu %5lu %10ld %10ld %10ld\n",
|
||||||
xshmids[i].shm_perm.key,
|
xshmids[i].shm_perm.key,
|
||||||
IXSEQ_TO_IPCID(i, xshmids[i].shm_perm),
|
IXSEQ_TO_IPCID(i, xshmids[i].shm_perm),
|
||||||
xshmids[i].shm_perm.mode,
|
xshmids[i].shm_perm.mode,
|
||||||
xshmids[i].shm_segsz,
|
xshmids[i].shm_segsz,
|
||||||
xshmids[i].shm_cpid,
|
xshmids[i].shm_cpid,
|
||||||
xshmids[i].shm_lpid,
|
xshmids[i].shm_lpid,
|
||||||
xshmids[i].shm_nattch,
|
xshmids[i].shm_nattch,
|
||||||
xshmids[i].shm_perm.uid,
|
xshmids[i].shm_perm.uid,
|
||||||
xshmids[i].shm_perm.gid,
|
xshmids[i].shm_perm.gid,
|
||||||
xshmids[i].shm_perm.cuid,
|
xshmids[i].shm_perm.cuid,
|
||||||
xshmids[i].shm_perm.cgid,
|
xshmids[i].shm_perm.cgid,
|
||||||
xshmids[i].shm_atime,
|
xshmids[i].shm_atime,
|
||||||
xshmids[i].shm_dtime,
|
xshmids[i].shm_dtime,
|
||||||
xshmids[i].shm_ctime);
|
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))
|
|| (op->rd_parm > 1 && (op->rd_parm % 512))
|
||||||
|| (get_flags () & O_DIRECT))
|
|| (get_flags () & O_DIRECT))
|
||||||
/* The conditions for a *valid* parameter are these:
|
/* 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.
|
fit in the new buffer.
|
||||||
- The new size is either 0 or 1, both indicating unbufferd
|
- The new size is either 0 or 1, both indicating unbufferd
|
||||||
I/O, or the new buffersize must be a multiple of 512.
|
I/O, or the new buffersize must be a multiple of 512.
|
||||||
|
|
|
@ -330,11 +330,11 @@ fhandler_registry::exists ()
|
||||||
if (hKey == HKEY_PERFORMANCE_DATA)
|
if (hKey == HKEY_PERFORMANCE_DATA)
|
||||||
{
|
{
|
||||||
/* RegEnumValue () returns garbage for this key.
|
/* RegEnumValue () returns garbage for this key.
|
||||||
RegQueryValueEx () returns a PERF_DATA_BLOCK even
|
RegQueryValueEx () returns a PERF_DATA_BLOCK even
|
||||||
if a value does not contain any counter objects.
|
if a value does not contain any counter objects.
|
||||||
So allow access to the generic names and to
|
So allow access to the generic names and to
|
||||||
(blank separated) lists of counter numbers.
|
(blank separated) lists of counter numbers.
|
||||||
Never allow access to "Add", see above comment. */
|
Never allow access to "Add", see above comment. */
|
||||||
for (int i = 0; i < PERF_DATA_FILE_COUNT
|
for (int i = 0; i < PERF_DATA_FILE_COUNT
|
||||||
&& file_type == virt_none; i++)
|
&& file_type == virt_none; i++)
|
||||||
{
|
{
|
||||||
|
@ -574,7 +574,7 @@ fhandler_registry::readdir (DIR *dir, dirent *de)
|
||||||
if ((HKEY) dir->__handle == HKEY_PERFORMANCE_DATA)
|
if ((HKEY) dir->__handle == HKEY_PERFORMANCE_DATA)
|
||||||
{
|
{
|
||||||
/* RegEnumValue () returns garbage for this key,
|
/* 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)
|
if (dir->__d_position >= SPECIAL_DOT_FILE_COUNT + PERF_DATA_FILE_COUNT)
|
||||||
goto out;
|
goto out;
|
||||||
strcpy (de->d_name, perf_data_files[dir->__d_position - SPECIAL_DOT_FILE_COUNT]);
|
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;
|
HANDLE searchmtx;
|
||||||
RtlInitUnicodeString (&uname, sock_shared_name (searchname,
|
RtlInitUnicodeString (&uname, sock_shared_name (searchname,
|
||||||
wsa_events[slot].serial_number));
|
wsa_events[slot].serial_number));
|
||||||
InitializeObjectAttributes (&attr, &uname, 0, get_session_parent_dir (),
|
InitializeObjectAttributes (&attr, &uname, 0, get_session_parent_dir (),
|
||||||
NULL);
|
NULL);
|
||||||
status = NtOpenMutant (&searchmtx, READ_CONTROL, &attr);
|
status = NtOpenMutant (&searchmtx, READ_CONTROL, &attr);
|
||||||
|
@ -735,7 +735,7 @@ fhandler_socket::fixup_after_fork (HANDLE parent)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Even though the original socket was not inheritable, the duplicated
|
/* 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);
|
SetHandleInformation ((HANDLE) new_sock, HANDLE_FLAG_INHERIT, 0);
|
||||||
set_io_handle ((HANDLE) new_sock);
|
set_io_handle ((HANDLE) new_sock);
|
||||||
debug_printf ("WSASocket succeeded (%lx)", 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 (peer)
|
||||||
{
|
{
|
||||||
if (get_addr_family () == AF_LOCAL)
|
if (get_addr_family () == AF_LOCAL)
|
||||||
{
|
{
|
||||||
/* FIXME: Right now we have no way to determine the
|
/* FIXME: Right now we have no way to determine the
|
||||||
bound socket name of the peer's socket. For now
|
bound socket name of the peer's socket. For now
|
||||||
we just fake an unbound socket on the other side. */
|
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_family = AF_LOCAL;
|
||||||
sun.sun_path[0] = '\0';
|
sun.sun_path[0] = '\0';
|
||||||
if (get_sun_path ())
|
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));
|
memcpy (name, &sun, min (*namelen, (int) SUN_LEN (&sun) + 1));
|
||||||
*namelen = (int) SUN_LEN (&sun) + (get_sun_path () ? 1 : 0);
|
*namelen = (int) SUN_LEN (&sun) + (get_sun_path () ? 1 : 0);
|
||||||
res = 0;
|
res = 0;
|
||||||
|
@ -1331,7 +1331,7 @@ fhandler_socket::getpeername (struct sockaddr *name, int *namelen)
|
||||||
sun.sun_family = AF_LOCAL;
|
sun.sun_family = AF_LOCAL;
|
||||||
sun.sun_path[0] = '\0';
|
sun.sun_path[0] = '\0';
|
||||||
if (get_peer_sun_path ())
|
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));
|
memcpy (name, &sun, min (*namelen, (int) SUN_LEN (&sun) + 1));
|
||||||
*namelen = (int) SUN_LEN (&sun) + (get_peer_sun_path () ? 1 : 0);
|
*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);
|
res = WSARecvMsg (get_socket (), wsamsg, &wret, NULL, NULL);
|
||||||
/* This is working around a really weird problem in WinSock.
|
/* 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
|
the socket), connect the socket in the child, then call recv
|
||||||
on the original socket handle in the parent process.
|
on the original socket handle in the parent process.
|
||||||
In this scenario, calls to WinSock's recvfrom and WSARecvFrom
|
In this scenario, calls to WinSock's recvfrom and WSARecvFrom
|
||||||
|
@ -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
|
/* FIXME: Look for a way to split a message into the least number of
|
||||||
pieces to minimize the number of WsaSendTo calls. */
|
pieces to minimize the number of WsaSendTo calls. */
|
||||||
if (get_socket_type () == SOCK_STREAM)
|
if (get_socket_type () == SOCK_STREAM)
|
||||||
{
|
{
|
||||||
buf.buf = wsamsg->lpBuffers[i].buf + off;
|
buf.buf = wsamsg->lpBuffers[i].buf + off;
|
||||||
buf.len = wsamsg->lpBuffers[i].len - off;
|
buf.len = wsamsg->lpBuffers[i].len - off;
|
||||||
/* See net.cc:fdsock() and MSDN KB 823764 */
|
/* 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))
|
#define CONV_OLD_TO_NEW_SIO(old) (((old)&0xff00ffff)|(((long)sizeof(struct ifreq)&IOCPARM_MASK)<<16))
|
||||||
|
|
||||||
struct __old_ifreq {
|
struct __old_ifreq {
|
||||||
#define __OLD_IFNAMSIZ 16
|
#define __OLD_IFNAMSIZ 16
|
||||||
union {
|
union {
|
||||||
char ifrn_name[__OLD_IFNAMSIZ]; /* if name, e.g. "en0" */
|
char ifrn_name[__OLD_IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||||
} ifr_ifrn;
|
} ifr_ifrn;
|
||||||
|
|
|
@ -1449,7 +1449,7 @@ fhandler_dev_tape::dup (fhandler_base *child)
|
||||||
lock (-1);
|
lock (-1);
|
||||||
fhandler_dev_tape *fh = (fhandler_dev_tape *) child;
|
fhandler_dev_tape *fh = (fhandler_dev_tape *) child;
|
||||||
if (!DuplicateHandle (GetCurrentProcess (), mt_mtx,
|
if (!DuplicateHandle (GetCurrentProcess (), mt_mtx,
|
||||||
GetCurrentProcess (), &fh->mt_mtx,
|
GetCurrentProcess (), &fh->mt_mtx,
|
||||||
0, TRUE, DUPLICATE_SAME_ACCESS))
|
0, TRUE, DUPLICATE_SAME_ACCESS))
|
||||||
{
|
{
|
||||||
debug_printf ("dup(%s) failed, mutex handle %x, %E",
|
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];
|
_pinfo *p = pids[i];
|
||||||
termios_printf ("checking pid %d - has pgid %d\n", p->pid, p->pgid);
|
termios_printf ("checking pid %d - has pgid %d\n", p->pid, p->pgid);
|
||||||
if (!p || !p->exists () || p->pgid != pgid)
|
if (!p || !p->exists () || p->pgid != pgid)
|
||||||
continue;
|
continue;
|
||||||
pinfo ppid (p->ppid);
|
pinfo ppid (p->ppid);
|
||||||
if (!ppid)
|
if (!ppid)
|
||||||
continue;
|
continue;
|
||||||
termios_printf ("ppid->pgid %d, ppid->sid %d", ppid->pgid, ppid->sid);
|
termios_printf ("ppid->pgid %d, ppid->sid %d", ppid->pgid, ppid->sid);
|
||||||
if (ppid->pgid != pgid && ppid->sid == myself->sid)
|
if (ppid->pgid != pgid && ppid->sid == myself->sid)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1233,7 +1233,7 @@ fhandler_tty_slave::fstat (struct __stat64 *st)
|
||||||
&st->st_mode))
|
&st->st_mode))
|
||||||
{
|
{
|
||||||
/* If we can't access the ACL, or if the tty doesn't actually exist,
|
/* 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_mode = S_IFCHR | S_IRUSR | S_IWUSR;
|
||||||
st->st_uid = 18;
|
st->st_uid = 18;
|
||||||
st->st_gid = 544;
|
st->st_gid = 544;
|
||||||
|
@ -1690,7 +1690,7 @@ fhandler_pty_master::pty_master_thread ()
|
||||||
HANDLE client = NULL;
|
HANDLE client = NULL;
|
||||||
|
|
||||||
if (!ReadFile (master_ctl, &req, sizeof req, &len, NULL))
|
if (!ReadFile (master_ctl, &req, sizeof req, &len, NULL))
|
||||||
{
|
{
|
||||||
termios_printf ("ReadFile, %E");
|
termios_printf ("ReadFile, %E");
|
||||||
goto reply;
|
goto reply;
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,17 +216,17 @@ get_obj_handle_count (HANDLE h)
|
||||||
class lockf_t
|
class lockf_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
short lf_flags; /* Semantics: F_POSIX, F_FLOCK, F_WAIT */
|
short lf_flags; /* Semantics: F_POSIX, F_FLOCK, F_WAIT */
|
||||||
short lf_type; /* Lock type: F_RDLCK, F_WRLCK */
|
short lf_type; /* Lock type: F_RDLCK, F_WRLCK */
|
||||||
_off64_t lf_start; /* Byte # of the start of the lock */
|
_off64_t lf_start; /* Byte # of the start of the lock */
|
||||||
_off64_t lf_end; /* Byte # of the end of the lock (-1=EOF) */
|
_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
|
long long lf_id; /* Cygwin PID for POSIX locks, a unique id per
|
||||||
file table entry for BSD flock locks. */
|
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 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 inode_t *lf_inode; /* Back pointer to the inode_t */
|
||||||
class lockf_t *lf_next; /* Pointer to the next lock on this 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 ()
|
lockf_t ()
|
||||||
: lf_flags (0), lf_type (0), lf_start (0), lf_end (0), lf_id (0),
|
: lf_flags (0), lf_type (0), lf_start (0), lf_end (0), lf_id (0),
|
||||||
|
@ -263,17 +263,17 @@ class inode_t
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LIST_ENTRY (inode_t) i_next;
|
LIST_ENTRY (inode_t) i_next;
|
||||||
lockf_t *i_lockf; /* List of locks of this process. */
|
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_all_lf; /* Temp list of all locks for this file. */
|
||||||
|
|
||||||
__dev32_t i_dev; /* Device ID */
|
__dev32_t i_dev; /* Device ID */
|
||||||
__ino64_t i_ino; /* inode number */
|
__ino64_t i_ino; /* inode number */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HANDLE i_dir;
|
HANDLE i_dir;
|
||||||
HANDLE i_mtx;
|
HANDLE i_mtx;
|
||||||
unsigned long i_wait; /* Number of blocked threads waiting for
|
unsigned long i_wait; /* Number of blocked threads waiting for
|
||||||
a blocking lock. */
|
a blocking lock. */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inode_t (__dev32_t dev, __ino64_t ino);
|
inode_t (__dev32_t dev, __ino64_t ino);
|
||||||
|
|
|
@ -368,7 +368,7 @@ frok::parent (volatile char * volatile stack_here)
|
||||||
in the child. */
|
in the child. */
|
||||||
PTEB teb = NtCurrentTeb ();
|
PTEB teb = NtCurrentTeb ();
|
||||||
if (!teb->DeallocationStack)
|
if (!teb->DeallocationStack)
|
||||||
{
|
{
|
||||||
/* Pthread with application-provided stack. Don't set up a
|
/* Pthread with application-provided stack. Don't set up a
|
||||||
PAGE_GUARD page. guardsize == -1 is used in alloc_stack_hard_way
|
PAGE_GUARD page. guardsize == -1 is used in alloc_stack_hard_way
|
||||||
to recognize this type of stack. */
|
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
|
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. */
|
a SEGV if some code erroneously tries to overwrite these strings. */
|
||||||
#define _ROU(_s) \
|
#define _ROU(_s) \
|
||||||
{ Length: sizeof (_s) - sizeof (WCHAR), \
|
{ Length: sizeof (_s) - sizeof (WCHAR), \
|
||||||
MaximumLength: sizeof (_s), \
|
MaximumLength: sizeof (_s), \
|
||||||
Buffer: (PWSTR) (_s) }
|
Buffer: (PWSTR) (_s) }
|
||||||
UNICODE_STRING _RDATA ro_u_empty = _ROU (L"");
|
UNICODE_STRING _RDATA ro_u_empty = _ROU (L"");
|
||||||
UNICODE_STRING _RDATA ro_u_lnk = _ROU (L".lnk");
|
UNICODE_STRING _RDATA ro_u_lnk = _ROU (L".lnk");
|
||||||
UNICODE_STRING _RDATA ro_u_exe = _ROU (L".exe");
|
UNICODE_STRING _RDATA ro_u_exe = _ROU (L".exe");
|
||||||
|
|
|
@ -76,7 +76,7 @@ heap_init ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Since VirtualAlloc only reserves at allocation granularity
|
/* 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. */
|
up at a bogus page-aligned address. */
|
||||||
start_address = roundup2 (start_address + mbi.RegionSize,
|
start_address = roundup2 (start_address + mbi.RegionSize,
|
||||||
wincap.allocation_granularity ());
|
wincap.allocation_granularity ());
|
||||||
|
|
|
@ -549,7 +549,7 @@ CygwinCreateThread (LPTHREAD_START_ROUTINE thread_func, PVOID thread_arg,
|
||||||
real_stacksize = roundup2 (real_stacksize,
|
real_stacksize = roundup2 (real_stacksize,
|
||||||
wincap.allocation_granularity ());
|
wincap.allocation_granularity ());
|
||||||
/* Reserve stack.
|
/* Reserve stack.
|
||||||
FIXME? If the TOP_DOWN method tends to collide too much with
|
FIXME? If the TOP_DOWN method tends to collide too much with
|
||||||
other stuff, we should provide our own mechanism to find a
|
other stuff, we should provide our own mechanism to find a
|
||||||
suitable place for the stack. Top down from the start of
|
suitable place for the stack. Top down from the start of
|
||||||
the Cygwin DLL comes to mind. */
|
the Cygwin DLL comes to mind. */
|
||||||
|
|
|
@ -222,7 +222,7 @@ MapView (HANDLE h, void *addr, size_t len, DWORD openflags,
|
||||||
SetLastError (RtlNtStatusToDosError (ret));
|
SetLastError (RtlNtStatusToDosError (ret));
|
||||||
}
|
}
|
||||||
debug_printf ("%p (status %p) = NtMapViewOfSection (h:%x, addr:%x, len:%u,"
|
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);
|
base, ret, h, addr, len, off, protect, 0);
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,8 @@ details. */
|
||||||
continue; \
|
continue; \
|
||||||
case MMAP_RAISE_SIGBUS: \
|
case MMAP_RAISE_SIGBUS: \
|
||||||
raise(SIGBUS); \
|
raise(SIGBUS); \
|
||||||
default: \
|
default: \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
|
|
|
@ -132,7 +132,7 @@ fs_info_cache::genhash (PFILE_FS_VOLUME_INFORMATION pffvi)
|
||||||
uint32_t hash = 0;
|
uint32_t hash = 0;
|
||||||
const uint16_t *p = (const uint16_t *) pffvi;
|
const uint16_t *p = (const uint16_t *) pffvi;
|
||||||
const uint16_t *end = (const uint16_t *)
|
const uint16_t *end = (const uint16_t *)
|
||||||
((const uint8_t *) p + sizeof *pffvi
|
((const uint8_t *) p + sizeof *pffvi
|
||||||
+ pffvi->VolumeLabelLength - sizeof (WCHAR));
|
+ pffvi->VolumeLabelLength - sizeof (WCHAR));
|
||||||
pffvi->__dummy = 0; /* This member can have random values! */
|
pffvi->__dummy = 0; /* This member can have random values! */
|
||||||
while (p < end)
|
while (p < end)
|
||||||
|
@ -193,14 +193,14 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
|
||||||
InitializeObjectAttributes (&attr, upath, OBJ_CASE_INSENSITIVE, NULL,
|
InitializeObjectAttributes (&attr, upath, OBJ_CASE_INSENSITIVE, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
/* Note: Don't use the FILE_OPEN_REPARSE_POINT flag here. The reason
|
/* 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. */
|
to the target of a volume mount point. */
|
||||||
status = NtOpenFile (&vol, access, &attr, &io, FILE_SHARE_VALID_FLAGS,
|
status = NtOpenFile (&vol, access, &attr, &io, FILE_SHARE_VALID_FLAGS,
|
||||||
FILE_OPEN_FOR_BACKUP_INTENT);
|
FILE_OPEN_FOR_BACKUP_INTENT);
|
||||||
/* At least one filesystem (HGFS, VMware shared folders) doesn't like
|
/* 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)
|
if (status == STATUS_INVALID_PARAMETER)
|
||||||
{
|
{
|
||||||
access |= FILE_READ_DATA;
|
access |= FILE_READ_DATA;
|
||||||
status = NtOpenFile (&vol, access, &attr, &io, FILE_SHARE_VALID_FLAGS,
|
status = NtOpenFile (&vol, access, &attr, &io, FILE_SHARE_VALID_FLAGS,
|
||||||
FILE_OPEN_FOR_BACKUP_INTENT);
|
FILE_OPEN_FOR_BACKUP_INTENT);
|
||||||
|
@ -405,7 +405,7 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
|
||||||
if (!got_fs ())
|
if (!got_fs ())
|
||||||
{
|
{
|
||||||
/* The filesystem name is only used in fillout_mntent and only if
|
/* 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,
|
sys_wcstombs (fsn, sizeof fsn, ffai_buf.ffai.FileSystemName,
|
||||||
ffai_buf.ffai.FileSystemNameLength / sizeof (WCHAR));
|
ffai_buf.ffai.FileSystemNameLength / sizeof (WCHAR));
|
||||||
strlwr (fsn);
|
strlwr (fsn);
|
||||||
|
@ -1083,7 +1083,7 @@ fstab_list_flags ()
|
||||||
{
|
{
|
||||||
char *bp = buf;
|
char *bp = buf;
|
||||||
for (o = oopts; o < (oopts + (sizeof (oopts) / sizeof (oopts[0]))); o++)
|
for (o = oopts; o < (oopts + (sizeof (oopts) / sizeof (oopts[0]))); o++)
|
||||||
{
|
{
|
||||||
bp = stpcpy (bp, o->name);
|
bp = stpcpy (bp, o->name);
|
||||||
*bp++ = ',';
|
*bp++ = ',';
|
||||||
}
|
}
|
||||||
|
|
|
@ -531,7 +531,7 @@ fdsock (cygheap_fdmanip& fd, const device *dev, SOCKET soc)
|
||||||
ret = WSAIoctl (soc, SIO_BASE_HANDLE, NULL, 0, (void *) &base_soc,
|
ret = WSAIoctl (soc, SIO_BASE_HANDLE, NULL, 0, (void *) &base_soc,
|
||||||
sizeof (base_soc), &bret, NULL, NULL);
|
sizeof (base_soc), &bret, NULL, NULL);
|
||||||
if (ret)
|
if (ret)
|
||||||
debug_printf ("WSAIoctl: %lu", WSAGetLastError ());
|
debug_printf ("WSAIoctl: %lu", WSAGetLastError ());
|
||||||
else if (base_soc != soc
|
else if (base_soc != soc
|
||||||
&& GetHandleInformation ((HANDLE) base_soc, &flags)
|
&& GetHandleInformation ((HANDLE) base_soc, &flags)
|
||||||
&& (flags & HANDLE_FLAG_INHERIT))
|
&& (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);
|
optname = convert_ws1_ip_optname (optname);
|
||||||
|
|
||||||
/* Per POSIX we must not be able to reuse a complete duplicate of a
|
/* 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
|
set. That's unfortunately possible in WinSock, and this has never
|
||||||
been changed to maintain backward compatibility. Instead, the
|
been changed to maintain backward compatibility. Instead, the
|
||||||
SO_EXCLUSIVEADDRUSE option has been added to allow an application to
|
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_KEEPALIVE:
|
||||||
case SO_DONTROUTE:
|
case SO_DONTROUTE:
|
||||||
/* Regression in Vista and later: instead of a 4 byte BOOL
|
/* 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
|
to older systems and the documentation. Since an int
|
||||||
type is expected by the calling application, we convert
|
type is expected by the calling application, we convert
|
||||||
the result here. */
|
the result here. */
|
||||||
|
|
|
@ -116,7 +116,7 @@ __get_lcid_from_locale (const char *name)
|
||||||
{ "tg-TJ" , L"tg-Cyrl-TJ" },
|
{ "tg-TJ" , L"tg-Cyrl-TJ" },
|
||||||
{ "tzm-DZ", L"tzm-Latn-DZ" },
|
{ "tzm-DZ", L"tzm-Latn-DZ" },
|
||||||
{ "uz-UZ" , L"uz-Latn-UZ" },
|
{ "uz-UZ" , L"uz-Latn-UZ" },
|
||||||
{ NULL , NULL }
|
{ NULL , NULL }
|
||||||
};
|
};
|
||||||
for (int i = 0; sc_only_locale[i].loc
|
for (int i = 0; sc_only_locale[i].loc
|
||||||
&& sc_only_locale[i].loc[0] <= locale[0]; ++i)
|
&& sc_only_locale[i].loc[0] <= locale[0]; ++i)
|
||||||
|
@ -197,8 +197,8 @@ __get_lcid_from_locale (const char *name)
|
||||||
LCID lcid;
|
LCID lcid;
|
||||||
} ambiguous_locale[] = {
|
} ambiguous_locale[] = {
|
||||||
{ "bs_BA", MAKELANGID (LANG_BOSNIAN, 0x05) },
|
{ "bs_BA", MAKELANGID (LANG_BOSNIAN, 0x05) },
|
||||||
{ "nn_NO", MAKELANGID (LANG_NORWEGIAN, SUBLANG_NORWEGIAN_NYNORSK) },
|
{ "nn_NO", MAKELANGID (LANG_NORWEGIAN, SUBLANG_NORWEGIAN_NYNORSK) },
|
||||||
{ "no_NO", MAKELANGID (LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL) },
|
{ "no_NO", MAKELANGID (LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL) },
|
||||||
{ "sr_BA", MAKELANGID (LANG_BOSNIAN,
|
{ "sr_BA", MAKELANGID (LANG_BOSNIAN,
|
||||||
SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC) },
|
SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC) },
|
||||||
{ "sr_CS", MAKELANGID (LANG_SERBIAN, SUBLANG_SERBIAN_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)
|
while (n > 0)
|
||||||
{
|
{
|
||||||
bytes = f_mbtowc (_REENT, pwcs, t, 6 /* fake, always enough */,
|
bytes = f_mbtowc (_REENT, pwcs, t, 6 /* fake, always enough */,
|
||||||
charset, &state);
|
charset, &state);
|
||||||
if (bytes == (size_t) -1)
|
if (bytes == (size_t) -1)
|
||||||
{
|
{
|
||||||
state.__count = 0;
|
state.__count = 0;
|
||||||
bytes = 1;
|
bytes = 1;
|
||||||
if (pwcs)
|
if (pwcs)
|
||||||
*pwcs = L' ';
|
*pwcs = L' ';
|
||||||
}
|
}
|
||||||
else if (bytes == 0)
|
else if (bytes == 0)
|
||||||
break;
|
break;
|
||||||
t += bytes;
|
t += bytes;
|
||||||
++ret;
|
++ret;
|
||||||
if (pwcs)
|
if (pwcs)
|
||||||
|
@ -477,10 +477,10 @@ conv_grouping (LCID lcid, LCTYPE type, char **lc_ptr)
|
||||||
for (char *c = buf; *c; ++c)
|
for (char *c = buf; *c; ++c)
|
||||||
{
|
{
|
||||||
if (*c < '0' || *c > '9')
|
if (*c < '0' || *c > '9')
|
||||||
continue;
|
continue;
|
||||||
char val = *c - '0';
|
char val = *c - '0';
|
||||||
if (!val)
|
if (!val)
|
||||||
{
|
{
|
||||||
repeat = true;
|
repeat = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -559,7 +559,7 @@ __set_lc_time_from_win (const char *name,
|
||||||
The workaround is to use LOCALE_SMONTHNAME* in these locales,
|
The workaround is to use LOCALE_SMONTHNAME* in these locales,
|
||||||
even for the abbreviated month name. */
|
even for the abbreviated month name. */
|
||||||
const LCTYPE mon_base =
|
const LCTYPE mon_base =
|
||||||
lcid == MAKELANGID (LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN)
|
lcid == MAKELANGID (LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN)
|
||||||
|| lcid == MAKELANGID (LANG_KOREAN, SUBLANG_KOREAN)
|
|| lcid == MAKELANGID (LANG_KOREAN, SUBLANG_KOREAN)
|
||||||
? LOCALE_SMONTHNAME1 : LOCALE_SABBREVMONTHNAME1;
|
? LOCALE_SMONTHNAME1 : LOCALE_SABBREVMONTHNAME1;
|
||||||
for (int i = 0; i < 12; ++i)
|
for (int i = 0; i < 12; ++i)
|
||||||
|
@ -816,7 +816,7 @@ __set_lc_ctype_from_win (const char *name,
|
||||||
}
|
}
|
||||||
|
|
||||||
char *tmp = (char *) realloc (new_lc_ctype_buf,
|
char *tmp = (char *) realloc (new_lc_ctype_buf,
|
||||||
lc_ctype_ptr - new_lc_ctype_buf);
|
lc_ctype_ptr - new_lc_ctype_buf);
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
{
|
{
|
||||||
free (new_lc_ctype_buf);
|
free (new_lc_ctype_buf);
|
||||||
|
@ -876,7 +876,7 @@ __set_lc_numeric_from_win (const char *name,
|
||||||
lc_numeric_ptr = stpcpy (lc_numeric_ptr, charset) + 1;
|
lc_numeric_ptr = stpcpy (lc_numeric_ptr, charset) + 1;
|
||||||
|
|
||||||
char *tmp = (char *) realloc (new_lc_numeric_buf,
|
char *tmp = (char *) realloc (new_lc_numeric_buf,
|
||||||
lc_numeric_ptr - new_lc_numeric_buf);
|
lc_numeric_ptr - new_lc_numeric_buf);
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
{
|
{
|
||||||
free (new_lc_numeric_buf);
|
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;
|
lc_monetary_ptr = stpcpy (lc_monetary_ptr, charset) + 1;
|
||||||
|
|
||||||
char *tmp = (char *) realloc (new_lc_monetary_buf,
|
char *tmp = (char *) realloc (new_lc_monetary_buf,
|
||||||
lc_monetary_ptr - new_lc_monetary_buf);
|
lc_monetary_ptr - new_lc_monetary_buf);
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
{
|
{
|
||||||
free (new_lc_monetary_buf);
|
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 == 0x241a /* sr_RS (Serbian Language/Serbia) */
|
||||||
|| lcid == 0x2c1a /* sr_ME (Serbian Language/Montenegro)*/
|
|| lcid == 0x2c1a /* sr_ME (Serbian Language/Montenegro)*/
|
||||||
|| lcid == 0x0442) /* tk_TM (Turkmen/Turkmenistan) */
|
|| lcid == 0x0442) /* tk_TM (Turkmen/Turkmenistan) */
|
||||||
cs = "UTF-8";
|
cs = "UTF-8";
|
||||||
else if (lcid == 0x041c) /* sq_AL (Albanian/Albania) */
|
else if (lcid == 0x041c) /* sq_AL (Albanian/Albania) */
|
||||||
cs = "ISO-8859-1";
|
cs = "ISO-8859-1";
|
||||||
else
|
else
|
||||||
|
@ -1317,11 +1317,11 @@ __set_charset_from_locale (const char *locale, char *charset)
|
||||||
IQTElif alphabet */
|
IQTElif alphabet */
|
||||||
|| (lcid == 0x0444 && has_modifier ("@iqtelif"))
|
|| (lcid == 0x0444 && has_modifier ("@iqtelif"))
|
||||||
|| lcid == 0x0450) /* mn_MN (Mongolian/Mongolia) */
|
|| lcid == 0x0450) /* mn_MN (Mongolian/Mongolia) */
|
||||||
cs = "UTF-8";
|
cs = "UTF-8";
|
||||||
else if (lcid == 0x0423) /* be_BY (Belarusian/Belarus) */
|
else if (lcid == 0x0423) /* be_BY (Belarusian/Belarus) */
|
||||||
cs = has_modifier ("@latin") ? "UTF-8" : "CP1251";
|
cs = has_modifier ("@latin") ? "UTF-8" : "CP1251";
|
||||||
else if (lcid == 0x0402) /* bg_BG (Bulgarian/Bulgaria) */
|
else if (lcid == 0x0402) /* bg_BG (Bulgarian/Bulgaria) */
|
||||||
cs = "CP1251";
|
cs = "CP1251";
|
||||||
else if (lcid == 0x0422) /* uk_UA (Ukrainian/Ukraine) */
|
else if (lcid == 0x0422) /* uk_UA (Ukrainian/Ukraine) */
|
||||||
cs = "KOI8-U";
|
cs = "KOI8-U";
|
||||||
else
|
else
|
||||||
|
@ -1342,7 +1342,7 @@ __set_charset_from_locale (const char *locale, char *charset)
|
||||||
|| lcid == 0x0488 /* wo_SN (Wolof/Senegal) */
|
|| lcid == 0x0488 /* wo_SN (Wolof/Senegal) */
|
||||||
|| lcid == 0x046a /* yo_NG (Yoruba/Nigeria) */
|
|| lcid == 0x046a /* yo_NG (Yoruba/Nigeria) */
|
||||||
|| lcid == 0x085d) /* iu_CA (Inuktitut/Canada) */
|
|| lcid == 0x085d) /* iu_CA (Inuktitut/Canada) */
|
||||||
cs = "UTF-8";
|
cs = "UTF-8";
|
||||||
else if (lcid == 0x042e) /* hsb_DE (Upper Sorbian/Germany) */
|
else if (lcid == 0x042e) /* hsb_DE (Upper Sorbian/Germany) */
|
||||||
cs = "ISO-8859-2";
|
cs = "ISO-8859-2";
|
||||||
else if (lcid == 0x0491 /* gd_GB (Scots Gaelic/Great Britain) */
|
else if (lcid == 0x0491 /* gd_GB (Scots Gaelic/Great Britain) */
|
||||||
|
@ -1358,7 +1358,7 @@ __set_charset_from_locale (const char *locale, char *charset)
|
||||||
break;
|
break;
|
||||||
case 1254:
|
case 1254:
|
||||||
if (lcid == 0x042c) /* az_AZ (Azeri/Azerbaijan) */
|
if (lcid == 0x042c) /* az_AZ (Azeri/Azerbaijan) */
|
||||||
cs = "UTF-8";
|
cs = "UTF-8";
|
||||||
else if (lcid == 0x0443) /* uz_UZ (Uzbek/Uzbekistan) */
|
else if (lcid == 0x0443) /* uz_UZ (Uzbek/Uzbekistan) */
|
||||||
cs = "ISO-8859-1";
|
cs = "ISO-8859-1";
|
||||||
else
|
else
|
||||||
|
|
|
@ -1204,7 +1204,7 @@ extern "C"
|
||||||
BOOLEAN);
|
BOOLEAN);
|
||||||
NTSTATUS NTAPI RtlConvertSidToUnicodeString (PUNICODE_STRING, PSID, BOOLEAN);
|
NTSTATUS NTAPI RtlConvertSidToUnicodeString (PUNICODE_STRING, PSID, BOOLEAN);
|
||||||
NTSTATUS NTAPI RtlConvertToAutoInheritSecurityObject (PSECURITY_DESCRIPTOR,
|
NTSTATUS NTAPI RtlConvertToAutoInheritSecurityObject (PSECURITY_DESCRIPTOR,
|
||||||
PSECURITY_DESCRIPTOR,
|
PSECURITY_DESCRIPTOR,
|
||||||
PSECURITY_DESCRIPTOR *,
|
PSECURITY_DESCRIPTOR *,
|
||||||
GUID *, BOOLEAN,
|
GUID *, BOOLEAN,
|
||||||
PGENERIC_MAPPING);
|
PGENERIC_MAPPING);
|
||||||
|
@ -1237,9 +1237,9 @@ extern "C"
|
||||||
NTSTATUS NTAPI RtlGetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR, PBOOLEAN,
|
NTSTATUS NTAPI RtlGetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR, PBOOLEAN,
|
||||||
PACL *, PBOOLEAN);
|
PACL *, PBOOLEAN);
|
||||||
NTSTATUS NTAPI RtlGetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID *,
|
NTSTATUS NTAPI RtlGetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID *,
|
||||||
PBOOLEAN);
|
PBOOLEAN);
|
||||||
NTSTATUS NTAPI RtlGetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID *,
|
NTSTATUS NTAPI RtlGetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID *,
|
||||||
PBOOLEAN);
|
PBOOLEAN);
|
||||||
PSID_IDENTIFIER_AUTHORITY NTAPI RtlIdentifierAuthoritySid (PSID);
|
PSID_IDENTIFIER_AUTHORITY NTAPI RtlIdentifierAuthoritySid (PSID);
|
||||||
VOID NTAPI RtlInitEmptyUnicodeString (PUNICODE_STRING, PCWSTR, USHORT);
|
VOID NTAPI RtlInitEmptyUnicodeString (PUNICODE_STRING, PCWSTR, USHORT);
|
||||||
NTSTATUS NTAPI RtlInitializeSid (PSID, PSID_IDENTIFIER_AUTHORITY, UCHAR);
|
NTSTATUS NTAPI RtlInitializeSid (PSID, PSID_IDENTIFIER_AUTHORITY, UCHAR);
|
||||||
|
@ -1268,9 +1268,9 @@ extern "C"
|
||||||
NTSTATUS NTAPI RtlSetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR, BOOLEAN,
|
NTSTATUS NTAPI RtlSetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR, BOOLEAN,
|
||||||
PACL, BOOLEAN);
|
PACL, BOOLEAN);
|
||||||
NTSTATUS NTAPI RtlSetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID,
|
NTSTATUS NTAPI RtlSetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID,
|
||||||
BOOLEAN);
|
BOOLEAN);
|
||||||
NTSTATUS NTAPI RtlSetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID,
|
NTSTATUS NTAPI RtlSetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID,
|
||||||
BOOLEAN);
|
BOOLEAN);
|
||||||
PUCHAR NTAPI RtlSubAuthorityCountSid (PSID);
|
PUCHAR NTAPI RtlSubAuthorityCountSid (PSID);
|
||||||
PULONG NTAPI RtlSubAuthoritySid (PSID, ULONG);
|
PULONG NTAPI RtlSubAuthoritySid (PSID, ULONG);
|
||||||
NTSTATUS NTAPI RtlUnicodeStringToAnsiString (PANSI_STRING, PUNICODE_STRING,
|
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;
|
size_t nlen;
|
||||||
|
|
||||||
/* For compatibility with Linux, we only allow user xattrs and
|
/* For compatibility with Linux, we only allow user xattrs and
|
||||||
return EOPNOTSUPP otherwise. */
|
return EOPNOTSUPP otherwise. */
|
||||||
if (ascii_strncasematch (name, "user.", 5))
|
if (ascii_strncasematch (name, "user.", 5))
|
||||||
name += 5;
|
name += 5;
|
||||||
else
|
else
|
||||||
|
|
|
@ -427,7 +427,7 @@ get_nt_native_path (const char *path, UNICODE_STRING& upath, bool dos)
|
||||||
if (dos)
|
if (dos)
|
||||||
{
|
{
|
||||||
/* Unfortunately we can't just use transform_chars with the tfx_rev_chars
|
/* 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.
|
So we step to every backslash and fix surrounding dots and spaces.
|
||||||
That makes these broken filesystems a bit slower, but, hey. */
|
That makes these broken filesystems a bit slower, but, hey. */
|
||||||
PWCHAR cp = upath.Buffer + 7;
|
PWCHAR cp = upath.Buffer + 7;
|
||||||
|
@ -442,7 +442,7 @@ get_nt_native_path (const char *path, UNICODE_STRING& upath, bool dos)
|
||||||
*++cp |= 0xf000;
|
*++cp |= 0xf000;
|
||||||
}
|
}
|
||||||
while (*--cp == L'.' || *cp == L' ')
|
while (*--cp == L'.' || *cp == L' ')
|
||||||
*cp |= 0xf000;
|
*cp |= 0xf000;
|
||||||
}
|
}
|
||||||
return &upath;
|
return &upath;
|
||||||
}
|
}
|
||||||
|
@ -917,7 +917,7 @@ is_virtual_symlink:
|
||||||
information any longer. */
|
information any longer. */
|
||||||
fs.clear ();
|
fs.clear ();
|
||||||
/* Close handle, if we have any. Otherwise we're collecting
|
/* Close handle, if we have any. Otherwise we're collecting
|
||||||
handles while following symlinks. */
|
handles while following symlinks. */
|
||||||
conv_handle.close ();
|
conv_handle.close ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1020,7 +1020,7 @@ out:
|
||||||
else if (isproc_dev (dev) && fileattr == INVALID_FILE_ATTRIBUTES)
|
else if (isproc_dev (dev) && fileattr == INVALID_FILE_ATTRIBUTES)
|
||||||
{
|
{
|
||||||
/* FIXME: Usually we don't set error to ENOENT if a file doesn't
|
/* 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
|
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
|
an error for these paths so it reports the error back to the
|
||||||
application. Unlike in all other cases of non-existant files,
|
application. Unlike in all other cases of non-existant files,
|
||||||
|
@ -1855,7 +1855,7 @@ symlink_info::check_sysfile (HANDLE h)
|
||||||
pflags |= PATH_SYMLINK;
|
pflags |= PATH_SYMLINK;
|
||||||
interix_symlink = true;
|
interix_symlink = true;
|
||||||
/* Interix symlink cookies are shorter than Cygwin symlink cookies, so
|
/* 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. */
|
file. Set file pointer back to the position right after the cookie. */
|
||||||
off.QuadPart = sizeof (INTERIX_SYMLINK_COOKIE) - 1;
|
off.QuadPart = sizeof (INTERIX_SYMLINK_COOKIE) - 1;
|
||||||
}
|
}
|
||||||
|
@ -2358,7 +2358,7 @@ restart:
|
||||||
if (!restarted && !*ext_here && !(pflags & PATH_DOS) && !fs.inited ())
|
if (!restarted && !*ext_here && !(pflags & PATH_DOS) && !fs.inited ())
|
||||||
{
|
{
|
||||||
/* Check for trailing dot or space or leading space in
|
/* Check for trailing dot or space or leading space in
|
||||||
last component. */
|
last component. */
|
||||||
char *p = ext_here - 1;
|
char *p = ext_here - 1;
|
||||||
if (*p != '.' && *p != ' ')
|
if (*p != '.' && *p != ' ')
|
||||||
{
|
{
|
||||||
|
@ -2376,7 +2376,7 @@ restart:
|
||||||
if (fs.has_dos_filenames_only ())
|
if (fs.has_dos_filenames_only ())
|
||||||
{
|
{
|
||||||
/* If so, try again. Since we now know the FS, the
|
/* 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. */
|
third parameter in the call to get_nt_native_path. */
|
||||||
pflags |= PATH_DOS;
|
pflags |= PATH_DOS;
|
||||||
restarted = true;
|
restarted = true;
|
||||||
|
@ -2532,7 +2532,7 @@ restart:
|
||||||
fileattr = fdi_buf.fdi.FileAttributes;
|
fileattr = fdi_buf.fdi.FileAttributes;
|
||||||
memcpy (pfnoi, &fdi_buf.fdi.CreationTime, sizeof *pfnoi);
|
memcpy (pfnoi, &fdi_buf.fdi.CreationTime, sizeof *pfnoi);
|
||||||
/* Amazing, but true: The FILE_NETWORK_OPEN_INFORMATION
|
/* 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
|
interchanged relative to the directory information
|
||||||
classes. */
|
classes. */
|
||||||
pfnoi->AllocationSize.QuadPart
|
pfnoi->AllocationSize.QuadPart
|
||||||
|
@ -2550,7 +2550,7 @@ restart:
|
||||||
|
|
||||||
ext_tacked_on = !!*ext_here;
|
ext_tacked_on = !!*ext_here;
|
||||||
/* Don't allow to returns directories with appended suffix. If we found
|
/* 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
|
directory doesn't match the request. So, just do as usual if file
|
||||||
hasn't been found. */
|
hasn't been found. */
|
||||||
if (ext_tacked_on && !had_ext && (fileattr & FILE_ATTRIBUTE_DIRECTORY))
|
if (ext_tacked_on && !had_ext && (fileattr & FILE_ATTRIBUTE_DIRECTORY))
|
||||||
|
@ -2586,7 +2586,7 @@ restart:
|
||||||
handle without FILE_OPEN_REPARSE_POINT. */
|
handle without FILE_OPEN_REPARSE_POINT. */
|
||||||
fs.update (&upath, NULL);
|
fs.update (&upath, NULL);
|
||||||
/* Make sure the open handle is not used in later stat calls.
|
/* 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
|
flag, so it's a handle to the reparse point, not a handle
|
||||||
to the volumes root dir. */
|
to the volumes root dir. */
|
||||||
pflags &= ~PC_KEEP_HANDLE;
|
pflags &= ~PC_KEEP_HANDLE;
|
||||||
|
@ -2636,7 +2636,7 @@ restart:
|
||||||
/* If searching for `foo' and then finding a `foo.lnk' which is
|
/* If searching for `foo' and then finding a `foo.lnk' which is
|
||||||
no shortcut, return the same as if file not found. */
|
no shortcut, return the same as if file not found. */
|
||||||
else if (suffix.lnk_match () && ext_tacked_on)
|
else if (suffix.lnk_match () && ext_tacked_on)
|
||||||
{
|
{
|
||||||
fileattr = INVALID_FILE_ATTRIBUTES;
|
fileattr = INVALID_FILE_ATTRIBUTES;
|
||||||
set_error (ENOENT);
|
set_error (ENOENT);
|
||||||
continue;
|
continue;
|
||||||
|
@ -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. */
|
/* TODO: Same ".\\" band-aid as in CCP_POSIX_TO_WIN_A case. */
|
||||||
if (relative && !strcmp ((const char *) from, ".")
|
if (relative && !strcmp ((const char *) from, ".")
|
||||||
&& !wcscmp (path, L".\\"))
|
&& !wcscmp (path, L".\\"))
|
||||||
{
|
{
|
||||||
lsiz = 2;
|
lsiz = 2;
|
||||||
path[1] = L'\0';
|
path[1] = L'\0';
|
||||||
}
|
}
|
||||||
|
@ -3760,7 +3760,7 @@ cwdstuff::override_win32_cwd (bool init, ULONG old_dismount_count)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* This method is used for all pre-Vista OSes. We simply set the values
|
/* 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
|
under PEB lock condition. This is how RtlSetCurrentDirectory_U worked
|
||||||
in these older OSes, so we're safe.
|
in these older OSes, so we're safe.
|
||||||
|
|
||||||
|
@ -3884,7 +3884,7 @@ cwdstuff::set (path_conv *nat_cwd, const char *posix_cwd)
|
||||||
nat_cwd->objcaseinsensitive () | OBJ_INHERIT,
|
nat_cwd->objcaseinsensitive () | OBJ_INHERIT,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
/* First try without FILE_OPEN_FOR_BACKUP_INTENT, to find out if the
|
/* 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
|
SetCurrentDirectory here, since that would potentially break
|
||||||
case-sensitivity. */
|
case-sensitivity. */
|
||||||
status = NtOpenFile (&h, SYNCHRONIZE | FILE_TRAVERSE, &attr, &io,
|
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_DIRECTORY_FILE
|
||||||
| FILE_SYNCHRONOUS_IO_NONALERT);
|
| FILE_SYNCHRONOUS_IO_NONALERT);
|
||||||
if (status == STATUS_ACCESS_DENIED)
|
if (status == STATUS_ACCESS_DENIED)
|
||||||
{
|
{
|
||||||
status = NtOpenFile (&h, SYNCHRONIZE | FILE_TRAVERSE, &attr, &io,
|
status = NtOpenFile (&h, SYNCHRONIZE | FILE_TRAVERSE, &attr, &io,
|
||||||
FILE_SHARE_VALID_FLAGS,
|
FILE_SHARE_VALID_FLAGS,
|
||||||
FILE_DIRECTORY_FILE
|
FILE_DIRECTORY_FILE
|
||||||
|
@ -3955,7 +3955,7 @@ cwdstuff::set (path_conv *nat_cwd, const char *posix_cwd)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Path via native NT namespace. Prepend GLOBALROOT prefix
|
/* 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
|
PWCHAR buf = (PWCHAR) alloca (upath.Length
|
||||||
+ ro_u_globalroot.Length
|
+ ro_u_globalroot.Length
|
||||||
+ sizeof (WCHAR));
|
+ sizeof (WCHAR));
|
||||||
|
|
|
@ -224,7 +224,7 @@ restart1:
|
||||||
break;
|
break;
|
||||||
case WAIT_OBJECT_0 + 2:
|
case WAIT_OBJECT_0 + 2:
|
||||||
if (timer_idx != 2)
|
if (timer_idx != 2)
|
||||||
pthread::static_cancel_self ();
|
pthread::static_cancel_self ();
|
||||||
/*FALLTHRU*/
|
/*FALLTHRU*/
|
||||||
case WAIT_OBJECT_0 + 3:
|
case WAIT_OBJECT_0 + 3:
|
||||||
ret = ETIMEDOUT;
|
ret = ETIMEDOUT;
|
||||||
|
@ -587,7 +587,7 @@ err:
|
||||||
if (mqinfo)
|
if (mqinfo)
|
||||||
{
|
{
|
||||||
if (mqinfo->mqi_lock)
|
if (mqinfo->mqi_lock)
|
||||||
ipc_mutex_close (mqinfo->mqi_lock);
|
ipc_mutex_close (mqinfo->mqi_lock);
|
||||||
if (mqinfo->mqi_waitsend)
|
if (mqinfo->mqi_waitsend)
|
||||||
ipc_cond_close (mqinfo->mqi_waitsend);
|
ipc_cond_close (mqinfo->mqi_waitsend);
|
||||||
if (mqinfo->mqi_waitrecv)
|
if (mqinfo->mqi_waitrecv)
|
||||||
|
|
|
@ -227,7 +227,7 @@ do_pseudo_reloc (void * start, void * end, void * base)
|
||||||
runtime_pseudo_reloc_item_v1 * o;
|
runtime_pseudo_reloc_item_v1 * o;
|
||||||
for (o = (runtime_pseudo_reloc_item_v1 *) v2_hdr;
|
for (o = (runtime_pseudo_reloc_item_v1 *) v2_hdr;
|
||||||
o < (runtime_pseudo_reloc_item_v1 *)end;
|
o < (runtime_pseudo_reloc_item_v1 *)end;
|
||||||
o++)
|
o++)
|
||||||
{
|
{
|
||||||
DWORD newval;
|
DWORD newval;
|
||||||
reloc_target = (ptrdiff_t) base + o->target;
|
reloc_target = (ptrdiff_t) base + o->target;
|
||||||
|
@ -272,7 +272,7 @@ do_pseudo_reloc (void * start, void * end, void * base)
|
||||||
* supported.
|
* supported.
|
||||||
*/
|
*/
|
||||||
switch ((r->flags & 0xff))
|
switch ((r->flags & 0xff))
|
||||||
{
|
{
|
||||||
case 8:
|
case 8:
|
||||||
reldata = (ptrdiff_t) (*((unsigned char *)reloc_target));
|
reldata = (ptrdiff_t) (*((unsigned char *)reloc_target));
|
||||||
if ((reldata & 0x80) != 0)
|
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",
|
__report_error (" Unknown pseudo relocation bit size %d.\n",
|
||||||
(int) (r->flags & 0xff));
|
(int) (r->flags & 0xff));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adjust the relocation value */
|
/* Adjust the relocation value */
|
||||||
reldata -= ((ptrdiff_t) base + r->sym);
|
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);
|
wcpncpy (dst, def, max);
|
||||||
else
|
else
|
||||||
wcpncpy (dst, (PWCHAR) vbuf->Data, max);
|
wcpncpy (dst, (PWCHAR) vbuf->Data, max);
|
||||||
|
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ open_local_policy (ACCESS_MASK access)
|
||||||
{
|
{
|
||||||
__seterrno_from_nt_status (status);
|
__seterrno_from_nt_status (status);
|
||||||
/* Some versions of Windows set the lsa handle to NULL when
|
/* Some versions of Windows set the lsa handle to NULL when
|
||||||
LsaOpenPolicy fails. */
|
LsaOpenPolicy fails. */
|
||||||
lsa = INVALID_HANDLE_VALUE;
|
lsa = INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
return lsa;
|
return lsa;
|
||||||
|
@ -340,7 +340,7 @@ get_user_local_groups (PWCHAR logonserver, PWCHAR domain,
|
||||||
if (!bg_ptr)
|
if (!bg_ptr)
|
||||||
{
|
{
|
||||||
/* Retrieve name of builtin group from system since it's
|
/* Retrieve name of builtin group from system since it's
|
||||||
localized. */
|
localized. */
|
||||||
glen = 2 * GNLEN + 2;
|
glen = 2 * GNLEN + 2;
|
||||||
if (!LookupAccountSidW (NULL, well_known_builtin_sid,
|
if (!LookupAccountSidW (NULL, well_known_builtin_sid,
|
||||||
builtin_grp, &glen, domain, &domlen, &use))
|
builtin_grp, &glen, domain, &domlen, &use))
|
||||||
|
@ -552,7 +552,7 @@ get_system_priv_list (size_t &size)
|
||||||
{
|
{
|
||||||
ULONG max_idx = 0;
|
ULONG max_idx = 0;
|
||||||
while (max_idx < SYSTEM_PRIVILEGES_COUNT
|
while (max_idx < SYSTEM_PRIVILEGES_COUNT
|
||||||
&& sys_privs[max_idx] != wincap.max_sys_priv ())
|
&& sys_privs[max_idx] != wincap.max_sys_priv ())
|
||||||
++max_idx;
|
++max_idx;
|
||||||
if (max_idx >= SYSTEM_PRIVILEGES_COUNT)
|
if (max_idx >= SYSTEM_PRIVILEGES_COUNT)
|
||||||
api_fatal ("Coding error: wincap privilege %u doesn't exist in sys_privs",
|
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,
|
pc.get_object_attr (attr, sec_none_nih), &io,
|
||||||
FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT);
|
FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
{
|
{
|
||||||
sd.free ();
|
sd.free ();
|
||||||
__seterrno_from_nt_status (status);
|
__seterrno_from_nt_status (status);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -167,7 +167,7 @@ get_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* ... and create a new security descriptor in which all inherited ACEs
|
/* ... 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
|
undocumented RtlConvertToAutoInheritSecurityObject function from
|
||||||
ntdll.dll see the MSDN man page for the advapi32 function
|
ntdll.dll see the MSDN man page for the advapi32 function
|
||||||
ConvertToAutoInheritPrivateObjectSecurity. Fortunately the latter
|
ConvertToAutoInheritPrivateObjectSecurity. Fortunately the latter
|
||||||
|
@ -182,7 +182,7 @@ get_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Eventually copy the new security descriptor into sd and delete the
|
/* 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. */
|
the heap. */
|
||||||
len = RtlLengthSecurityDescriptor (nsd);
|
len = RtlLengthSecurityDescriptor (nsd);
|
||||||
memcpy ((PSECURITY_DESCRIPTOR) sd, nsd, len);
|
memcpy ((PSECURITY_DESCRIPTOR) sd, nsd, len);
|
||||||
|
@ -989,12 +989,12 @@ check_access (security_descriptor &sd, GENERIC_MAPPING &mapping,
|
||||||
if (!tok)
|
if (!tok)
|
||||||
{
|
{
|
||||||
if (!DuplicateTokenEx (hProcToken, MAXIMUM_ALLOWED, NULL,
|
if (!DuplicateTokenEx (hProcToken, MAXIMUM_ALLOWED, NULL,
|
||||||
SecurityImpersonation, TokenImpersonation,
|
SecurityImpersonation, TokenImpersonation,
|
||||||
&hProcImpToken))
|
&hProcImpToken))
|
||||||
{
|
{
|
||||||
__seterrno ();
|
__seterrno ();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
tok = hProcImpToken;
|
tok = hProcImpToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,34 +101,34 @@ nanosleep (const struct timespec *rqtp, struct timespec *rmtp)
|
||||||
while (!done)
|
while (!done)
|
||||||
{
|
{
|
||||||
/* Divide user's input into transactions no larger than 49.7
|
/* 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)
|
if (sec > HIRES_DELAY_MAX / 1000)
|
||||||
{
|
{
|
||||||
req = ((HIRES_DELAY_MAX + resolution - 1)
|
req = ((HIRES_DELAY_MAX + resolution - 1)
|
||||||
/ resolution * resolution);
|
/ resolution * resolution);
|
||||||
sec -= HIRES_DELAY_MAX / 1000;
|
sec -= HIRES_DELAY_MAX / 1000;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
req = ((sec * 1000 + (rqtp->tv_nsec + 999999) / 1000000
|
req = ((sec * 1000 + (rqtp->tv_nsec + 999999) / 1000000
|
||||||
+ resolution - 1) / resolution) * resolution;
|
+ resolution - 1) / resolution) * resolution;
|
||||||
sec = 0;
|
sec = 0;
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD end_time = gtod.dmsecs () + req;
|
DWORD end_time = gtod.dmsecs () + req;
|
||||||
syscall_printf ("nanosleep (%ld)", req);
|
syscall_printf ("nanosleep (%ld)", req);
|
||||||
|
|
||||||
int rc = cancelable_wait (signal_arrived, req);
|
int rc = cancelable_wait (signal_arrived, req);
|
||||||
if ((rem = end_time - gtod.dmsecs ()) > HIRES_DELAY_MAX)
|
if ((rem = end_time - gtod.dmsecs ()) > HIRES_DELAY_MAX)
|
||||||
rem = 0;
|
rem = 0;
|
||||||
if (rc == WAIT_OBJECT_0)
|
if (rc == WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
_my_tls.call_signal_handler ();
|
_my_tls.call_signal_handler ();
|
||||||
set_errno (EINTR);
|
set_errno (EINTR);
|
||||||
res = -1;
|
res = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rmtp)
|
if (rmtp)
|
||||||
|
@ -136,14 +136,14 @@ nanosleep (const struct timespec *rqtp, struct timespec *rmtp)
|
||||||
rmtp->tv_sec = sec + rem / 1000;
|
rmtp->tv_sec = sec + rem / 1000;
|
||||||
rmtp->tv_nsec = (rem % 1000) * 1000000;
|
rmtp->tv_nsec = (rem % 1000) * 1000000;
|
||||||
if (sec)
|
if (sec)
|
||||||
{
|
{
|
||||||
rmtp->tv_nsec += rqtp->tv_nsec;
|
rmtp->tv_nsec += rqtp->tv_nsec;
|
||||||
if (rmtp->tv_nsec >= 1000000000)
|
if (rmtp->tv_nsec >= 1000000000)
|
||||||
{
|
{
|
||||||
rmtp->tv_nsec -= 1000000000;
|
rmtp->tv_nsec -= 1000000000;
|
||||||
rmtp->tv_sec++;
|
rmtp->tv_sec++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
syscall_printf ("%d = nanosleep (%ld, %ld)", res, req, rem);
|
syscall_printf ("%d = nanosleep (%ld, %ld)", res, req, rem);
|
||||||
|
|
|
@ -190,7 +190,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
|
||||||
if (l_opt && ((*(unsigned char *)s <= 0x1f && *s != '\n')
|
if (l_opt && ((*(unsigned char *)s <= 0x1f && *s != '\n')
|
||||||
|| *(unsigned char *)s >= 0x7f))
|
|| *(unsigned char *)s >= 0x7f))
|
||||||
{
|
{
|
||||||
*dst++ = '\\';
|
*dst++ = '\\';
|
||||||
*dst++ = 'x';
|
*dst++ = 'x';
|
||||||
*dst++ = hex_str[*(unsigned char *)s >> 4];
|
*dst++ = hex_str[*(unsigned char *)s >> 4];
|
||||||
*dst++ = hex_str[*(unsigned char *)s++ & 0xf];
|
*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 ());
|
real_path.get_nt_native_path ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
set_errno (ENAMETOOLONG);
|
set_errno (ENAMETOOLONG);
|
||||||
res = -1;
|
res = -1;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -25,7 +25,7 @@ details. */
|
||||||
is affected as well, but we can't transform it as long as we accept Win32
|
is affected as well, but we can't transform it as long as we accept Win32
|
||||||
paths as input. */
|
paths as input. */
|
||||||
static const WCHAR tfx_chars[] = {
|
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 | 4, 0xf000 | 5, 0xf000 | 6, 0xf000 | 7,
|
||||||
0xf000 | 8, 0xf000 | 9, 0xf000 | 10, 0xf000 | 11,
|
0xf000 | 8, 0xf000 | 9, 0xf000 | 10, 0xf000 | 11,
|
||||||
0xf000 | 12, 0xf000 | 13, 0xf000 | 14, 0xf000 | 15,
|
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 | 20, 0xf000 | 21, 0xf000 | 22, 0xf000 | 23,
|
||||||
0xf000 | 24, 0xf000 | 25, 0xf000 | 26, 0xf000 | 27,
|
0xf000 | 24, 0xf000 | 25, 0xf000 | 26, 0xf000 | 27,
|
||||||
0xf000 | 28, 0xf000 | 29, 0xf000 | 30, 0xf000 | 31,
|
0xf000 | 28, 0xf000 | 29, 0xf000 | 30, 0xf000 | 31,
|
||||||
' ', '!', 0xf000 | '"', '#',
|
' ', '!', 0xf000 | '"', '#',
|
||||||
'$', '%', '&', 39,
|
'$', '%', '&', 39,
|
||||||
'(', ')', 0xf000 | '*', '+',
|
'(', ')', 0xf000 | '*', '+',
|
||||||
',', '-', '.', '\\',
|
',', '-', '.', '\\',
|
||||||
'0', '1', '2', '3',
|
'0', '1', '2', '3',
|
||||||
'4', '5', '6', '7',
|
'4', '5', '6', '7',
|
||||||
'8', '9', 0xf000 | ':', ';',
|
'8', '9', 0xf000 | ':', ';',
|
||||||
0xf000 | '<', '=', 0xf000 | '>', 0xf000 | '?',
|
0xf000 | '<', '=', 0xf000 | '>', 0xf000 | '?',
|
||||||
'@', 'A', 'B', 'C',
|
'@', 'A', 'B', 'C',
|
||||||
'D', 'E', 'F', 'G',
|
'D', 'E', 'F', 'G',
|
||||||
'H', 'I', 'J', 'K',
|
'H', 'I', 'J', 'K',
|
||||||
'L', 'M', 'N', 'O',
|
'L', 'M', 'N', 'O',
|
||||||
'P', 'Q', 'R', 'S',
|
'P', 'Q', 'R', 'S',
|
||||||
'T', 'U', 'V', 'W',
|
'T', 'U', 'V', 'W',
|
||||||
'X', 'Y', 'Z', '[',
|
'X', 'Y', 'Z', '[',
|
||||||
'\\', ']', '^', '_',
|
'\\', ']', '^', '_',
|
||||||
'`', 'a', 'b', 'c',
|
'`', 'a', 'b', 'c',
|
||||||
'd', 'e', 'f', 'g',
|
'd', 'e', 'f', 'g',
|
||||||
'h', 'i', 'j', 'k',
|
'h', 'i', 'j', 'k',
|
||||||
'l', 'm', 'n', 'o',
|
'l', 'm', 'n', 'o',
|
||||||
'p', 'q', 'r', 's',
|
'p', 'q', 'r', 's',
|
||||||
't', 'u', 'v', 'w',
|
't', 'u', 'v', 'w',
|
||||||
'x', 'y', 'z', '{',
|
'x', 'y', 'z', '{',
|
||||||
0xf000 | '|', '}', '~', 127
|
0xf000 | '|', '}', '~', 127
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ static const WCHAR tfx_chars[] = {
|
||||||
converting back space and dot on filesystems only supporting DOS
|
converting back space and dot on filesystems only supporting DOS
|
||||||
filenames. */
|
filenames. */
|
||||||
static const WCHAR tfx_rev_chars[] = {
|
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 | 4, 0xf000 | 5, 0xf000 | 6, 0xf000 | 7,
|
||||||
0xf000 | 8, 0xf000 | 9, 0xf000 | 10, 0xf000 | 11,
|
0xf000 | 8, 0xf000 | 9, 0xf000 | 10, 0xf000 | 11,
|
||||||
0xf000 | 12, 0xf000 | 13, 0xf000 | 14, 0xf000 | 15,
|
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 | 24, 0xf000 | 25, 0xf000 | 26, 0xf000 | 27,
|
||||||
0xf000 | 28, 0xf000 | 29, 0xf000 | 30, 0xf000 | 31,
|
0xf000 | 28, 0xf000 | 29, 0xf000 | 30, 0xf000 | 31,
|
||||||
0xf000 | ' ', '!', 0xf000 | '"', '#',
|
0xf000 | ' ', '!', 0xf000 | '"', '#',
|
||||||
'$', '%', '&', 39,
|
'$', '%', '&', 39,
|
||||||
'(', ')', 0xf000 | '*', '+',
|
'(', ')', 0xf000 | '*', '+',
|
||||||
',', '-', 0xf000 | '.', '\\',
|
',', '-', 0xf000 | '.', '\\',
|
||||||
'0', '1', '2', '3',
|
'0', '1', '2', '3',
|
||||||
'4', '5', '6', '7',
|
'4', '5', '6', '7',
|
||||||
'8', '9', 0xf000 | ':', ';',
|
'8', '9', 0xf000 | ':', ';',
|
||||||
0xf000 | '<', '=', 0xf000 | '>', 0xf000 | '?',
|
0xf000 | '<', '=', 0xf000 | '>', 0xf000 | '?',
|
||||||
'@', 'A', 'B', 'C',
|
'@', 'A', 'B', 'C',
|
||||||
'D', 'E', 'F', 'G',
|
'D', 'E', 'F', 'G',
|
||||||
'H', 'I', 'J', 'K',
|
'H', 'I', 'J', 'K',
|
||||||
'L', 'M', 'N', 'O',
|
'L', 'M', 'N', 'O',
|
||||||
'P', 'Q', 'R', 'S',
|
'P', 'Q', 'R', 'S',
|
||||||
'T', 'U', 'V', 'W',
|
'T', 'U', 'V', 'W',
|
||||||
'X', 'Y', 'Z', '[',
|
'X', 'Y', 'Z', '[',
|
||||||
'\\', ']', '^', '_',
|
'\\', ']', '^', '_',
|
||||||
'`', 'a', 'b', 'c',
|
'`', 'a', 'b', 'c',
|
||||||
'd', 'e', 'f', 'g',
|
'd', 'e', 'f', 'g',
|
||||||
'h', 'i', 'j', 'k',
|
'h', 'i', 'j', 'k',
|
||||||
'l', 'm', 'n', 'o',
|
'l', 'm', 'n', 'o',
|
||||||
'p', 'q', 'r', 's',
|
'p', 'q', 'r', 's',
|
||||||
't', 'u', 'v', 'w',
|
't', 'u', 'v', 'w',
|
||||||
'x', 'y', 'z', '{',
|
'x', 'y', 'z', '{',
|
||||||
0xf000 | '|', '}', '~', 127
|
0xf000 | '|', '}', '~', 127
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@ sys_cp_wcstombs (wctomb_p f_wctomb, const char *charset, char *dst, size_t len,
|
||||||
unsigned char cwc;
|
unsigned char cwc;
|
||||||
|
|
||||||
/* Convert UNICODE private use area. Reverse functionality for the
|
/* 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
|
Reverse functionality for invalid bytes in a multibyte sequence is
|
||||||
in sys_cp_mbstowcs below. */
|
in sys_cp_mbstowcs below. */
|
||||||
if ((pw & 0xff00) == 0xf000
|
if ((pw & 0xff00) == 0xf000
|
||||||
|
|
|
@ -557,7 +557,7 @@ unlink_nt (path_conv &pc)
|
||||||
FILE_STANDARD_INFORMATION fsi;
|
FILE_STANDARD_INFORMATION fsi;
|
||||||
|
|
||||||
/* If possible, hide the non-atomicity of the "remove R/O flag, remove
|
/* 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 ()
|
if (wincap.has_transactions ()
|
||||||
&& (pc.fs_flags () & FILE_SUPPORTS_TRANSACTIONS))
|
&& (pc.fs_flags () & FILE_SUPPORTS_TRANSACTIONS))
|
||||||
start_transaction (old_trans, trans);
|
start_transaction (old_trans, trans);
|
||||||
|
@ -569,7 +569,7 @@ unlink_nt (path_conv &pc)
|
||||||
NtSetAttributesFile (fh_ro, pc.file_attributes ()
|
NtSetAttributesFile (fh_ro, pc.file_attributes ()
|
||||||
& ~FILE_ATTRIBUTE_READONLY);
|
& ~FILE_ATTRIBUTE_READONLY);
|
||||||
pc.init_reopen_attr (&attr, fh_ro);
|
pc.init_reopen_attr (&attr, fh_ro);
|
||||||
}
|
}
|
||||||
if (pc.is_lnk_symlink ())
|
if (pc.is_lnk_symlink ())
|
||||||
{
|
{
|
||||||
status = NtQueryInformationFile (fh_ro, &io, &fsi, sizeof fsi,
|
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,
|
times out. Opening the file with FILE_SHARE_VALID_FLAGS will work,
|
||||||
though, and it is then possible to delete the file quite normally.
|
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.
|
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.
|
That's why we don't call try_to_bin on NFS.
|
||||||
|
|
||||||
|
@ -711,7 +711,7 @@ unlink_nt (path_conv &pc)
|
||||||
if (fh)
|
if (fh)
|
||||||
{
|
{
|
||||||
if (access & FILE_WRITE_ATTRIBUTES)
|
if (access & FILE_WRITE_ATTRIBUTES)
|
||||||
{
|
{
|
||||||
/* Restore R/O attribute if setting the delete dispostion failed. */
|
/* Restore R/O attribute if setting the delete dispostion failed. */
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
NtSetAttributesFile (fh, pc.file_attributes ());
|
NtSetAttributesFile (fh, pc.file_attributes ());
|
||||||
|
@ -1547,11 +1547,11 @@ sync ()
|
||||||
}
|
}
|
||||||
/* Traverse \Device directory ... */
|
/* Traverse \Device directory ... */
|
||||||
PDIRECTORY_BASIC_INFORMATION dbi = (PDIRECTORY_BASIC_INFORMATION)
|
PDIRECTORY_BASIC_INFORMATION dbi = (PDIRECTORY_BASIC_INFORMATION)
|
||||||
alloca (640);
|
alloca (640);
|
||||||
BOOLEAN restart = TRUE;
|
BOOLEAN restart = TRUE;
|
||||||
ULONG context = 0;
|
ULONG context = 0;
|
||||||
while (NT_SUCCESS (NtQueryDirectoryObject (devhdl, dbi, 640, TRUE, restart,
|
while (NT_SUCCESS (NtQueryDirectoryObject (devhdl, dbi, 640, TRUE, restart,
|
||||||
&context, NULL)))
|
&context, NULL)))
|
||||||
{
|
{
|
||||||
restart = FALSE;
|
restart = FALSE;
|
||||||
/* ... and call sync_worker for each HarddiskVolumeX entry. */
|
/* ... 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;
|
char *p = stpcpy (buf = tp.c_get (), oldpath) - 1;
|
||||||
oldpath = buf;
|
oldpath = buf;
|
||||||
while (p >= oldpath && isdirsep (*p))
|
while (p >= oldpath && isdirsep (*p))
|
||||||
*p-- = '\0';
|
*p-- = '\0';
|
||||||
olen = p + 1 - oldpath;
|
olen = p + 1 - oldpath;
|
||||||
if (!olen)
|
if (!olen)
|
||||||
{
|
{
|
||||||
/* The root directory cannot be renamed. This also rejects
|
/* The root directory cannot be renamed. This also rejects
|
||||||
the corner case of rename("/","/"), even though it is the
|
the corner case of rename("/","/"), even though it is the
|
||||||
same file. */
|
same file. */
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
old_dir_requested = true;
|
old_dir_requested = true;
|
||||||
}
|
}
|
||||||
oldpc.check (oldpath, PC_SYM_NOFOLLOW, stat_suffixes);
|
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;
|
char *p = stpcpy (buf = tp.c_get (), newpath) - 1;
|
||||||
newpath = buf;
|
newpath = buf;
|
||||||
while (p >= newpath && isdirsep (*p))
|
while (p >= newpath && isdirsep (*p))
|
||||||
*p-- = '\0';
|
*p-- = '\0';
|
||||||
nlen = p + 1 - newpath;
|
nlen = p + 1 - newpath;
|
||||||
if (!nlen) /* The root directory is never empty. */
|
if (!nlen) /* The root directory is never empty. */
|
||||||
{
|
{
|
||||||
set_errno (ENOTEMPTY);
|
set_errno (ENOTEMPTY);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
new_dir_requested = true;
|
new_dir_requested = true;
|
||||||
}
|
}
|
||||||
newpc.check (newpath, PC_SYM_NOFOLLOW, stat_suffixes);
|
newpc.check (newpath, PC_SYM_NOFOLLOW, stat_suffixes);
|
||||||
|
@ -1895,7 +1895,7 @@ rename (const char *oldpath, const char *newpath)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (new_dir_requested && !(newpc.exists ()
|
if (new_dir_requested && !(newpc.exists ()
|
||||||
? newpc.isdir () : oldpc.isdir ()))
|
? newpc.isdir () : oldpc.isdir ()))
|
||||||
{
|
{
|
||||||
/* Reject rename("file1","file2/"), but allow rename("dir","d/"). */
|
/* Reject rename("file1","file2/"), but allow rename("dir","d/"). */
|
||||||
set_errno (newpc.exists () ? ENOTDIR : ENOENT);
|
set_errno (newpc.exists () ? ENOTDIR : ENOENT);
|
||||||
|
@ -2844,11 +2844,11 @@ seteuid32 (__uid32_t uid)
|
||||||
like this:
|
like this:
|
||||||
|
|
||||||
cygwin_internal(CW_SET_EXTERNAL_TOKEN, restricted_token,
|
cygwin_internal(CW_SET_EXTERNAL_TOKEN, restricted_token,
|
||||||
CW_TOKEN_RESTRICTED);
|
CW_TOKEN_RESTRICTED);
|
||||||
setuid (getuid ());
|
setuid (getuid ());
|
||||||
[...do stuff with restricted rights...]
|
[...do stuff with restricted rights...]
|
||||||
cygwin_internal(CW_SET_EXTERNAL_TOKEN, INVALID_HANDLE_VALUE,
|
cygwin_internal(CW_SET_EXTERNAL_TOKEN, INVALID_HANDLE_VALUE,
|
||||||
CW_TOKEN_RESTRICTED);
|
CW_TOKEN_RESTRICTED);
|
||||||
setuid (getuid ());
|
setuid (getuid ());
|
||||||
|
|
||||||
Note that using the current uid is a requirement! Starting with Windows
|
Note that using the current uid is a requirement! Starting with Windows
|
||||||
|
|
|
@ -376,9 +376,9 @@ sysinfo (struct sysinfo *info)
|
||||||
debug_printf ("NtQuerySystemInformation(SystemPagefileInformation), "
|
debug_printf ("NtQuerySystemInformation(SystemPagefileInformation), "
|
||||||
"status %p", ret);
|
"status %p", ret);
|
||||||
totalswap = (memory_status.ullTotalPageFile - memory_status.ullTotalPhys)
|
totalswap = (memory_status.ullTotalPageFile - memory_status.ullTotalPhys)
|
||||||
/ getsystempagesize ();
|
/ getsystempagesize ();
|
||||||
freeswap = (memory_status.ullAvailPageFile - memory_status.ullTotalPhys)
|
freeswap = (memory_status.ullAvailPageFile - memory_status.ullTotalPhys)
|
||||||
/ getsystempagesize ();
|
/ getsystempagesize ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1403,7 +1403,7 @@ pthread_rwlock::rdlock ()
|
||||||
if (reader->n < ULONG_MAX)
|
if (reader->n < ULONG_MAX)
|
||||||
++reader->n;
|
++reader->n;
|
||||||
else
|
else
|
||||||
errno = EAGAIN;
|
errno = EAGAIN;
|
||||||
goto DONE;
|
goto DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1546,7 +1546,7 @@ pthread_rwlock::unlock ()
|
||||||
goto DONE;
|
goto DONE;
|
||||||
}
|
}
|
||||||
if (--reader->n > 0)
|
if (--reader->n > 0)
|
||||||
goto DONE;
|
goto DONE;
|
||||||
|
|
||||||
remove_reader (reader);
|
remove_reader (reader);
|
||||||
delete reader;
|
delete reader;
|
||||||
|
@ -2481,7 +2481,7 @@ pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
|
||||||
|
|
||||||
tbi = (PTHREAD_BASIC_INFORMATION) malloc (sizeof_tbi);
|
tbi = (PTHREAD_BASIC_INFORMATION) malloc (sizeof_tbi);
|
||||||
ret = NtQueryInformationThread (thread->win32_obj_id, ThreadBasicInformation,
|
ret = NtQueryInformationThread (thread->win32_obj_id, ThreadBasicInformation,
|
||||||
tbi, sizeof_tbi, NULL);
|
tbi, sizeof_tbi, NULL);
|
||||||
|
|
||||||
if (NT_SUCCESS (ret))
|
if (NT_SUCCESS (ret))
|
||||||
{
|
{
|
||||||
|
@ -2493,7 +2493,7 @@ pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
debug_printf ("NtQueryInformationThread(ThreadBasicInformation), "
|
debug_printf ("NtQueryInformationThread(ThreadBasicInformation), "
|
||||||
"status %p", ret);
|
"status %p", ret);
|
||||||
(*attr)->stackaddr = thread->attr.stackaddr;
|
(*attr)->stackaddr = thread->attr.stackaddr;
|
||||||
(*attr)->stacksize = thread->attr.stacksize;
|
(*attr)->stacksize = thread->attr.stacksize;
|
||||||
}
|
}
|
||||||
|
@ -3579,7 +3579,7 @@ semaphore::open (unsigned long long hash, LUID luid, int fd, int oflag,
|
||||||
semaphores.mx.lock ();
|
semaphores.mx.lock ();
|
||||||
for (semaphore *sema = semaphores.head; sema; sema = sema->next)
|
for (semaphore *sema = semaphores.head; sema; sema = sema->next)
|
||||||
if (sema->fd >= 0 && sema->hash == hash
|
if (sema->fd >= 0 && sema->hash == hash
|
||||||
&& sema->luid.HighPart == luid.HighPart
|
&& sema->luid.HighPart == luid.HighPart
|
||||||
&& sema->luid.LowPart == sema->luid.LowPart)
|
&& sema->luid.LowPart == sema->luid.LowPart)
|
||||||
{
|
{
|
||||||
wasopen = true;
|
wasopen = true;
|
||||||
|
|
|
@ -605,14 +605,14 @@ clock_gettime (clockid_t clk_id, struct timespec *tp)
|
||||||
long long x;
|
long long x;
|
||||||
|
|
||||||
if (pid == 0)
|
if (pid == 0)
|
||||||
pid = getpid ();
|
pid = getpid ();
|
||||||
|
|
||||||
pinfo p (pid);
|
pinfo p (pid);
|
||||||
if (!p->exists ())
|
if (!p->exists ())
|
||||||
{
|
{
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
hProcess = OpenProcess (PROCESS_QUERY_INFORMATION, 0, p->dwProcessId);
|
hProcess = OpenProcess (PROCESS_QUERY_INFORMATION, 0, p->dwProcessId);
|
||||||
NtQueryInformationProcess (hProcess, ProcessTimes, &kut, sizeof_kut, &sizeof_kut);
|
NtQueryInformationProcess (hProcess, ProcessTimes, &kut, sizeof_kut, &sizeof_kut);
|
||||||
|
@ -634,14 +634,14 @@ clock_gettime (clockid_t clk_id, struct timespec *tp)
|
||||||
long long x;
|
long long x;
|
||||||
|
|
||||||
if (thr_id == 0)
|
if (thr_id == 0)
|
||||||
thr_id = pthread::self ()->getsequence_np ();
|
thr_id = pthread::self ()->getsequence_np ();
|
||||||
|
|
||||||
hThread = OpenThread (THREAD_QUERY_INFORMATION, 0, thr_id);
|
hThread = OpenThread (THREAD_QUERY_INFORMATION, 0, thr_id);
|
||||||
if (!hThread)
|
if (!hThread)
|
||||||
{
|
{
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
NtQueryInformationThread (hThread, ThreadTimes, &kut, sizeof_kut, &sizeof_kut);
|
NtQueryInformationThread (hThread, ThreadTimes, &kut, sizeof_kut, &sizeof_kut);
|
||||||
|
|
||||||
|
@ -656,29 +656,29 @@ clock_gettime (clockid_t clk_id, struct timespec *tp)
|
||||||
switch (clk_id)
|
switch (clk_id)
|
||||||
{
|
{
|
||||||
case CLOCK_REALTIME:
|
case CLOCK_REALTIME:
|
||||||
{
|
{
|
||||||
LONGLONG now = gtod.nsecs ();
|
LONGLONG now = gtod.nsecs ();
|
||||||
if (now == (LONGLONG) -1)
|
if (now == (LONGLONG) -1)
|
||||||
return -1;
|
return -1;
|
||||||
tp->tv_sec = now / NSPERSEC;
|
tp->tv_sec = now / NSPERSEC;
|
||||||
tp->tv_nsec = (now % NSPERSEC) * (1000000000 / NSPERSEC);
|
tp->tv_nsec = (now % NSPERSEC) * (1000000000 / NSPERSEC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CLOCK_MONOTONIC:
|
case CLOCK_MONOTONIC:
|
||||||
{
|
{
|
||||||
LONGLONG now = ntod.nsecs ();
|
LONGLONG now = ntod.nsecs ();
|
||||||
if (now == (LONGLONG) -1)
|
if (now == (LONGLONG) -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
tp->tv_sec = now / 1000000000;
|
tp->tv_sec = now / 1000000000;
|
||||||
tp->tv_nsec = (now % 1000000000);
|
tp->tv_nsec = (now % 1000000000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -784,24 +784,24 @@ clock_getres (clockid_t clk_id, struct timespec *tp)
|
||||||
switch (clk_id)
|
switch (clk_id)
|
||||||
{
|
{
|
||||||
case CLOCK_REALTIME:
|
case CLOCK_REALTIME:
|
||||||
{
|
{
|
||||||
DWORD period = gtod.resolution ();
|
DWORD period = gtod.resolution ();
|
||||||
tp->tv_sec = period / 1000;
|
tp->tv_sec = period / 1000;
|
||||||
tp->tv_nsec = (period % 1000) * 1000000;
|
tp->tv_nsec = (period % 1000) * 1000000;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CLOCK_MONOTONIC:
|
case CLOCK_MONOTONIC:
|
||||||
{
|
{
|
||||||
LONGLONG period = ntod.resolution ();
|
LONGLONG period = ntod.resolution ();
|
||||||
tp->tv_sec = period / 1000000000;
|
tp->tv_sec = period / 1000000000;
|
||||||
tp->tv_nsec = period % 1000000000;
|
tp->tv_nsec = period % 1000000000;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -86,7 +86,7 @@ cygheap_user::init ()
|
||||||
/* Standard way to build a security descriptor with the usual DACL */
|
/* Standard way to build a security descriptor with the usual DACL */
|
||||||
PSECURITY_ATTRIBUTES sa_buf = (PSECURITY_ATTRIBUTES) alloca (1024);
|
PSECURITY_ATTRIBUTES sa_buf = (PSECURITY_ATTRIBUTES) alloca (1024);
|
||||||
psd = (PSECURITY_DESCRIPTOR)
|
psd = (PSECURITY_DESCRIPTOR)
|
||||||
(sec_user_nih (sa_buf, sid()))->lpSecurityDescriptor;
|
(sec_user_nih (sa_buf, sid()))->lpSecurityDescriptor;
|
||||||
|
|
||||||
BOOLEAN acl_exists, dummy;
|
BOOLEAN acl_exists, dummy;
|
||||||
TOKEN_DEFAULT_DACL dacl;
|
TOKEN_DEFAULT_DACL dacl;
|
||||||
|
@ -326,7 +326,7 @@ cygheap_user::ontherange (homebodies what, struct passwd *pw)
|
||||||
if (!(ret = NetUserGetInfo (wlogsrv, wuser, 3, (LPBYTE *) &ui)))
|
if (!(ret = NetUserGetInfo (wlogsrv, wuser, 3, (LPBYTE *) &ui)))
|
||||||
{
|
{
|
||||||
sys_wcstombs (homepath_env_buf, NT_MAX_PATH,
|
sys_wcstombs (homepath_env_buf, NT_MAX_PATH,
|
||||||
ui->usri3_home_dir);
|
ui->usri3_home_dir);
|
||||||
if (!homepath_env_buf[0])
|
if (!homepath_env_buf[0])
|
||||||
{
|
{
|
||||||
sys_wcstombs (homepath_env_buf, NT_MAX_PATH,
|
sys_wcstombs (homepath_env_buf, NT_MAX_PATH,
|
||||||
|
|
Loading…
Reference in New Issue