mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-19 21:09:22 +08:00
Perform whitespace cleanup throughout.
* dcrt0.cc (signal_shift_subtract): Eliminate ancient backwards compatibility. (check_sanity_and_sync): Ditto. * winsup.h (SIGTOMASK): Ditto. Just use constant in signal calculation. * include/cygwin/version: Remove backwards signal mask compatibility define. * path.cc (symlink_info::check_sysfile): Cosmetic change. * registry.cc (get_registry_hive_path): Remove unneeded variable. * exceptions.cc (handle_sigsuspend): Eliminate thread signal mask and use either main sigmask or current thread sigmask. (set_process_mask): Ditto. (sighold): Ditto. (sigrelse): Ditto. (sigset): Ditto. (set_process_mask_delta): Ditto. (_cygtls::call_signal_handler): Ditto. * fhandler_process.cc (format_process_status): Ditto. * fhandler_termios.cc (fhandler_termios::bg_check): Ditto. * pinfo.h (class pinfo): Ditto. * select.cc (pselect): Ditto. * signal.cc (sigprocmask): Ditto. (abort): Ditto. (sigpause): Ditto. (sigsend): Ditto. (wait_sig): Ditto. * thread.h (pthread::parent_tls): New member. * thread.cc (pthread::pthread): Record parent_tls here. (pthread::thread_init_wrapper): Initialize sigmask from parent thread.
This commit is contained in:
parent
d039978069
commit
70300fdb1c
@ -1,3 +1,40 @@
|
||||
2008-02-15 Christopher Faylor <me+cygwin@cgf.cx>
|
||||
|
||||
Perform whitespace cleanup throughout.
|
||||
|
||||
* dcrt0.cc (signal_shift_subtract): Eliminate ancient backwards
|
||||
compatibility.
|
||||
(check_sanity_and_sync): Ditto.
|
||||
* winsup.h (SIGTOMASK): Ditto. Just use constant in signal
|
||||
calculation.
|
||||
* include/cygwin/version: Remove backwards signal mask compatibility
|
||||
define.
|
||||
|
||||
* path.cc (symlink_info::check_sysfile): Cosmetic change.
|
||||
|
||||
* registry.cc (get_registry_hive_path): Remove unneeded variable.
|
||||
|
||||
* exceptions.cc (handle_sigsuspend): Eliminate thread signal mask and
|
||||
use either main sigmask or current thread sigmask.
|
||||
(set_process_mask): Ditto.
|
||||
(sighold): Ditto.
|
||||
(sigrelse): Ditto.
|
||||
(sigset): Ditto.
|
||||
(set_process_mask_delta): Ditto.
|
||||
(_cygtls::call_signal_handler): Ditto.
|
||||
* fhandler_process.cc (format_process_status): Ditto.
|
||||
* fhandler_termios.cc (fhandler_termios::bg_check): Ditto.
|
||||
* pinfo.h (class pinfo): Ditto.
|
||||
* select.cc (pselect): Ditto.
|
||||
* signal.cc (sigprocmask): Ditto.
|
||||
(abort): Ditto.
|
||||
(sigpause): Ditto.
|
||||
(sigsend): Ditto.
|
||||
(wait_sig): Ditto.
|
||||
* thread.h (pthread::parent_tls): New member.
|
||||
* thread.cc (pthread::pthread): Record parent_tls here.
|
||||
(pthread::thread_init_wrapper): Initialize sigmask from parent thread.
|
||||
|
||||
2008-02-14 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* cygheap.cc (cwcsdup): New function.
|
||||
|
@ -49,9 +49,9 @@ typedef struct _LSA_SECPKG_FUNCS
|
||||
NTSTATUS (NTAPI *AllocateClientBuffer)(PLSA_CLIENT_REQUEST, ULONG, PVOID *);
|
||||
NTSTATUS (NTAPI *FreeClientBuffer)(PLSA_CLIENT_REQUEST, PVOID);
|
||||
NTSTATUS (NTAPI *CopyToClientBuffer)(PLSA_CLIENT_REQUEST, ULONG,
|
||||
PVOID, PVOID);
|
||||
PVOID, PVOID);
|
||||
NTSTATUS (NTAPI *CopyFromClientBuffer)(PLSA_CLIENT_REQUEST, ULONG,
|
||||
PVOID, PVOID);
|
||||
PVOID, PVOID);
|
||||
NTSTATUS (NTAPI *ImpersonateClient)(VOID);
|
||||
NTSTATUS (NTAPI *UnloadPackage)(VOID);
|
||||
NTSTATUS (NTAPI *DuplicateHandle)(HANDLE,PHANDLE);
|
||||
|
@ -74,14 +74,6 @@ _cygtls NO_COPY *_main_tls;
|
||||
|
||||
bool NO_COPY cygwin_finished_initializing;
|
||||
|
||||
/* Used in SIGTOMASK for generating a bit for insertion into a sigset_t.
|
||||
This is subtracted from the signal number prior to shifting the bit.
|
||||
In older versions of cygwin, the signal was used as-is to shift the
|
||||
bit for masking. So, we'll temporarily detect this and set it to zero
|
||||
for programs that are linked using older cygwins. This is just a stopgap
|
||||
measure to allow an orderly transfer to the new, correct sigmask method. */
|
||||
unsigned NO_COPY int signal_shift_subtract = 1;
|
||||
|
||||
MTinterface _mtinterf;
|
||||
|
||||
bool NO_COPY _cygwin_testing;
|
||||
@ -443,10 +435,6 @@ check_sanity_and_sync (per_process *p)
|
||||
if (p->api_major > cygwin_version.api_major)
|
||||
api_fatal ("cygwin DLL and APP are out of sync -- API version mismatch %d > %d",
|
||||
p->api_major, cygwin_version.api_major);
|
||||
|
||||
if (CYGWIN_VERSION_DLL_MAKE_COMBINED (p->dll_major, p->dll_minor) <=
|
||||
CYGWIN_VERSION_DLL_BAD_SIGNAL_MASK)
|
||||
signal_shift_subtract = 0;
|
||||
}
|
||||
|
||||
child_info NO_COPY *child_proc_info = NULL;
|
||||
|
@ -43452,39 +43452,39 @@ device::parsedisk (int drive, int part)
|
||||
int base;
|
||||
if (drive < ('q' - 'a')) /* /dev/sda -to- /dev/sdp */
|
||||
base = DEV_SD_MAJOR;
|
||||
else if (drive < 32) /* /dev/sdq -to- /dev/sdaf */
|
||||
else if (drive < 32) /* /dev/sdq -to- /dev/sdaf */
|
||||
{
|
||||
base = DEV_SD1_MAJOR;
|
||||
drive -= 'q' - 'a';
|
||||
}
|
||||
else if (drive < 48) /* /dev/sdag -to- /dev/sdav */
|
||||
else if (drive < 48) /* /dev/sdag -to- /dev/sdav */
|
||||
{
|
||||
base = DEV_SD2_MAJOR;
|
||||
drive -= 32;
|
||||
}
|
||||
else if (drive < 64) /* /dev/sdaw -to- /dev/sdbl */
|
||||
else if (drive < 64) /* /dev/sdaw -to- /dev/sdbl */
|
||||
{
|
||||
base = DEV_SD3_MAJOR;
|
||||
drive -= 48;
|
||||
}
|
||||
else if (drive < 80) /* /dev/sdbm -to- /dev/sdcb */
|
||||
else if (drive < 80) /* /dev/sdbm -to- /dev/sdcb */
|
||||
{
|
||||
base = DEV_SD4_MAJOR;
|
||||
drive -= 64;
|
||||
}
|
||||
else if (drive < 96) /* /dev/sdcc -to- /dev/sdcr */
|
||||
else if (drive < 96) /* /dev/sdcc -to- /dev/sdcr */
|
||||
{
|
||||
base = DEV_SD5_MAJOR;
|
||||
drive -= 80;
|
||||
}
|
||||
else if (drive < 112) /* /dev/sdcs -to- /dev/sddh */
|
||||
else if (drive < 112) /* /dev/sdcs -to- /dev/sddh */
|
||||
{
|
||||
base = DEV_SD6_MAJOR;
|
||||
drive -= 96;
|
||||
}
|
||||
/* NOTE: This will cause multiple /dev/sddx entries in
|
||||
/proc/partitions if there are more than 128 devices */
|
||||
else /* /dev/sddi -to- /dev/sddx */
|
||||
/proc/partitions if there are more than 128 devices */
|
||||
else /* /dev/sddi -to- /dev/sddx */
|
||||
{
|
||||
base = DEV_SD7_MAJOR;
|
||||
drive -= 112;
|
||||
|
@ -159,39 +159,39 @@ device::parsedisk (int drive, int part)
|
||||
int base;
|
||||
if (drive < ('q' - 'a')) /* /dev/sda -to- /dev/sdp */
|
||||
base = DEV_SD_MAJOR;
|
||||
else if (drive < 32) /* /dev/sdq -to- /dev/sdaf */
|
||||
else if (drive < 32) /* /dev/sdq -to- /dev/sdaf */
|
||||
{
|
||||
base = DEV_SD1_MAJOR;
|
||||
drive -= 'q' - 'a';
|
||||
}
|
||||
else if (drive < 48) /* /dev/sdag -to- /dev/sdav */
|
||||
else if (drive < 48) /* /dev/sdag -to- /dev/sdav */
|
||||
{
|
||||
base = DEV_SD2_MAJOR;
|
||||
drive -= 32;
|
||||
}
|
||||
else if (drive < 64) /* /dev/sdaw -to- /dev/sdbl */
|
||||
else if (drive < 64) /* /dev/sdaw -to- /dev/sdbl */
|
||||
{
|
||||
base = DEV_SD3_MAJOR;
|
||||
drive -= 48;
|
||||
}
|
||||
else if (drive < 80) /* /dev/sdbm -to- /dev/sdcb */
|
||||
else if (drive < 80) /* /dev/sdbm -to- /dev/sdcb */
|
||||
{
|
||||
base = DEV_SD4_MAJOR;
|
||||
drive -= 64;
|
||||
}
|
||||
else if (drive < 96) /* /dev/sdcc -to- /dev/sdcr */
|
||||
else if (drive < 96) /* /dev/sdcc -to- /dev/sdcr */
|
||||
{
|
||||
base = DEV_SD5_MAJOR;
|
||||
drive -= 80;
|
||||
}
|
||||
else if (drive < 112) /* /dev/sdcs -to- /dev/sddh */
|
||||
else if (drive < 112) /* /dev/sdcs -to- /dev/sddh */
|
||||
{
|
||||
base = DEV_SD6_MAJOR;
|
||||
drive -= 96;
|
||||
}
|
||||
/* NOTE: This will cause multiple /dev/sddx entries in
|
||||
/proc/partitions if there are more than 128 devices */
|
||||
else /* /dev/sddi -to- /dev/sddx */
|
||||
/proc/partitions if there are more than 128 devices */
|
||||
else /* /dev/sddi -to- /dev/sddx */
|
||||
{
|
||||
base = DEV_SD7_MAJOR;
|
||||
drive -= 112;
|
||||
|
@ -45,7 +45,7 @@ for my $k (sort {$section{$a}{-idx} <=> $section{$b}{-idx}} keys %section) {
|
||||
$vma = $section{$k}{-vma};
|
||||
}
|
||||
if ($vma != $section{$k}{-vma}) {
|
||||
my $newvma = align($vma, $section{$k}{-algn});
|
||||
my $newvma = align($vma, $section{$k}{-algn});
|
||||
if ($newvma != $vma) {
|
||||
printf STDERR "$0: ERROR $k VMA 0x%08x != 0x%08x\n", $vma, $newvma;
|
||||
exit 1;
|
||||
|
@ -682,9 +682,9 @@ handle_sigsuspend (sigset_t tempmask)
|
||||
return -1;
|
||||
}
|
||||
|
||||
sigset_t oldmask = myself->getsigmask (); // Remember for restoration
|
||||
sigset_t oldmask = _my_tls.sigmask; // Remember for restoration
|
||||
|
||||
set_signal_mask (tempmask, myself->getsigmask ());
|
||||
set_signal_mask (tempmask, _my_tls.sigmask);
|
||||
sigproc_printf ("oldmask %p, newmask %p", oldmask, tempmask);
|
||||
|
||||
pthread_testcancel ();
|
||||
@ -995,8 +995,7 @@ ctrl_c_handler (DWORD type)
|
||||
extern "C" void __stdcall
|
||||
set_process_mask (sigset_t newmask)
|
||||
{
|
||||
set_signal_mask (newmask, myself->getsigmask ());
|
||||
sigproc_printf ("mask now %p\n", myself->getsigmask ());
|
||||
set_signal_mask (newmask, _my_tls.sigmask);
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
@ -1010,9 +1009,9 @@ sighold (int sig)
|
||||
return -1;
|
||||
}
|
||||
mask_sync.acquire (INFINITE);
|
||||
sigset_t mask = myself->getsigmask ();
|
||||
sigset_t mask = _my_tls.sigmask;
|
||||
sigaddset (&mask, sig);
|
||||
set_signal_mask (mask, myself->getsigmask ());
|
||||
set_signal_mask (mask, _my_tls.sigmask);
|
||||
mask_sync.release ();
|
||||
return 0;
|
||||
}
|
||||
@ -1028,9 +1027,9 @@ sigrelse (int sig)
|
||||
return -1;
|
||||
}
|
||||
mask_sync.acquire (INFINITE);
|
||||
sigset_t mask = myself->getsigmask ();
|
||||
sigset_t mask = _my_tls.sigmask;
|
||||
sigdelset (&mask, sig);
|
||||
set_signal_mask (mask, myself->getsigmask ());
|
||||
set_signal_mask (mask, _my_tls.sigmask);
|
||||
mask_sync.release ();
|
||||
return 0;
|
||||
}
|
||||
@ -1050,7 +1049,7 @@ sigset (int sig, _sig_func_ptr func)
|
||||
}
|
||||
|
||||
mask_sync.acquire (INFINITE);
|
||||
sigset_t mask = myself->getsigmask ();
|
||||
sigset_t mask = _my_tls.sigmask;
|
||||
/* If sig was in the signal mask return SIG_HOLD, otherwise return the
|
||||
previous disposition. */
|
||||
if (sigismember (&mask, sig))
|
||||
@ -1068,7 +1067,7 @@ sigset (int sig, _sig_func_ptr func)
|
||||
signal (sig, func);
|
||||
sigdelset (&mask, sig);
|
||||
}
|
||||
set_signal_mask (mask, myself->getsigmask ());
|
||||
set_signal_mask (mask, _my_tls.sigmask);
|
||||
mask_sync.release ();
|
||||
return prev;
|
||||
}
|
||||
@ -1090,11 +1089,11 @@ set_process_mask_delta ()
|
||||
if (_my_tls.deltamask & SIG_NONMASKABLE)
|
||||
oldmask = _my_tls.oldmask; /* from handle_sigsuspend */
|
||||
else
|
||||
oldmask = myself->getsigmask ();
|
||||
oldmask = _my_tls.sigmask;
|
||||
newmask = (oldmask | _my_tls.deltamask) & ~SIG_NONMASKABLE;
|
||||
sigproc_printf ("oldmask %p, newmask %p, deltamask %p", oldmask, newmask,
|
||||
_my_tls.deltamask);
|
||||
myself->setsigmask (newmask);
|
||||
_my_tls.sigmask = newmask;
|
||||
mask_sync.release ();
|
||||
return oldmask;
|
||||
}
|
||||
@ -1362,7 +1361,7 @@ _cygtls::call_signal_handler ()
|
||||
sigact (thissig, &thissi, NULL);
|
||||
}
|
||||
incyg = 1;
|
||||
set_signal_mask (this_oldmask, myself->getsigmask ());
|
||||
set_signal_mask (this_oldmask, _my_tls.sigmask);
|
||||
if (this_errno >= 0)
|
||||
set_errno (this_errno);
|
||||
}
|
||||
|
@ -940,7 +940,7 @@ fhandler_base::lseek (_off64_t offset, int whence)
|
||||
status = NtQueryInformationFile (get_handle (), &io, &fpi, sizeof fpi,
|
||||
FilePositionInformation);
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
{
|
||||
__seterrno_from_nt_status (status);
|
||||
return -1;
|
||||
}
|
||||
@ -950,7 +950,7 @@ fhandler_base::lseek (_off64_t offset, int whence)
|
||||
status = NtQueryInformationFile (get_handle (), &io, &fsi, sizeof fsi,
|
||||
FileStandardInformation);
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
{
|
||||
__seterrno_from_nt_status (status);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1465,7 +1465,7 @@ fhandler_console::write_normal (const unsigned char *src,
|
||||
nfound = next_char (cp, trunc_buf.buf,
|
||||
trunc_buf.buf + trunc_buf.len + cp_len);
|
||||
if (!nfound) /* Invalid multibyte sequence. */
|
||||
{ /* Give up and print replacement chars. */
|
||||
{ /* Give up and print replacement chars. */
|
||||
for (int i = 0; i < trunc_buf.len; ++i)
|
||||
write_replacement_char (trunc_buf.buf + i);
|
||||
}
|
||||
@ -1495,7 +1495,7 @@ fhandler_console::write_normal (const unsigned char *src,
|
||||
if (!nfound) /* Invalid multibyte sequence. */
|
||||
break;
|
||||
if (nfound == found) /* Truncated multibyte sequence. */
|
||||
{ /* Stick to it until the next write. */
|
||||
{ /* Stick to it until the next write. */
|
||||
trunc_buf.len = end - found;
|
||||
memcpy (trunc_buf.buf, found, trunc_buf.len);
|
||||
return end;
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
~__DIR_mounts ()
|
||||
{
|
||||
for (int i = 0; i < count; ++i)
|
||||
RtlFreeUnicodeString (&mounts[i]);
|
||||
RtlFreeUnicodeString (&mounts[i]);
|
||||
RtlFreeUnicodeString (&cygdrive);
|
||||
}
|
||||
__ino64_t check_mount (PUNICODE_STRING fname, __ino64_t ino,
|
||||
@ -306,7 +306,7 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf)
|
||||
pfai->BasicInformation.FileAttributes);
|
||||
}
|
||||
debug_printf ("%p = NtQueryInformationFile(%S)",
|
||||
status, pc.get_nt_native_path ());
|
||||
status, pc.get_nt_native_path ());
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -354,7 +354,7 @@ fhandler_base::fstat_by_name (struct __stat64 *buf)
|
||||
TRUE, &basename, TRUE)))
|
||||
FileId = pfdi->FileId;
|
||||
else if (NT_SUCCESS (status = NtQueryDirectoryFile (dir, NULL, NULL, 0, &io,
|
||||
pfdi, fdi_size,
|
||||
pfdi, fdi_size,
|
||||
FileBothDirectoryInformation,
|
||||
TRUE, &basename, TRUE)))
|
||||
FileId.QuadPart = 0; /* get_namehash is called in fstat_helper. */
|
||||
@ -421,7 +421,7 @@ fhandler_base::fstat_fs (struct __stat64 *buf)
|
||||
if (get_handle ())
|
||||
{
|
||||
if (!nohandle () && !is_fs_special ())
|
||||
res = fstat_by_handle (buf);
|
||||
res = fstat_by_handle (buf);
|
||||
if (res)
|
||||
res = fstat_by_name (buf);
|
||||
return res;
|
||||
@ -581,7 +581,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
|
||||
InitializeObjectAttributes (&attr, &same, 0, get_handle (), NULL);
|
||||
if (NT_SUCCESS (NtOpenFile (&h, FILE_READ_DATA, &attr, &io,
|
||||
FILE_SHARE_VALID_FLAGS, 0)))
|
||||
{
|
||||
{
|
||||
LARGE_INTEGER off = { QuadPart:0LL };
|
||||
char magic[3];
|
||||
|
||||
@ -1132,7 +1132,7 @@ fhandler_disk_file::link (const char *newpath)
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
if (status == STATUS_INVALID_DEVICE_REQUEST)
|
||||
{
|
||||
{
|
||||
/* FS doesn't support hard links. Try to copy file. */
|
||||
WCHAR pcw[pc.get_nt_native_path ()->Length + 1];
|
||||
WCHAR newpcw[newpc.get_nt_native_path ()->Length + 1];
|
||||
@ -1148,7 +1148,7 @@ fhandler_disk_file::link (const char *newpath)
|
||||
| FILE_ATTRIBUTE_READONLY);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
__seterrno_from_nt_status (status);
|
||||
return -1;
|
||||
}
|
||||
@ -1523,7 +1523,7 @@ fhandler_disk_file::rmdir ()
|
||||
(pc.get_object_attr (attr, sec_none_nih), &fbi)))
|
||||
status = STATUS_DIRECTORY_NOT_EMPTY;
|
||||
else
|
||||
status = STATUS_SUCCESS;
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
@ -1691,7 +1691,7 @@ readdir_get_ino (const char *path, bool dot_dot)
|
||||
fname = (char *) alloca (strlen (path) + 4);
|
||||
char *c = stpcpy (fname, path);
|
||||
if (c[-1] != '/')
|
||||
*c++ = '/';
|
||||
*c++ = '/';
|
||||
strcpy (c, "..");
|
||||
path = fname;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ details. */
|
||||
#include "dtable.h"
|
||||
#include "cygheap.h"
|
||||
#include "ntdll.h"
|
||||
#include "cygtls.h"
|
||||
#include <sys/param.h>
|
||||
#include <assert.h>
|
||||
#include <sys/sysmacros.h>
|
||||
@ -812,7 +813,7 @@ format_process_status (_pinfo *p, char *destbuf, size_t maxsize)
|
||||
p->gid, p->gid, p->gid, p->gid,
|
||||
vmsize >> 10, 0, vmrss >> 10, vmdata >> 10, 0,
|
||||
vmtext >> 10, vmlib >> 10,
|
||||
0, 0, p->getsigmask ()
|
||||
0, 0, _my_tls.sigmask
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -426,7 +426,7 @@ search_wsa_event_slot (LONG new_serial_number)
|
||||
if (!wsa_slot_mtx)
|
||||
{
|
||||
wsa_slot_mtx = CreateMutex (&sec_all, FALSE,
|
||||
shared_name (name, "sock", 0));
|
||||
shared_name (name, "sock", 0));
|
||||
if (!wsa_slot_mtx)
|
||||
api_fatal ("Couldn't create/open shared socket mutex, %E");
|
||||
}
|
||||
@ -1218,13 +1218,13 @@ fhandler_socket::recv_internal (WSABUF *wsabuf, DWORD wsacnt, DWORD flags,
|
||||
if (waitall)
|
||||
{
|
||||
if (get_socket_type () != SOCK_STREAM)
|
||||
{
|
||||
{
|
||||
WSASetLastError (WSAEOPNOTSUPP);
|
||||
set_winsock_errno ();
|
||||
return SOCKET_ERROR;
|
||||
}
|
||||
if (is_nonblocking () || (flags & (MSG_OOB | MSG_PEEK)))
|
||||
waitall = false;
|
||||
waitall = false;
|
||||
}
|
||||
|
||||
/* Note: Don't call WSARecvFrom(MSG_PEEK) without actually having data
|
||||
@ -1249,7 +1249,7 @@ fhandler_socket::recv_internal (WSABUF *wsabuf, DWORD wsacnt, DWORD flags,
|
||||
wret = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
wret -= wsabuf->len;
|
||||
++wsabuf;
|
||||
--wsacnt;
|
||||
|
@ -156,7 +156,7 @@ fhandler_termios::bg_check (int sig)
|
||||
int pgid_gone = !pid_exists (myself->pgid);
|
||||
int sigs_ignored =
|
||||
((void *) global_sigs[sig].sa_handler == (void *) SIG_IGN) ||
|
||||
(myself->getsigmask () & SIGTOMASK (sig));
|
||||
(_main_tls->sigmask & SIGTOMASK (sig));
|
||||
|
||||
if (pgid_gone)
|
||||
goto setEIO;
|
||||
|
@ -62,8 +62,6 @@ details. */
|
||||
/* Every version of cygwin <= this uses an old, incorrect method
|
||||
to determine signal masks. */
|
||||
|
||||
#define CYGWIN_VERSION_DLL_BAD_SIGNAL_MASK 19005
|
||||
|
||||
#define CYGWIN_VERSION_USER_API_VERSION_COMBINED \
|
||||
CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor)
|
||||
|
||||
@ -311,7 +309,7 @@ details. */
|
||||
169: Export confstr.
|
||||
170: Export insque, remque.
|
||||
171: Export exp10, exp10f, pow10, pow10f, strcasestr, funopen,
|
||||
fopencookie.
|
||||
fopencookie.
|
||||
172: Export getifaddrs, freeifaddrs.
|
||||
173: Export __assert_func.
|
||||
174: Export stpcpy, stpncpy.
|
||||
|
@ -20,15 +20,15 @@ details. */
|
||||
#if !defined(__SINGLE_THREAD__)
|
||||
# if !defined(_flockfile)
|
||||
# define _flockfile(fp) ({ if (!((fp)->_flags & __SSTR)) \
|
||||
__cygwin_lock_lock ((_LOCK_T *)&(fp)->_lock); })
|
||||
__cygwin_lock_lock ((_LOCK_T *)&(fp)->_lock); })
|
||||
# endif
|
||||
# if !defined(_ftrylockfile)
|
||||
# define _ftrylockfile(fp) (((fp)->_flags & __SSTR) ? 0 : \
|
||||
__cygwin_lock_trylock ((_LOCK_T *)&(fp)->_lock))
|
||||
__cygwin_lock_trylock ((_LOCK_T *)&(fp)->_lock))
|
||||
# endif
|
||||
# if !defined(_funlockfile)
|
||||
# define _funlockfile(fp) ({ if (!((fp)->_flags & __SSTR)) \
|
||||
__cygwin_lock_unlock ((_LOCK_T *)&(fp)->_lock); })
|
||||
__cygwin_lock_unlock ((_LOCK_T *)&(fp)->_lock); })
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -30,9 +30,7 @@ details. */
|
||||
#include <sys/cygwin.h>
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
write_record: Translates a Windows DNS record into a compressed record
|
||||
|
||||
* write_record: Translates a Windows DNS record into a compressed record
|
||||
***********************************************************************/
|
||||
|
||||
#define PUTDOMAIN(d,p)\
|
||||
@ -205,7 +203,7 @@ static int cygwin_query(res_state statp, const char * DomName, int Class, int Ty
|
||||
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
|
||||
#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
|
||||
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
|
||||
#define NO_DATA 4 /* Valid name, no data record of requested type */
|
||||
#define NO_DATA 4 /* Valid name, no data record of requested type */
|
||||
#endif
|
||||
|
||||
DPRINTF(debug, "DnsQuery: %lu (Windows)\n", res);
|
||||
@ -322,7 +320,7 @@ static void get_registry_dns_items(HKEY hKey, LPCTSTR KeyValue,
|
||||
BYTE *ap, *srch;
|
||||
int numAddresses = 0;
|
||||
for (ap = list; ap < list + size && *ap; ap = srch) {
|
||||
/* The separation character can be 0, ' ', or ','. */
|
||||
/* The separation character can be 0, ' ', or ','. */
|
||||
for (srch = ap; *srch && (isdigit(*srch) || *srch == '.' ); srch++);
|
||||
*srch++ = 0;
|
||||
if (numAddresses < DIM(statp->nsaddr_list)) {
|
||||
@ -380,7 +378,7 @@ static void get_registry_dns(res_state statp)
|
||||
/***********************************************************************
|
||||
*
|
||||
get_dns_info: Get the search list or the domain name
|
||||
and the dns server addresses in Network Byte Order
|
||||
and the dns server addresses in Network Byte Order
|
||||
Set statp->os_query if DnsQuery is available.
|
||||
|
||||
***********************************************************************/
|
||||
|
@ -504,7 +504,7 @@ int res_nsend( res_state statp, const unsigned char * MsgPtr,
|
||||
NETDB_SUCCESS 0 /* no problem */
|
||||
HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
|
||||
TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
|
||||
Also seen returned by some servers when the name is too long
|
||||
Also seen returned by some servers when the name is too long
|
||||
NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
|
||||
NO_DATA 4 /* Valid name, no data record of requested type */
|
||||
#endif
|
||||
@ -556,7 +556,7 @@ int res_send( const unsigned char * MsgPtr, int MsgLength,
|
||||
res_mkquery
|
||||
|
||||
Return: packet size
|
||||
-1 name format is incorrect
|
||||
-1 name format is incorrect
|
||||
*****************************************************************/
|
||||
int res_nmkquery (res_state statp,
|
||||
int op, const char * dnameptr, int qclass, int qtype,
|
||||
@ -608,9 +608,7 @@ int res_mkquery (int op, const char * dnameptr, int qclass, int qtype,
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
res_query()
|
||||
|
||||
* res_query()
|
||||
*****************************************************************/
|
||||
|
||||
int res_nquery( res_state statp, const char * DomName, int Class, int Type,
|
||||
@ -640,9 +638,7 @@ int res_query( const char * DomName, int Class, int Type, unsigned char * AnsPtr
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
res_querydomain()
|
||||
|
||||
* res_querydomain()
|
||||
*****************************************************************/
|
||||
int res_nquerydomain( res_state statp, const char * Name, const char * DomName,
|
||||
int Class, int Type, unsigned char * AnsPtr, int AnsLength)
|
||||
@ -746,13 +742,11 @@ int res_search( const char * DomName, int Class, int Type,
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
dn_expand
|
||||
|
||||
* dn_expand
|
||||
*****************************************************************/
|
||||
|
||||
int dn_expand(const unsigned char *msg, const unsigned char *eomorig,
|
||||
const unsigned char *comp_dn, char *exp_dn, int length)
|
||||
const unsigned char *comp_dn, char *exp_dn, int length)
|
||||
{
|
||||
unsigned int len, complen = 0;
|
||||
const unsigned char *comp_dn_orig = comp_dn;
|
||||
@ -767,8 +761,8 @@ int dn_expand(const unsigned char *msg, const unsigned char *eomorig,
|
||||
if (len <= MAXLABEL) {
|
||||
if ((length -= (len + 1)) > 0 /* Need space for final . */
|
||||
&& comp_dn + len <= eomorig) {
|
||||
do { *exp_dn++ = *comp_dn++; } while (--len != 0);
|
||||
*exp_dn++ = '.';
|
||||
do { *exp_dn++ = *comp_dn++; } while (--len != 0);
|
||||
*exp_dn++ = '.';
|
||||
}
|
||||
else
|
||||
goto expand_fail;
|
||||
|
@ -23,7 +23,7 @@ insque (void *velement, void *vpred)
|
||||
if (pred)
|
||||
{
|
||||
if ((succ = element->q_forw = pred->q_forw))
|
||||
succ->q_back = element;
|
||||
succ->q_back = element;
|
||||
pred->q_forw = element;
|
||||
}
|
||||
else
|
||||
|
@ -249,7 +249,7 @@ next_char (UINT cp, const unsigned char *str, const unsigned char *end)
|
||||
case 950:
|
||||
case 1361:
|
||||
if (*str <= 0x7f)
|
||||
ret = str + 1;
|
||||
ret = str + 1;
|
||||
else if (str == end - 1 && IsDBCSLeadByteEx (cp, *str))
|
||||
ret = str;
|
||||
else
|
||||
|
@ -1088,7 +1088,7 @@ munmap (void *addr, size_t len)
|
||||
DWORD u_len;
|
||||
|
||||
LIST_FOREACH_SAFE (rec, &map_list->recs, mr_next, next_rec)
|
||||
{
|
||||
{
|
||||
if (!rec->match ((caddr_t) addr, len, u_addr, u_len))
|
||||
continue;
|
||||
if (rec->unmap_pages (u_addr, u_len))
|
||||
@ -1207,7 +1207,7 @@ mprotect (void *addr, size_t len, int prot)
|
||||
DWORD u_len;
|
||||
|
||||
LIST_FOREACH (rec, &map_list->recs, mr_next)
|
||||
{
|
||||
{
|
||||
if (!rec->match ((caddr_t) addr, len, u_addr, u_len))
|
||||
continue;
|
||||
in_mapped = true;
|
||||
@ -1649,7 +1649,7 @@ fhandler_dev_mem::mmap (caddr_t *addr, size_t len, int prot,
|
||||
}
|
||||
|
||||
void *base = MapView (h, *addr, len, get_access (), prot,
|
||||
flags | MAP_ANONYMOUS, off);
|
||||
flags | MAP_ANONYMOUS, off);
|
||||
if (!base || (fixed (flags) && base != *addr))
|
||||
{
|
||||
if (!base)
|
||||
|
@ -790,7 +790,7 @@ extern "C"
|
||||
PIO_STATUS_BLOCK, ULONG, ULONG, ULONG,
|
||||
PLARGE_INTEGER);
|
||||
NTSTATUS NTAPI NtCreateSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
||||
PLARGE_INTEGER, ULONG, ULONG, HANDLE);
|
||||
PLARGE_INTEGER, ULONG, ULONG, HANDLE);
|
||||
NTSTATUS NTAPI NtCreateToken (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
||||
TOKEN_TYPE, PLUID, PLARGE_INTEGER, PTOKEN_USER,
|
||||
PTOKEN_GROUPS, PTOKEN_PRIVILEGES, PTOKEN_OWNER,
|
||||
@ -804,11 +804,11 @@ extern "C"
|
||||
PLARGE_INTEGER, PULONG, SECTION_INHERIT,
|
||||
ULONG, ULONG);
|
||||
NTSTATUS NTAPI NtNotifyChangeDirectoryFile (HANDLE, HANDLE, PIO_APC_ROUTINE,
|
||||
PVOID, PIO_STATUS_BLOCK,
|
||||
PVOID, PIO_STATUS_BLOCK,
|
||||
PFILE_NOTIFY_INFORMATION, ULONG,
|
||||
ULONG, BOOLEAN);
|
||||
NTSTATUS NTAPI NtOpenDirectoryObject (PHANDLE, ACCESS_MASK,
|
||||
POBJECT_ATTRIBUTES);
|
||||
POBJECT_ATTRIBUTES);
|
||||
NTSTATUS NTAPI NtOpenFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
||||
PIO_STATUS_BLOCK, ULONG, ULONG);
|
||||
NTSTATUS NTAPI NtOpenSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
|
||||
@ -821,7 +821,7 @@ extern "C"
|
||||
FILE_INFORMATION_CLASS, BOOLEAN,
|
||||
PUNICODE_STRING, BOOLEAN);
|
||||
NTSTATUS NTAPI NtQueryDirectoryObject (HANDLE, PVOID, ULONG, BOOLEAN,
|
||||
BOOLEAN, PULONG, PULONG);
|
||||
BOOLEAN, PULONG, PULONG);
|
||||
NTSTATUS NTAPI NtQueryEaFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG,
|
||||
BOOLEAN, PVOID, ULONG, PULONG, BOOLEAN);
|
||||
NTSTATUS NTAPI NtQueryFullAttributesFile (POBJECT_ATTRIBUTES,
|
||||
@ -835,7 +835,7 @@ extern "C"
|
||||
NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS,
|
||||
PVOID, ULONG, PULONG);
|
||||
NTSTATUS NTAPI NtQuerySecurityObject (HANDLE, SECURITY_INFORMATION,
|
||||
PSECURITY_DESCRIPTOR, ULONG, PULONG);
|
||||
PSECURITY_DESCRIPTOR, ULONG, PULONG);
|
||||
NTSTATUS NTAPI NtQueryVirtualMemory (HANDLE, PVOID, MEMORY_INFORMATION_CLASS,
|
||||
PVOID, ULONG, PULONG);
|
||||
NTSTATUS NTAPI NtQueryVolumeInformationFile (HANDLE, IO_STATUS_BLOCK *,
|
||||
@ -912,7 +912,7 @@ extern "C"
|
||||
If you know it's 0-terminated, just use RtlInitUnicodeString(). */
|
||||
inline
|
||||
VOID NTAPI RtlInitCountedUnicodeString (PUNICODE_STRING dest, PCWSTR buf,
|
||||
USHORT len)
|
||||
USHORT len)
|
||||
{
|
||||
dest->Length = dest->MaximumLength = len;
|
||||
dest->Buffer = (PWSTR) buf;
|
||||
|
@ -57,7 +57,7 @@ read_ea (HANDLE hdl, path_conv &pc, const char *name, char *value, size_t size)
|
||||
pc.get_object_attr (attr, sec_none_nih);
|
||||
|
||||
debug_printf ("read_ea (%S, %s, %p, %lu)",
|
||||
attr.ObjectName, name, value, size);
|
||||
attr.ObjectName, name, value, size);
|
||||
|
||||
fea = (PFILE_FULL_EA_INFORMATION) alloca (EA_BUFSIZ);
|
||||
|
||||
@ -78,7 +78,7 @@ read_ea (HANDLE hdl, path_conv &pc, const char *name, char *value, size_t size)
|
||||
}
|
||||
|
||||
if ((nlen = strlen (name)) >= MAX_EA_NAME_LEN)
|
||||
{
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
@ -112,7 +112,7 @@ read_ea (HANDLE hdl, path_conv &pc, const char *name, char *value, size_t size)
|
||||
else if (status == STATUS_NONEXISTENT_EA_ENTRY)
|
||||
/* Actually this error code is either never generated, or it was only
|
||||
generated in some old and long forgotton NT version. See below. */
|
||||
set_errno (ENOATTR);
|
||||
set_errno (ENOATTR);
|
||||
else
|
||||
__seterrno_from_nt_status (status);
|
||||
goto out;
|
||||
@ -146,7 +146,7 @@ read_ea (HANDLE hdl, path_conv &pc, const char *name, char *value, size_t size)
|
||||
{
|
||||
ret = 0;
|
||||
do
|
||||
{
|
||||
{
|
||||
if (pc.fs_is_samba ()) /* See below. */
|
||||
fea->EaNameLength += 5;
|
||||
if (size > 0)
|
||||
@ -186,7 +186,7 @@ out:
|
||||
if (!hdl)
|
||||
CloseHandle (h);
|
||||
debug_printf ("%d = read_ea (%S, %s, %p, %lu)",
|
||||
ret, attr.ObjectName, name, value, size);
|
||||
ret, attr.ObjectName, name, value, size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ write_ea (HANDLE hdl, path_conv &pc, const char *name, const char *value,
|
||||
pc.get_object_attr (attr, sec_none_nih);
|
||||
|
||||
debug_printf ("write_ea (%S, %s, %p, %lu, %d)",
|
||||
attr.ObjectName, name, value, size, flags);
|
||||
attr.ObjectName, name, value, size, flags);
|
||||
|
||||
/* Samba hides the user namespace from Windows clients. If we get a
|
||||
user namespace item, we remove the leading namespace from the name.
|
||||
@ -238,7 +238,7 @@ write_ea (HANDLE hdl, path_conv &pc, const char *name, const char *value,
|
||||
}
|
||||
ssize_t rret = read_ea (hdl, pc, name, NULL, 0);
|
||||
if (flags == XATTR_CREATE && rret > 0)
|
||||
{
|
||||
{
|
||||
set_errno (EEXIST);
|
||||
goto out;
|
||||
}
|
||||
@ -297,7 +297,7 @@ out:
|
||||
if (!hdl)
|
||||
CloseHandle (h);
|
||||
debug_printf ("%d = write_ea (%S, %s, %p, %lu, %d)",
|
||||
ret, attr.ObjectName, name, value, size, flags);
|
||||
ret, attr.ObjectName, name, value, size, flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -316,7 +316,7 @@ getxattr_worker (path_conv &pc, const char *name, void *value, size_t size)
|
||||
fhandler_base *fh;
|
||||
|
||||
if (!(fh = build_fh_pc (pc)))
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
res = fh->fgetxattr (name, value, size);
|
||||
delete fh;
|
||||
@ -411,7 +411,7 @@ setxattr_worker (path_conv &pc, const char *name, const void *value,
|
||||
fhandler_base *fh;
|
||||
|
||||
if (!(fh = build_fh_pc (pc)))
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
res = fh->fsetxattr (name, value, size, flags);
|
||||
delete fh;
|
||||
|
@ -419,7 +419,7 @@ fs_info::update (PUNICODE_STRING upath, bool exists)
|
||||
RtlSplitUnicodePath (attr.ObjectName, &dir, NULL);
|
||||
attr.ObjectName = &dir;
|
||||
if (status == STATUS_NO_MEDIA_IN_DEVICE)
|
||||
{
|
||||
{
|
||||
no_media = true;
|
||||
dir.Length = 6 * sizeof (WCHAR);
|
||||
}
|
||||
@ -437,7 +437,7 @@ fs_info::update (PUNICODE_STRING upath, bool exists)
|
||||
return false;
|
||||
}
|
||||
status = NtQueryVolumeInformationFile (vol, &io, &ffdi, sizeof ffdi,
|
||||
FileFsDeviceInformation);
|
||||
FileFsDeviceInformation);
|
||||
if (!NT_SUCCESS (status))
|
||||
ffdi.DeviceType = ffdi.Characteristics = 0;
|
||||
|
||||
@ -1996,7 +1996,7 @@ mount_info::conv_to_posix_path (PWCHAR src_path, char *posix_path,
|
||||
{
|
||||
src_path += 4;
|
||||
if (!wcsncmp (src_path, L"UNC\\", 4))
|
||||
{
|
||||
{
|
||||
src_path += 2;
|
||||
src_path[0] = L'\\';
|
||||
changed = true;
|
||||
@ -2990,7 +2990,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
|
||||
}
|
||||
|
||||
syscall_printf ("symlink (%s, %S)", oldpath,
|
||||
win32_newpath.get_nt_native_path ());
|
||||
win32_newpath.get_nt_native_path ());
|
||||
|
||||
if ((!isdevice && win32_newpath.exists ())
|
||||
|| win32_newpath.is_auto_device ())
|
||||
@ -3007,7 +3007,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
|
||||
char desc[MAX_PATH + 1], *relpath;
|
||||
|
||||
if (!isdevice)
|
||||
{
|
||||
{
|
||||
/* First create an IDLIST to learn how big our shortcut is
|
||||
going to be. */
|
||||
IShellFolder *psl;
|
||||
@ -3181,7 +3181,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
|
||||
status = NtSetInformationFile (fh, &io, &fbi, sizeof fbi,
|
||||
FileBasicInformation);
|
||||
if (!NT_SUCCESS (status))
|
||||
debug_printf ("Setting attributes failed, status = %p", status);
|
||||
debug_printf ("Setting attributes failed, status = %p", status);
|
||||
res = 0;
|
||||
}
|
||||
else
|
||||
@ -3191,7 +3191,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
|
||||
status = NtSetInformationFile (fh, &io, &fdi, sizeof fdi,
|
||||
FileDispositionInformation);
|
||||
if (!NT_SUCCESS (status))
|
||||
debug_printf ("Setting delete dispostion failed, status = %p", status);
|
||||
debug_printf ("Setting delete dispostion failed, status = %p", status);
|
||||
}
|
||||
NtClose (fh);
|
||||
|
||||
@ -3313,10 +3313,7 @@ symlink_info::check_sysfile (HANDLE h)
|
||||
set_error (EIO);
|
||||
}
|
||||
else if (io.Information > SYMLINK_MAX + 1)
|
||||
{
|
||||
debug_printf ("symlink string too long");
|
||||
|
||||
}
|
||||
debug_printf ("symlink string too long");
|
||||
else
|
||||
res = posixify (srcbuf);
|
||||
}
|
||||
@ -3650,7 +3647,7 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt)
|
||||
get_nt_native_path (suffix.path, upath);
|
||||
status = NtQueryAttributesFile (&attr, &fbi);
|
||||
if (NT_SUCCESS (status))
|
||||
fileattr = fbi.FileAttributes;
|
||||
fileattr = fbi.FileAttributes;
|
||||
else
|
||||
{
|
||||
debug_printf ("%p = NtQueryAttributesFile (%S)", status, &upath);
|
||||
@ -3693,12 +3690,12 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt)
|
||||
| FILE_OPEN_FOR_BACKUP_INTENT
|
||||
| FILE_DIRECTORY_FILE);
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
{
|
||||
debug_printf ("%p = NtOpenFile(%S)", status, &dirname);
|
||||
fileattr = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
status = NtQueryDirectoryFile (dir, NULL, NULL, 0, &io,
|
||||
&fdi, sizeof fdi,
|
||||
FileDirectoryInformation,
|
||||
@ -3726,7 +3723,7 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt)
|
||||
goto file_not_symlink;
|
||||
}
|
||||
if (set_error (geterrno_from_win_error
|
||||
(RtlNtStatusToDosError (status), EACCES)))
|
||||
(RtlNtStatusToDosError (status), EACCES)))
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -4487,7 +4484,7 @@ cwdstuff::set (PUNICODE_STRING nat_cwd, const char *posix_cwd, bool doit)
|
||||
For now, we just don't store the path in the PEB and proceed as
|
||||
usual. */
|
||||
&& len <= MAX_PATH - (nat_cwd->Buffer[len - 1] == L'\\' ? 1 : 2))
|
||||
{
|
||||
{
|
||||
/* Convert to a Win32 path. */
|
||||
upath.Buffer += upath.Length / sizeof (WCHAR) - len;
|
||||
if (upath.Buffer[1] == L'\\') /* UNC path */
|
||||
|
@ -96,16 +96,6 @@ public:
|
||||
|
||||
inline void set_has_pgid_children (bool val) {has_pgid_children = val;}
|
||||
|
||||
inline sigset_t& getsigmask ()
|
||||
{
|
||||
return sig_mask;
|
||||
}
|
||||
|
||||
inline void setsigmask (sigset_t mask)
|
||||
{
|
||||
sig_mask = mask;
|
||||
}
|
||||
|
||||
commune_result commune_request (__uint32_t, ...);
|
||||
bool alive ();
|
||||
fhandler_pipe *pipe_fhandler (HANDLE, size_t &);
|
||||
@ -128,8 +118,6 @@ public:
|
||||
HANDLE sendsig;
|
||||
HANDLE exec_sendsig;
|
||||
DWORD exec_dwProcessId;
|
||||
private:
|
||||
sigset_t sig_mask;
|
||||
public:
|
||||
HANDLE wr_proc_pipe;
|
||||
DWORD wr_proc_pipe_owner;
|
||||
|
@ -115,7 +115,6 @@ pipe_handler (LPVOID in_ps)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
pipesync::pipesync (HANDLE f, DWORD is_reader):
|
||||
reader (false), ret_handle (NULL)
|
||||
{
|
||||
|
@ -221,7 +221,6 @@ get_registry_hive_path (const PWCHAR name, PWCHAR path)
|
||||
if (!RegOpenKeyExW (HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hkey))
|
||||
{
|
||||
WCHAR buf[NT_MAX_PATH];
|
||||
WCHAR tmp[NT_MAX_PATH];
|
||||
DWORD type, siz;
|
||||
|
||||
path[0] = L'\0';
|
||||
|
@ -55,7 +55,7 @@ get_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd)
|
||||
{
|
||||
set_errno (ENOMEM);
|
||||
break;
|
||||
}
|
||||
}
|
||||
status = NtQuerySecurityObject (fh, ALL_SECURITY_INFORMATION,
|
||||
sd, len, &len);
|
||||
}
|
||||
@ -66,7 +66,7 @@ get_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd)
|
||||
}
|
||||
}
|
||||
if (!retry)
|
||||
{
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
IO_STATUS_BLOCK io;
|
||||
|
||||
@ -98,7 +98,7 @@ set_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd)
|
||||
for (; retry < 2; ++retry)
|
||||
{
|
||||
if (fh)
|
||||
{
|
||||
{
|
||||
status = NtSetSecurityObject (fh, ALL_SECURITY_INFORMATION, sd);
|
||||
if (NT_SUCCESS (status))
|
||||
{
|
||||
@ -107,7 +107,7 @@ set_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd)
|
||||
}
|
||||
}
|
||||
if (!retry)
|
||||
{
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
IO_STATUS_BLOCK io;
|
||||
|
||||
@ -338,7 +338,7 @@ get_file_attribute (HANDLE handle, path_conv &pc,
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if (uidret)
|
||||
*uidret = ILLEGAL_UID;
|
||||
if (gidret)
|
||||
|
@ -206,11 +206,11 @@ public:
|
||||
cygsid above. */
|
||||
BOOL operator+= (cygsid &si) { return add ((PSID) si, false); }
|
||||
BOOL operator+= (const char *sidstr) { cygsid nsi (sidstr);
|
||||
return add ((PSID) nsi, false); }
|
||||
return add ((PSID) nsi, false); }
|
||||
BOOL operator+= (const PSID psid) { return add (psid, false); }
|
||||
BOOL operator*= (cygsid &si) { return add ((PSID) si, true); }
|
||||
BOOL operator*= (const char *sidstr) { cygsid nsi (sidstr);
|
||||
return add ((PSID) nsi, true); }
|
||||
return add ((PSID) nsi, true); }
|
||||
BOOL operator*= (const PSID psid) { return add (psid, true); }
|
||||
|
||||
void count (int ncnt)
|
||||
@ -220,7 +220,7 @@ public:
|
||||
{
|
||||
int wcnt = 0;
|
||||
for (int i = 0; i < cnt; ++i)
|
||||
if (!sids[i].is_well_known_sid ())
|
||||
if (!sids[i].is_well_known_sid ())
|
||||
++wcnt;
|
||||
return wcnt;
|
||||
}
|
||||
@ -236,7 +236,7 @@ public:
|
||||
int next_non_well_known_sid (int idx)
|
||||
{
|
||||
while (++idx < cnt)
|
||||
if (!sids[idx].is_well_known_sid ())
|
||||
if (!sids[idx].is_well_known_sid ())
|
||||
return idx;
|
||||
return -1;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ pselect(int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
||||
const struct timespec *ts, const sigset_t *set)
|
||||
{
|
||||
struct timeval tv;
|
||||
sigset_t oldset = myself->getsigmask ();
|
||||
sigset_t oldset = _my_tls.sigmask;
|
||||
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
@ -171,11 +171,11 @@ pselect(int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
||||
tv.tv_usec = ts->tv_nsec / 1000;
|
||||
}
|
||||
if (set)
|
||||
set_signal_mask (*set, myself->getsigmask ());
|
||||
set_signal_mask (*set, _my_tls.sigmask);
|
||||
int ret = cygwin_select (maxfds, readfds, writefds, exceptfds,
|
||||
ts ? &tv : NULL);
|
||||
if (set)
|
||||
set_signal_mask (oldset, myself->getsigmask ());
|
||||
set_signal_mask (oldset, _my_tls.sigmask);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ usleep (useconds_t useconds)
|
||||
extern "C" int
|
||||
sigprocmask (int how, const sigset_t *set, sigset_t *oldset)
|
||||
{
|
||||
return handle_sigprocmask (how, set, oldset, myself->getsigmask ());
|
||||
return handle_sigprocmask (how, set, oldset, _my_tls.sigmask);
|
||||
}
|
||||
|
||||
int __stdcall
|
||||
@ -342,7 +342,7 @@ abort (void)
|
||||
sigset_t sig_mask;
|
||||
sigfillset (&sig_mask);
|
||||
sigdelset (&sig_mask, SIGABRT);
|
||||
set_signal_mask (sig_mask, myself->getsigmask ());
|
||||
set_signal_mask (sig_mask, _my_tls.sigmask);
|
||||
|
||||
raise (SIGABRT);
|
||||
_my_tls.call_signal_handler (); /* Call any signal handler */
|
||||
@ -485,7 +485,7 @@ sigpause (int signal_mask)
|
||||
extern "C" int
|
||||
pause (void)
|
||||
{
|
||||
return handle_sigsuspend (myself->getsigmask ());
|
||||
return handle_sigsuspend (_my_tls.sigmask);
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
|
@ -663,7 +663,7 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls)
|
||||
else if (si.si_signo == __SIGPENDING)
|
||||
pack.mask = &pending;
|
||||
else if (si.si_signo == __SIGFLUSH || si.si_signo > 0)
|
||||
pack.mask = &myself->getsigmask ();
|
||||
pack.mask = &_my_tls.sigmask;
|
||||
else
|
||||
pack.mask = NULL;
|
||||
|
||||
@ -1118,7 +1118,7 @@ pending_signals::add (sigpacket& pack)
|
||||
return;
|
||||
se = sigs + pack.si.si_signo;
|
||||
*se = pack;
|
||||
se->mask = &myself->getsigmask ();
|
||||
se->mask = &pack.tls->sigmask;
|
||||
se->next = NULL;
|
||||
if (end)
|
||||
end->next = se;
|
||||
@ -1199,7 +1199,7 @@ wait_sig (VOID *)
|
||||
sigset_t dummy_mask;
|
||||
if (!pack.mask)
|
||||
{
|
||||
dummy_mask = myself->getsigmask ();
|
||||
dummy_mask = _main_tls->sigmask;
|
||||
pack.mask = &dummy_mask;
|
||||
}
|
||||
|
||||
@ -1218,7 +1218,7 @@ wait_sig (VOID *)
|
||||
unsigned bit;
|
||||
sigq.reset ();
|
||||
while ((q = sigq.next ()))
|
||||
if (myself->getsigmask () & (bit = SIGTOMASK (q->si.si_signo)))
|
||||
if (pack.tls->sigmask & (bit = SIGTOMASK (q->si.si_signo)))
|
||||
*pack.mask |= bit;
|
||||
break;
|
||||
case __SIGHOLD:
|
||||
|
@ -70,11 +70,11 @@ sys_wcstombs_alloc (char **tgt_p, int type, const PWCHAR src, int slen)
|
||||
size_t tlen = (slen == -1 ? ret : ret + 1);
|
||||
|
||||
if (type == HEAP_NOTHEAP)
|
||||
*tgt_p = (char *) calloc (tlen, sizeof (char));
|
||||
*tgt_p = (char *) calloc (tlen, sizeof (char));
|
||||
else
|
||||
*tgt_p = (char *) ccalloc ((cygheap_types) type, tlen, sizeof (char));
|
||||
*tgt_p = (char *) ccalloc ((cygheap_types) type, tlen, sizeof (char));
|
||||
if (!*tgt_p)
|
||||
return 0;
|
||||
return 0;
|
||||
ret = sys_wcstombs (*tgt_p, tlen, src, slen);
|
||||
}
|
||||
return ret;
|
||||
@ -97,11 +97,11 @@ sys_mbstowcs_alloc (PWCHAR *tgt_p, int type, const char *src)
|
||||
if (ret)
|
||||
{
|
||||
if (type == HEAP_NOTHEAP)
|
||||
*tgt_p = (PWCHAR) calloc (ret, sizeof (WCHAR));
|
||||
*tgt_p = (PWCHAR) calloc (ret, sizeof (WCHAR));
|
||||
else
|
||||
*tgt_p = (PWCHAR) ccalloc ((cygheap_types) type, ret, sizeof (WCHAR));
|
||||
*tgt_p = (PWCHAR) ccalloc ((cygheap_types) type, ret, sizeof (WCHAR));
|
||||
if (!*tgt_p)
|
||||
return 0;
|
||||
return 0;
|
||||
ret = sys_mbstowcs (*tgt_p, src, ret);
|
||||
}
|
||||
return ret;
|
||||
|
@ -287,9 +287,9 @@ try_to_bin (path_conv &win32_path, HANDLE h)
|
||||
goto out;
|
||||
}
|
||||
/* Next, if necessary, check if the recycler/SID dir exists and
|
||||
create it if not. */
|
||||
create it if not. */
|
||||
if (win32_path.fs_is_ntfs ())
|
||||
{
|
||||
{
|
||||
NtClose (recyclerdir);
|
||||
recycler.Length = recycler_user_len;
|
||||
status = NtCreateFile (&recyclerdir, READ_CONTROL | FILE_ADD_FILE,
|
||||
@ -306,10 +306,10 @@ try_to_bin (path_conv &win32_path, HANDLE h)
|
||||
}
|
||||
}
|
||||
/* The desktop.ini and INFO2 (pre-Vista) files are expected by
|
||||
Windows Explorer. Otherwise, the created bin is treated as
|
||||
Windows Explorer. Otherwise, the created bin is treated as
|
||||
corrupted */
|
||||
if (io.Information == FILE_CREATED)
|
||||
{
|
||||
{
|
||||
HANDLE fh;
|
||||
RtlInitUnicodeString (&fname, L"desktop.ini");
|
||||
InitializeObjectAttributes (&attr, &fname, OBJ_CASE_INSENSITIVE,
|
||||
@ -326,7 +326,7 @@ try_to_bin (path_conv &win32_path, HANDLE h)
|
||||
status = NtWriteFile (fh, NULL, NULL, NULL, &io, desktop_ini,
|
||||
sizeof desktop_ini - 1, NULL, NULL);
|
||||
if (!NT_SUCCESS (status))
|
||||
debug_printf ("NtWriteFile (%S) failed, %08x", &fname, status);
|
||||
debug_printf ("NtWriteFile (%S) failed, %08x", &fname, status);
|
||||
NtClose (fh);
|
||||
}
|
||||
if (!wincap.has_recycle_dot_bin ()) /* No INFO2 file since Vista */
|
||||
@ -455,7 +455,7 @@ unlink_nt (path_conv &pc)
|
||||
{
|
||||
status = check_dir_not_empty (fh);
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
{
|
||||
NtClose (fh);
|
||||
return status;
|
||||
}
|
||||
@ -1504,7 +1504,7 @@ rename (const char *oldpath, const char *newpath)
|
||||
{
|
||||
stpcpy (oldbuf = (char *) alloca (olen + 1), oldpath);
|
||||
while (olen > 0 && isdirsep (oldbuf[olen - 1]))
|
||||
oldbuf[--olen] = '\0';
|
||||
oldbuf[--olen] = '\0';
|
||||
oldpath = oldbuf;
|
||||
old_dir_requested = true;
|
||||
}
|
||||
@ -1539,7 +1539,7 @@ rename (const char *oldpath, const char *newpath)
|
||||
{
|
||||
stpcpy (newbuf = (char *) alloca (nlen + 1), newpath);
|
||||
while (nlen > 0 && isdirsep (newbuf[nlen - 1]))
|
||||
newbuf[--nlen] = '\0';
|
||||
newbuf[--nlen] = '\0';
|
||||
newpath = newbuf;
|
||||
new_dir_requested = true;
|
||||
}
|
||||
@ -1593,7 +1593,7 @@ rename (const char *oldpath, const char *newpath)
|
||||
&& newpc.get_nt_native_path ()->Length >
|
||||
oldpc.get_nt_native_path ()->Length
|
||||
&& *(PWCHAR) ((PBYTE) newpc.get_nt_native_path ()->Buffer
|
||||
+ oldpc.get_nt_native_path ()->Length) == L'\\')
|
||||
+ oldpc.get_nt_native_path ()->Length) == L'\\')
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
goto out;
|
||||
@ -1615,12 +1615,12 @@ rename (const char *oldpath, const char *newpath)
|
||||
else if (oldpc.is_lnk_symlink ()
|
||||
&& !RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
|
||||
L".lnk", TRUE))
|
||||
rename_append_suffix (newpc, newpath, nlen, ".lnk");
|
||||
rename_append_suffix (newpc, newpath, nlen, ".lnk");
|
||||
else if (oldpc.is_binary ()
|
||||
&& !RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
|
||||
L".exe", TRUE))
|
||||
/* NOTE: No way to rename an executable foo.exe to foo. */
|
||||
rename_append_suffix (newpc, newpath, nlen, ".exe");
|
||||
rename_append_suffix (newpc, newpath, nlen, ".exe");
|
||||
}
|
||||
else if (newpc.isdir ())
|
||||
{
|
||||
@ -1641,7 +1641,7 @@ rename (const char *oldpath, const char *newpath)
|
||||
}
|
||||
}
|
||||
else if (oldpc.is_lnk_symlink ())
|
||||
{
|
||||
{
|
||||
if (!newpc.is_lnk_symlink ()
|
||||
&& !RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
|
||||
L".lnk", TRUE))
|
||||
@ -1658,9 +1658,9 @@ rename (const char *oldpath, const char *newpath)
|
||||
rename_append_suffix (new2pc, newpath, nlen, ".exe");
|
||||
removepc = &newpc;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if ((RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
|
||||
L".lnk", TRUE)
|
||||
|| RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
|
||||
@ -1712,7 +1712,7 @@ rename (const char *oldpath, const char *newpath)
|
||||
| (dstpc->is_rep_symlink ()
|
||||
? FILE_OPEN_REPARSE_POINT : 0));
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
{
|
||||
__seterrno_from_nt_status (status);
|
||||
goto out;
|
||||
}
|
||||
@ -1726,7 +1726,7 @@ rename (const char *oldpath, const char *newpath)
|
||||
FileBasicInformation);
|
||||
NtClose (nfh);
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
{
|
||||
__seterrno_from_nt_status (status);
|
||||
goto out;
|
||||
}
|
||||
@ -1749,7 +1749,7 @@ rename (const char *oldpath, const char *newpath)
|
||||
&io, FILE_SHARE_VALID_FLAGS,
|
||||
FILE_OPEN_FOR_BACKUP_INTENT
|
||||
| ((removepc ?: dstpc)->is_rep_symlink ()
|
||||
? FILE_OPEN_REPARSE_POINT : 0))))
|
||||
? FILE_OPEN_REPARSE_POINT : 0))))
|
||||
{
|
||||
static const size_t vsiz = sizeof (FILE_FS_VOLUME_INFORMATION)
|
||||
+ 32 * sizeof (WCHAR);
|
||||
|
@ -376,6 +376,7 @@ pthread::pthread ():verifyable_object (PTHREAD_MAGIC), win32_obj_id (0),
|
||||
{
|
||||
if (this != pthread_null::get_null_pthread ())
|
||||
threads.insert (this);
|
||||
parent_tls = &_my_tls;
|
||||
}
|
||||
|
||||
pthread::~pthread ()
|
||||
@ -1738,6 +1739,7 @@ pthread::thread_init_wrapper (void *arg)
|
||||
// if thread is detached force cleanup on exit
|
||||
if (thread->attr.joinable == PTHREAD_CREATE_DETACHED && thread->joiner == NULL)
|
||||
thread->joiner = thread;
|
||||
_my_tls.sigmask = thread->parent_tls->sigmask;
|
||||
thread->mutex.unlock ();
|
||||
|
||||
thread_printf ("started thread %p %p %p %p %p %p", arg, &_my_tls.local_clib,
|
||||
|
@ -434,6 +434,7 @@ private:
|
||||
DWORD thread_id;
|
||||
__pthread_cleanup_handler *cleanup_stack;
|
||||
pthread_mutex mutex;
|
||||
_cygtls *parent_tls;
|
||||
|
||||
void suspend_except_self ();
|
||||
void resume ();
|
||||
|
@ -179,8 +179,7 @@ extern HANDLE tty_mutex;
|
||||
})
|
||||
|
||||
/* Convert a signal to a signal mask */
|
||||
#define SIGTOMASK(sig) (1 << ((sig) - signal_shift_subtract))
|
||||
extern unsigned int signal_shift_subtract;
|
||||
#define SIGTOMASK(sig) (1 << ((sig) - 1))
|
||||
|
||||
extern int __api_fatal_exit_val;
|
||||
#define set_api_fatal_return(n) do {extern int __api_fatal_exit_val; __api_fatal_exit_val = (n);} while (0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user