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:
Christopher Faylor 2008-02-15 17:53:11 +00:00
parent d039978069
commit 70300fdb1c
45 changed files with 315 additions and 315 deletions

View File

@ -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> 2008-02-14 Corinna Vinschen <corinna@vinschen.de>
* cygheap.cc (cwcsdup): New function. * cygheap.cc (cwcsdup): New function.

View File

@ -49,9 +49,9 @@ typedef struct _LSA_SECPKG_FUNCS
NTSTATUS (NTAPI *AllocateClientBuffer)(PLSA_CLIENT_REQUEST, ULONG, PVOID *); NTSTATUS (NTAPI *AllocateClientBuffer)(PLSA_CLIENT_REQUEST, ULONG, PVOID *);
NTSTATUS (NTAPI *FreeClientBuffer)(PLSA_CLIENT_REQUEST, PVOID); NTSTATUS (NTAPI *FreeClientBuffer)(PLSA_CLIENT_REQUEST, PVOID);
NTSTATUS (NTAPI *CopyToClientBuffer)(PLSA_CLIENT_REQUEST, ULONG, NTSTATUS (NTAPI *CopyToClientBuffer)(PLSA_CLIENT_REQUEST, ULONG,
PVOID, PVOID); PVOID, PVOID);
NTSTATUS (NTAPI *CopyFromClientBuffer)(PLSA_CLIENT_REQUEST, ULONG, NTSTATUS (NTAPI *CopyFromClientBuffer)(PLSA_CLIENT_REQUEST, ULONG,
PVOID, PVOID); PVOID, PVOID);
NTSTATUS (NTAPI *ImpersonateClient)(VOID); NTSTATUS (NTAPI *ImpersonateClient)(VOID);
NTSTATUS (NTAPI *UnloadPackage)(VOID); NTSTATUS (NTAPI *UnloadPackage)(VOID);
NTSTATUS (NTAPI *DuplicateHandle)(HANDLE,PHANDLE); NTSTATUS (NTAPI *DuplicateHandle)(HANDLE,PHANDLE);

View File

@ -74,14 +74,6 @@ _cygtls NO_COPY *_main_tls;
bool NO_COPY cygwin_finished_initializing; 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; MTinterface _mtinterf;
bool NO_COPY _cygwin_testing; bool NO_COPY _cygwin_testing;
@ -443,10 +435,6 @@ check_sanity_and_sync (per_process *p)
if (p->api_major > cygwin_version.api_major) if (p->api_major > cygwin_version.api_major)
api_fatal ("cygwin DLL and APP are out of sync -- API version mismatch %d > %d", api_fatal ("cygwin DLL and APP are out of sync -- API version mismatch %d > %d",
p->api_major, cygwin_version.api_major); 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; child_info NO_COPY *child_proc_info = NULL;

View File

@ -43452,39 +43452,39 @@ device::parsedisk (int drive, int part)
int base; int base;
if (drive < ('q' - 'a')) /* /dev/sda -to- /dev/sdp */ if (drive < ('q' - 'a')) /* /dev/sda -to- /dev/sdp */
base = DEV_SD_MAJOR; 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; base = DEV_SD1_MAJOR;
drive -= 'q' - 'a'; 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; base = DEV_SD2_MAJOR;
drive -= 32; drive -= 32;
} }
else if (drive < 64) /* /dev/sdaw -to- /dev/sdbl */ else if (drive < 64) /* /dev/sdaw -to- /dev/sdbl */
{ {
base = DEV_SD3_MAJOR; base = DEV_SD3_MAJOR;
drive -= 48; drive -= 48;
} }
else if (drive < 80) /* /dev/sdbm -to- /dev/sdcb */ else if (drive < 80) /* /dev/sdbm -to- /dev/sdcb */
{ {
base = DEV_SD4_MAJOR; base = DEV_SD4_MAJOR;
drive -= 64; drive -= 64;
} }
else if (drive < 96) /* /dev/sdcc -to- /dev/sdcr */ else if (drive < 96) /* /dev/sdcc -to- /dev/sdcr */
{ {
base = DEV_SD5_MAJOR; base = DEV_SD5_MAJOR;
drive -= 80; drive -= 80;
} }
else if (drive < 112) /* /dev/sdcs -to- /dev/sddh */ else if (drive < 112) /* /dev/sdcs -to- /dev/sddh */
{ {
base = DEV_SD6_MAJOR; base = DEV_SD6_MAJOR;
drive -= 96; drive -= 96;
} }
/* NOTE: This will cause multiple /dev/sddx entries in /* NOTE: This will cause multiple /dev/sddx entries in
/proc/partitions if there are more than 128 devices */ /proc/partitions if there are more than 128 devices */
else /* /dev/sddi -to- /dev/sddx */ else /* /dev/sddi -to- /dev/sddx */
{ {
base = DEV_SD7_MAJOR; base = DEV_SD7_MAJOR;
drive -= 112; drive -= 112;

View File

@ -159,39 +159,39 @@ device::parsedisk (int drive, int part)
int base; int base;
if (drive < ('q' - 'a')) /* /dev/sda -to- /dev/sdp */ if (drive < ('q' - 'a')) /* /dev/sda -to- /dev/sdp */
base = DEV_SD_MAJOR; 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; base = DEV_SD1_MAJOR;
drive -= 'q' - 'a'; 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; base = DEV_SD2_MAJOR;
drive -= 32; drive -= 32;
} }
else if (drive < 64) /* /dev/sdaw -to- /dev/sdbl */ else if (drive < 64) /* /dev/sdaw -to- /dev/sdbl */
{ {
base = DEV_SD3_MAJOR; base = DEV_SD3_MAJOR;
drive -= 48; drive -= 48;
} }
else if (drive < 80) /* /dev/sdbm -to- /dev/sdcb */ else if (drive < 80) /* /dev/sdbm -to- /dev/sdcb */
{ {
base = DEV_SD4_MAJOR; base = DEV_SD4_MAJOR;
drive -= 64; drive -= 64;
} }
else if (drive < 96) /* /dev/sdcc -to- /dev/sdcr */ else if (drive < 96) /* /dev/sdcc -to- /dev/sdcr */
{ {
base = DEV_SD5_MAJOR; base = DEV_SD5_MAJOR;
drive -= 80; drive -= 80;
} }
else if (drive < 112) /* /dev/sdcs -to- /dev/sddh */ else if (drive < 112) /* /dev/sdcs -to- /dev/sddh */
{ {
base = DEV_SD6_MAJOR; base = DEV_SD6_MAJOR;
drive -= 96; drive -= 96;
} }
/* NOTE: This will cause multiple /dev/sddx entries in /* NOTE: This will cause multiple /dev/sddx entries in
/proc/partitions if there are more than 128 devices */ /proc/partitions if there are more than 128 devices */
else /* /dev/sddi -to- /dev/sddx */ else /* /dev/sddi -to- /dev/sddx */
{ {
base = DEV_SD7_MAJOR; base = DEV_SD7_MAJOR;
drive -= 112; drive -= 112;

View File

@ -45,7 +45,7 @@ for my $k (sort {$section{$a}{-idx} <=> $section{$b}{-idx}} keys %section) {
$vma = $section{$k}{-vma}; $vma = $section{$k}{-vma};
} }
if ($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) { if ($newvma != $vma) {
printf STDERR "$0: ERROR $k VMA 0x%08x != 0x%08x\n", $vma, $newvma; printf STDERR "$0: ERROR $k VMA 0x%08x != 0x%08x\n", $vma, $newvma;
exit 1; exit 1;

View File

@ -682,9 +682,9 @@ handle_sigsuspend (sigset_t tempmask)
return -1; 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); sigproc_printf ("oldmask %p, newmask %p", oldmask, tempmask);
pthread_testcancel (); pthread_testcancel ();
@ -995,8 +995,7 @@ ctrl_c_handler (DWORD type)
extern "C" void __stdcall extern "C" void __stdcall
set_process_mask (sigset_t newmask) set_process_mask (sigset_t newmask)
{ {
set_signal_mask (newmask, myself->getsigmask ()); set_signal_mask (newmask, _my_tls.sigmask);
sigproc_printf ("mask now %p\n", myself->getsigmask ());
} }
extern "C" int extern "C" int
@ -1010,9 +1009,9 @@ sighold (int sig)
return -1; return -1;
} }
mask_sync.acquire (INFINITE); mask_sync.acquire (INFINITE);
sigset_t mask = myself->getsigmask (); sigset_t mask = _my_tls.sigmask;
sigaddset (&mask, sig); sigaddset (&mask, sig);
set_signal_mask (mask, myself->getsigmask ()); set_signal_mask (mask, _my_tls.sigmask);
mask_sync.release (); mask_sync.release ();
return 0; return 0;
} }
@ -1028,9 +1027,9 @@ sigrelse (int sig)
return -1; return -1;
} }
mask_sync.acquire (INFINITE); mask_sync.acquire (INFINITE);
sigset_t mask = myself->getsigmask (); sigset_t mask = _my_tls.sigmask;
sigdelset (&mask, sig); sigdelset (&mask, sig);
set_signal_mask (mask, myself->getsigmask ()); set_signal_mask (mask, _my_tls.sigmask);
mask_sync.release (); mask_sync.release ();
return 0; return 0;
} }
@ -1050,7 +1049,7 @@ sigset (int sig, _sig_func_ptr func)
} }
mask_sync.acquire (INFINITE); 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 /* If sig was in the signal mask return SIG_HOLD, otherwise return the
previous disposition. */ previous disposition. */
if (sigismember (&mask, sig)) if (sigismember (&mask, sig))
@ -1068,7 +1067,7 @@ sigset (int sig, _sig_func_ptr func)
signal (sig, func); signal (sig, func);
sigdelset (&mask, sig); sigdelset (&mask, sig);
} }
set_signal_mask (mask, myself->getsigmask ()); set_signal_mask (mask, _my_tls.sigmask);
mask_sync.release (); mask_sync.release ();
return prev; return prev;
} }
@ -1090,11 +1089,11 @@ set_process_mask_delta ()
if (_my_tls.deltamask & SIG_NONMASKABLE) if (_my_tls.deltamask & SIG_NONMASKABLE)
oldmask = _my_tls.oldmask; /* from handle_sigsuspend */ oldmask = _my_tls.oldmask; /* from handle_sigsuspend */
else else
oldmask = myself->getsigmask (); oldmask = _my_tls.sigmask;
newmask = (oldmask | _my_tls.deltamask) & ~SIG_NONMASKABLE; newmask = (oldmask | _my_tls.deltamask) & ~SIG_NONMASKABLE;
sigproc_printf ("oldmask %p, newmask %p, deltamask %p", oldmask, newmask, sigproc_printf ("oldmask %p, newmask %p, deltamask %p", oldmask, newmask,
_my_tls.deltamask); _my_tls.deltamask);
myself->setsigmask (newmask); _my_tls.sigmask = newmask;
mask_sync.release (); mask_sync.release ();
return oldmask; return oldmask;
} }
@ -1362,7 +1361,7 @@ _cygtls::call_signal_handler ()
sigact (thissig, &thissi, NULL); sigact (thissig, &thissi, NULL);
} }
incyg = 1; incyg = 1;
set_signal_mask (this_oldmask, myself->getsigmask ()); set_signal_mask (this_oldmask, _my_tls.sigmask);
if (this_errno >= 0) if (this_errno >= 0)
set_errno (this_errno); set_errno (this_errno);
} }

View File

@ -940,7 +940,7 @@ fhandler_base::lseek (_off64_t offset, int whence)
status = NtQueryInformationFile (get_handle (), &io, &fpi, sizeof fpi, status = NtQueryInformationFile (get_handle (), &io, &fpi, sizeof fpi,
FilePositionInformation); FilePositionInformation);
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
{ {
__seterrno_from_nt_status (status); __seterrno_from_nt_status (status);
return -1; return -1;
} }
@ -950,7 +950,7 @@ fhandler_base::lseek (_off64_t offset, int whence)
status = NtQueryInformationFile (get_handle (), &io, &fsi, sizeof fsi, status = NtQueryInformationFile (get_handle (), &io, &fsi, sizeof fsi,
FileStandardInformation); FileStandardInformation);
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
{ {
__seterrno_from_nt_status (status); __seterrno_from_nt_status (status);
return -1; return -1;
} }

View File

@ -1465,7 +1465,7 @@ fhandler_console::write_normal (const unsigned char *src,
nfound = next_char (cp, trunc_buf.buf, nfound = next_char (cp, trunc_buf.buf,
trunc_buf.buf + trunc_buf.len + cp_len); trunc_buf.buf + trunc_buf.len + cp_len);
if (!nfound) /* Invalid multibyte sequence. */ 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) for (int i = 0; i < trunc_buf.len; ++i)
write_replacement_char (trunc_buf.buf + 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. */ if (!nfound) /* Invalid multibyte sequence. */
break; break;
if (nfound == found) /* Truncated multibyte sequence. */ 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; trunc_buf.len = end - found;
memcpy (trunc_buf.buf, found, trunc_buf.len); memcpy (trunc_buf.buf, found, trunc_buf.len);
return end; return end;

View File

@ -75,7 +75,7 @@ public:
~__DIR_mounts () ~__DIR_mounts ()
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
RtlFreeUnicodeString (&mounts[i]); RtlFreeUnicodeString (&mounts[i]);
RtlFreeUnicodeString (&cygdrive); RtlFreeUnicodeString (&cygdrive);
} }
__ino64_t check_mount (PUNICODE_STRING fname, __ino64_t ino, __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); pfai->BasicInformation.FileAttributes);
} }
debug_printf ("%p = NtQueryInformationFile(%S)", debug_printf ("%p = NtQueryInformationFile(%S)",
status, pc.get_nt_native_path ()); status, pc.get_nt_native_path ());
return -1; return -1;
} }
@ -354,7 +354,7 @@ fhandler_base::fstat_by_name (struct __stat64 *buf)
TRUE, &basename, TRUE))) TRUE, &basename, TRUE)))
FileId = pfdi->FileId; FileId = pfdi->FileId;
else if (NT_SUCCESS (status = NtQueryDirectoryFile (dir, NULL, NULL, 0, &io, else if (NT_SUCCESS (status = NtQueryDirectoryFile (dir, NULL, NULL, 0, &io,
pfdi, fdi_size, pfdi, fdi_size,
FileBothDirectoryInformation, FileBothDirectoryInformation,
TRUE, &basename, TRUE))) TRUE, &basename, TRUE)))
FileId.QuadPart = 0; /* get_namehash is called in fstat_helper. */ 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 (get_handle ())
{ {
if (!nohandle () && !is_fs_special ()) if (!nohandle () && !is_fs_special ())
res = fstat_by_handle (buf); res = fstat_by_handle (buf);
if (res) if (res)
res = fstat_by_name (buf); res = fstat_by_name (buf);
return res; return res;
@ -581,7 +581,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
InitializeObjectAttributes (&attr, &same, 0, get_handle (), NULL); InitializeObjectAttributes (&attr, &same, 0, get_handle (), NULL);
if (NT_SUCCESS (NtOpenFile (&h, FILE_READ_DATA, &attr, &io, if (NT_SUCCESS (NtOpenFile (&h, FILE_READ_DATA, &attr, &io,
FILE_SHARE_VALID_FLAGS, 0))) FILE_SHARE_VALID_FLAGS, 0)))
{ {
LARGE_INTEGER off = { QuadPart:0LL }; LARGE_INTEGER off = { QuadPart:0LL };
char magic[3]; char magic[3];
@ -1132,7 +1132,7 @@ fhandler_disk_file::link (const char *newpath)
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
{ {
if (status == STATUS_INVALID_DEVICE_REQUEST) if (status == STATUS_INVALID_DEVICE_REQUEST)
{ {
/* FS doesn't support hard links. Try to copy file. */ /* FS doesn't support hard links. Try to copy file. */
WCHAR pcw[pc.get_nt_native_path ()->Length + 1]; WCHAR pcw[pc.get_nt_native_path ()->Length + 1];
WCHAR newpcw[newpc.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); | FILE_ATTRIBUTE_READONLY);
} }
else else
{ {
__seterrno_from_nt_status (status); __seterrno_from_nt_status (status);
return -1; return -1;
} }
@ -1523,7 +1523,7 @@ fhandler_disk_file::rmdir ()
(pc.get_object_attr (attr, sec_none_nih), &fbi))) (pc.get_object_attr (attr, sec_none_nih), &fbi)))
status = STATUS_DIRECTORY_NOT_EMPTY; status = STATUS_DIRECTORY_NOT_EMPTY;
else else
status = STATUS_SUCCESS; status = STATUS_SUCCESS;
} }
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
{ {
@ -1691,7 +1691,7 @@ readdir_get_ino (const char *path, bool dot_dot)
fname = (char *) alloca (strlen (path) + 4); fname = (char *) alloca (strlen (path) + 4);
char *c = stpcpy (fname, path); char *c = stpcpy (fname, path);
if (c[-1] != '/') if (c[-1] != '/')
*c++ = '/'; *c++ = '/';
strcpy (c, ".."); strcpy (c, "..");
path = fname; path = fname;
} }

View File

@ -22,6 +22,7 @@ details. */
#include "dtable.h" #include "dtable.h"
#include "cygheap.h" #include "cygheap.h"
#include "ntdll.h" #include "ntdll.h"
#include "cygtls.h"
#include <sys/param.h> #include <sys/param.h>
#include <assert.h> #include <assert.h>
#include <sys/sysmacros.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, p->gid, p->gid, p->gid, p->gid,
vmsize >> 10, 0, vmrss >> 10, vmdata >> 10, 0, vmsize >> 10, 0, vmrss >> 10, vmdata >> 10, 0,
vmtext >> 10, vmlib >> 10, vmtext >> 10, vmlib >> 10,
0, 0, p->getsigmask () 0, 0, _my_tls.sigmask
); );
} }

View File

@ -426,7 +426,7 @@ search_wsa_event_slot (LONG new_serial_number)
if (!wsa_slot_mtx) if (!wsa_slot_mtx)
{ {
wsa_slot_mtx = CreateMutex (&sec_all, FALSE, wsa_slot_mtx = CreateMutex (&sec_all, FALSE,
shared_name (name, "sock", 0)); shared_name (name, "sock", 0));
if (!wsa_slot_mtx) if (!wsa_slot_mtx)
api_fatal ("Couldn't create/open shared socket mutex, %E"); 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 (waitall)
{ {
if (get_socket_type () != SOCK_STREAM) if (get_socket_type () != SOCK_STREAM)
{ {
WSASetLastError (WSAEOPNOTSUPP); WSASetLastError (WSAEOPNOTSUPP);
set_winsock_errno (); set_winsock_errno ();
return SOCKET_ERROR; return SOCKET_ERROR;
} }
if (is_nonblocking () || (flags & (MSG_OOB | MSG_PEEK))) if (is_nonblocking () || (flags & (MSG_OOB | MSG_PEEK)))
waitall = false; waitall = false;
} }
/* Note: Don't call WSARecvFrom(MSG_PEEK) without actually having data /* 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; wret = 0;
} }
else else
{ {
wret -= wsabuf->len; wret -= wsabuf->len;
++wsabuf; ++wsabuf;
--wsacnt; --wsacnt;

View File

@ -156,7 +156,7 @@ fhandler_termios::bg_check (int sig)
int pgid_gone = !pid_exists (myself->pgid); int pgid_gone = !pid_exists (myself->pgid);
int sigs_ignored = int sigs_ignored =
((void *) global_sigs[sig].sa_handler == (void *) SIG_IGN) || ((void *) global_sigs[sig].sa_handler == (void *) SIG_IGN) ||
(myself->getsigmask () & SIGTOMASK (sig)); (_main_tls->sigmask & SIGTOMASK (sig));
if (pgid_gone) if (pgid_gone)
goto setEIO; goto setEIO;

View File

@ -62,8 +62,6 @@ details. */
/* Every version of cygwin <= this uses an old, incorrect method /* Every version of cygwin <= this uses an old, incorrect method
to determine signal masks. */ to determine signal masks. */
#define CYGWIN_VERSION_DLL_BAD_SIGNAL_MASK 19005
#define CYGWIN_VERSION_USER_API_VERSION_COMBINED \ #define CYGWIN_VERSION_USER_API_VERSION_COMBINED \
CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor)
@ -311,7 +309,7 @@ details. */
169: Export confstr. 169: Export confstr.
170: Export insque, remque. 170: Export insque, remque.
171: Export exp10, exp10f, pow10, pow10f, strcasestr, funopen, 171: Export exp10, exp10f, pow10, pow10f, strcasestr, funopen,
fopencookie. fopencookie.
172: Export getifaddrs, freeifaddrs. 172: Export getifaddrs, freeifaddrs.
173: Export __assert_func. 173: Export __assert_func.
174: Export stpcpy, stpncpy. 174: Export stpcpy, stpncpy.

View File

@ -20,15 +20,15 @@ details. */
#if !defined(__SINGLE_THREAD__) #if !defined(__SINGLE_THREAD__)
# if !defined(_flockfile) # if !defined(_flockfile)
# define _flockfile(fp) ({ if (!((fp)->_flags & __SSTR)) \ # define _flockfile(fp) ({ if (!((fp)->_flags & __SSTR)) \
__cygwin_lock_lock ((_LOCK_T *)&(fp)->_lock); }) __cygwin_lock_lock ((_LOCK_T *)&(fp)->_lock); })
# endif # endif
# if !defined(_ftrylockfile) # if !defined(_ftrylockfile)
# define _ftrylockfile(fp) (((fp)->_flags & __SSTR) ? 0 : \ # define _ftrylockfile(fp) (((fp)->_flags & __SSTR) ? 0 : \
__cygwin_lock_trylock ((_LOCK_T *)&(fp)->_lock)) __cygwin_lock_trylock ((_LOCK_T *)&(fp)->_lock))
# endif # endif
# if !defined(_funlockfile) # if !defined(_funlockfile)
# define _funlockfile(fp) ({ if (!((fp)->_flags & __SSTR)) \ # define _funlockfile(fp) ({ if (!((fp)->_flags & __SSTR)) \
__cygwin_lock_unlock ((_LOCK_T *)&(fp)->_lock); }) __cygwin_lock_unlock ((_LOCK_T *)&(fp)->_lock); })
# endif # endif
#endif #endif

View File

@ -30,9 +30,7 @@ details. */
#include <sys/cygwin.h> #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)\ #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 HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ #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 #endif
DPRINTF(debug, "DnsQuery: %lu (Windows)\n", res); DPRINTF(debug, "DnsQuery: %lu (Windows)\n", res);
@ -322,7 +320,7 @@ static void get_registry_dns_items(HKEY hKey, LPCTSTR KeyValue,
BYTE *ap, *srch; BYTE *ap, *srch;
int numAddresses = 0; int numAddresses = 0;
for (ap = list; ap < list + size && *ap; ap = srch) { 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++); for (srch = ap; *srch && (isdigit(*srch) || *srch == '.' ); srch++);
*srch++ = 0; *srch++ = 0;
if (numAddresses < DIM(statp->nsaddr_list)) { 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 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. Set statp->os_query if DnsQuery is available.
***********************************************************************/ ***********************************************************************/

View File

@ -504,7 +504,7 @@ int res_nsend( res_state statp, const unsigned char * MsgPtr,
NETDB_SUCCESS 0 /* no problem */ NETDB_SUCCESS 0 /* no problem */
HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ 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_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
NO_DATA 4 /* Valid name, no data record of requested type */ NO_DATA 4 /* Valid name, no data record of requested type */
#endif #endif
@ -556,7 +556,7 @@ int res_send( const unsigned char * MsgPtr, int MsgLength,
res_mkquery res_mkquery
Return: packet size Return: packet size
-1 name format is incorrect -1 name format is incorrect
*****************************************************************/ *****************************************************************/
int res_nmkquery (res_state statp, int res_nmkquery (res_state statp,
int op, const char * dnameptr, int qclass, int qtype, 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, 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 res_nquerydomain( res_state statp, const char * Name, const char * DomName,
int Class, int Type, unsigned char * AnsPtr, int AnsLength) 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, 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; unsigned int len, complen = 0;
const unsigned char *comp_dn_orig = comp_dn; 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 (len <= MAXLABEL) {
if ((length -= (len + 1)) > 0 /* Need space for final . */ if ((length -= (len + 1)) > 0 /* Need space for final . */
&& comp_dn + len <= eomorig) { && comp_dn + len <= eomorig) {
do { *exp_dn++ = *comp_dn++; } while (--len != 0); do { *exp_dn++ = *comp_dn++; } while (--len != 0);
*exp_dn++ = '.'; *exp_dn++ = '.';
} }
else else
goto expand_fail; goto expand_fail;

View File

@ -23,7 +23,7 @@ insque (void *velement, void *vpred)
if (pred) if (pred)
{ {
if ((succ = element->q_forw = pred->q_forw)) if ((succ = element->q_forw = pred->q_forw))
succ->q_back = element; succ->q_back = element;
pred->q_forw = element; pred->q_forw = element;
} }
else else

View File

@ -249,7 +249,7 @@ next_char (UINT cp, const unsigned char *str, const unsigned char *end)
case 950: case 950:
case 1361: case 1361:
if (*str <= 0x7f) if (*str <= 0x7f)
ret = str + 1; ret = str + 1;
else if (str == end - 1 && IsDBCSLeadByteEx (cp, *str)) else if (str == end - 1 && IsDBCSLeadByteEx (cp, *str))
ret = str; ret = str;
else else

View File

@ -1088,7 +1088,7 @@ munmap (void *addr, size_t len)
DWORD u_len; DWORD u_len;
LIST_FOREACH_SAFE (rec, &map_list->recs, mr_next, next_rec) LIST_FOREACH_SAFE (rec, &map_list->recs, mr_next, next_rec)
{ {
if (!rec->match ((caddr_t) addr, len, u_addr, u_len)) if (!rec->match ((caddr_t) addr, len, u_addr, u_len))
continue; continue;
if (rec->unmap_pages (u_addr, u_len)) if (rec->unmap_pages (u_addr, u_len))
@ -1207,7 +1207,7 @@ mprotect (void *addr, size_t len, int prot)
DWORD u_len; DWORD u_len;
LIST_FOREACH (rec, &map_list->recs, mr_next) LIST_FOREACH (rec, &map_list->recs, mr_next)
{ {
if (!rec->match ((caddr_t) addr, len, u_addr, u_len)) if (!rec->match ((caddr_t) addr, len, u_addr, u_len))
continue; continue;
in_mapped = true; 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, 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 || (fixed (flags) && base != *addr))
{ {
if (!base) if (!base)

View File

@ -790,7 +790,7 @@ extern "C"
PIO_STATUS_BLOCK, ULONG, ULONG, ULONG, PIO_STATUS_BLOCK, ULONG, ULONG, ULONG,
PLARGE_INTEGER); PLARGE_INTEGER);
NTSTATUS NTAPI NtCreateSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, 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, NTSTATUS NTAPI NtCreateToken (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
TOKEN_TYPE, PLUID, PLARGE_INTEGER, PTOKEN_USER, TOKEN_TYPE, PLUID, PLARGE_INTEGER, PTOKEN_USER,
PTOKEN_GROUPS, PTOKEN_PRIVILEGES, PTOKEN_OWNER, PTOKEN_GROUPS, PTOKEN_PRIVILEGES, PTOKEN_OWNER,
@ -804,11 +804,11 @@ extern "C"
PLARGE_INTEGER, PULONG, SECTION_INHERIT, PLARGE_INTEGER, PULONG, SECTION_INHERIT,
ULONG, ULONG); ULONG, ULONG);
NTSTATUS NTAPI NtNotifyChangeDirectoryFile (HANDLE, HANDLE, PIO_APC_ROUTINE, NTSTATUS NTAPI NtNotifyChangeDirectoryFile (HANDLE, HANDLE, PIO_APC_ROUTINE,
PVOID, PIO_STATUS_BLOCK, PVOID, PIO_STATUS_BLOCK,
PFILE_NOTIFY_INFORMATION, ULONG, PFILE_NOTIFY_INFORMATION, ULONG,
ULONG, BOOLEAN); ULONG, BOOLEAN);
NTSTATUS NTAPI NtOpenDirectoryObject (PHANDLE, ACCESS_MASK, NTSTATUS NTAPI NtOpenDirectoryObject (PHANDLE, ACCESS_MASK,
POBJECT_ATTRIBUTES); POBJECT_ATTRIBUTES);
NTSTATUS NTAPI NtOpenFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, NTSTATUS NTAPI NtOpenFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
PIO_STATUS_BLOCK, ULONG, ULONG); PIO_STATUS_BLOCK, ULONG, ULONG);
NTSTATUS NTAPI NtOpenSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES); NTSTATUS NTAPI NtOpenSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
@ -821,7 +821,7 @@ extern "C"
FILE_INFORMATION_CLASS, BOOLEAN, FILE_INFORMATION_CLASS, BOOLEAN,
PUNICODE_STRING, BOOLEAN); PUNICODE_STRING, BOOLEAN);
NTSTATUS NTAPI NtQueryDirectoryObject (HANDLE, PVOID, ULONG, BOOLEAN, NTSTATUS NTAPI NtQueryDirectoryObject (HANDLE, PVOID, ULONG, BOOLEAN,
BOOLEAN, PULONG, PULONG); BOOLEAN, PULONG, PULONG);
NTSTATUS NTAPI NtQueryEaFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG, NTSTATUS NTAPI NtQueryEaFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG,
BOOLEAN, PVOID, ULONG, PULONG, BOOLEAN); BOOLEAN, PVOID, ULONG, PULONG, BOOLEAN);
NTSTATUS NTAPI NtQueryFullAttributesFile (POBJECT_ATTRIBUTES, NTSTATUS NTAPI NtQueryFullAttributesFile (POBJECT_ATTRIBUTES,
@ -835,7 +835,7 @@ extern "C"
NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS, NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS,
PVOID, ULONG, PULONG); PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtQuerySecurityObject (HANDLE, SECURITY_INFORMATION, NTSTATUS NTAPI NtQuerySecurityObject (HANDLE, SECURITY_INFORMATION,
PSECURITY_DESCRIPTOR, ULONG, PULONG); PSECURITY_DESCRIPTOR, ULONG, PULONG);
NTSTATUS NTAPI NtQueryVirtualMemory (HANDLE, PVOID, MEMORY_INFORMATION_CLASS, NTSTATUS NTAPI NtQueryVirtualMemory (HANDLE, PVOID, MEMORY_INFORMATION_CLASS,
PVOID, ULONG, PULONG); PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtQueryVolumeInformationFile (HANDLE, IO_STATUS_BLOCK *, NTSTATUS NTAPI NtQueryVolumeInformationFile (HANDLE, IO_STATUS_BLOCK *,
@ -912,7 +912,7 @@ extern "C"
If you know it's 0-terminated, just use RtlInitUnicodeString(). */ If you know it's 0-terminated, just use RtlInitUnicodeString(). */
inline inline
VOID NTAPI RtlInitCountedUnicodeString (PUNICODE_STRING dest, PCWSTR buf, VOID NTAPI RtlInitCountedUnicodeString (PUNICODE_STRING dest, PCWSTR buf,
USHORT len) USHORT len)
{ {
dest->Length = dest->MaximumLength = len; dest->Length = dest->MaximumLength = len;
dest->Buffer = (PWSTR) buf; dest->Buffer = (PWSTR) buf;

View File

@ -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); pc.get_object_attr (attr, sec_none_nih);
debug_printf ("read_ea (%S, %s, %p, %lu)", 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); 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) if ((nlen = strlen (name)) >= MAX_EA_NAME_LEN)
{ {
set_errno (EINVAL); set_errno (EINVAL);
return -1; 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) else if (status == STATUS_NONEXISTENT_EA_ENTRY)
/* Actually this error code is either never generated, or it was only /* Actually this error code is either never generated, or it was only
generated in some old and long forgotton NT version. See below. */ generated in some old and long forgotton NT version. See below. */
set_errno (ENOATTR); set_errno (ENOATTR);
else else
__seterrno_from_nt_status (status); __seterrno_from_nt_status (status);
goto out; goto out;
@ -146,7 +146,7 @@ read_ea (HANDLE hdl, path_conv &pc, const char *name, char *value, size_t size)
{ {
ret = 0; ret = 0;
do do
{ {
if (pc.fs_is_samba ()) /* See below. */ if (pc.fs_is_samba ()) /* See below. */
fea->EaNameLength += 5; fea->EaNameLength += 5;
if (size > 0) if (size > 0)
@ -186,7 +186,7 @@ out:
if (!hdl) if (!hdl)
CloseHandle (h); CloseHandle (h);
debug_printf ("%d = read_ea (%S, %s, %p, %lu)", debug_printf ("%d = read_ea (%S, %s, %p, %lu)",
ret, attr.ObjectName, name, value, size); ret, attr.ObjectName, name, value, size);
return ret; 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); pc.get_object_attr (attr, sec_none_nih);
debug_printf ("write_ea (%S, %s, %p, %lu, %d)", 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 /* Samba hides the user namespace from Windows clients. If we get a
user namespace item, we remove the leading namespace from the name. 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); ssize_t rret = read_ea (hdl, pc, name, NULL, 0);
if (flags == XATTR_CREATE && rret > 0) if (flags == XATTR_CREATE && rret > 0)
{ {
set_errno (EEXIST); set_errno (EEXIST);
goto out; goto out;
} }
@ -297,7 +297,7 @@ out:
if (!hdl) if (!hdl)
CloseHandle (h); CloseHandle (h);
debug_printf ("%d = write_ea (%S, %s, %p, %lu, %d)", 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; return ret;
} }
@ -316,7 +316,7 @@ getxattr_worker (path_conv &pc, const char *name, void *value, size_t size)
fhandler_base *fh; fhandler_base *fh;
if (!(fh = build_fh_pc (pc))) if (!(fh = build_fh_pc (pc)))
return -1; return -1;
res = fh->fgetxattr (name, value, size); res = fh->fgetxattr (name, value, size);
delete fh; delete fh;
@ -411,7 +411,7 @@ setxattr_worker (path_conv &pc, const char *name, const void *value,
fhandler_base *fh; fhandler_base *fh;
if (!(fh = build_fh_pc (pc))) if (!(fh = build_fh_pc (pc)))
return -1; return -1;
res = fh->fsetxattr (name, value, size, flags); res = fh->fsetxattr (name, value, size, flags);
delete fh; delete fh;

View File

@ -419,7 +419,7 @@ fs_info::update (PUNICODE_STRING upath, bool exists)
RtlSplitUnicodePath (attr.ObjectName, &dir, NULL); RtlSplitUnicodePath (attr.ObjectName, &dir, NULL);
attr.ObjectName = &dir; attr.ObjectName = &dir;
if (status == STATUS_NO_MEDIA_IN_DEVICE) if (status == STATUS_NO_MEDIA_IN_DEVICE)
{ {
no_media = true; no_media = true;
dir.Length = 6 * sizeof (WCHAR); dir.Length = 6 * sizeof (WCHAR);
} }
@ -437,7 +437,7 @@ fs_info::update (PUNICODE_STRING upath, bool exists)
return false; return false;
} }
status = NtQueryVolumeInformationFile (vol, &io, &ffdi, sizeof ffdi, status = NtQueryVolumeInformationFile (vol, &io, &ffdi, sizeof ffdi,
FileFsDeviceInformation); FileFsDeviceInformation);
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
ffdi.DeviceType = ffdi.Characteristics = 0; ffdi.DeviceType = ffdi.Characteristics = 0;
@ -1996,7 +1996,7 @@ mount_info::conv_to_posix_path (PWCHAR src_path, char *posix_path,
{ {
src_path += 4; src_path += 4;
if (!wcsncmp (src_path, L"UNC\\", 4)) if (!wcsncmp (src_path, L"UNC\\", 4))
{ {
src_path += 2; src_path += 2;
src_path[0] = L'\\'; src_path[0] = L'\\';
changed = true; changed = true;
@ -2990,7 +2990,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
} }
syscall_printf ("symlink (%s, %S)", oldpath, syscall_printf ("symlink (%s, %S)", oldpath,
win32_newpath.get_nt_native_path ()); win32_newpath.get_nt_native_path ());
if ((!isdevice && win32_newpath.exists ()) if ((!isdevice && win32_newpath.exists ())
|| win32_newpath.is_auto_device ()) || 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; char desc[MAX_PATH + 1], *relpath;
if (!isdevice) if (!isdevice)
{ {
/* First create an IDLIST to learn how big our shortcut is /* First create an IDLIST to learn how big our shortcut is
going to be. */ going to be. */
IShellFolder *psl; IShellFolder *psl;
@ -3181,7 +3181,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
status = NtSetInformationFile (fh, &io, &fbi, sizeof fbi, status = NtSetInformationFile (fh, &io, &fbi, sizeof fbi,
FileBasicInformation); FileBasicInformation);
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
debug_printf ("Setting attributes failed, status = %p", status); debug_printf ("Setting attributes failed, status = %p", status);
res = 0; res = 0;
} }
else else
@ -3191,7 +3191,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
status = NtSetInformationFile (fh, &io, &fdi, sizeof fdi, status = NtSetInformationFile (fh, &io, &fdi, sizeof fdi,
FileDispositionInformation); FileDispositionInformation);
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
debug_printf ("Setting delete dispostion failed, status = %p", status); debug_printf ("Setting delete dispostion failed, status = %p", status);
} }
NtClose (fh); NtClose (fh);
@ -3313,10 +3313,7 @@ symlink_info::check_sysfile (HANDLE h)
set_error (EIO); set_error (EIO);
} }
else if (io.Information > SYMLINK_MAX + 1) else if (io.Information > SYMLINK_MAX + 1)
{ debug_printf ("symlink string too long");
debug_printf ("symlink string too long");
}
else else
res = posixify (srcbuf); 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); get_nt_native_path (suffix.path, upath);
status = NtQueryAttributesFile (&attr, &fbi); status = NtQueryAttributesFile (&attr, &fbi);
if (NT_SUCCESS (status)) if (NT_SUCCESS (status))
fileattr = fbi.FileAttributes; fileattr = fbi.FileAttributes;
else else
{ {
debug_printf ("%p = NtQueryAttributesFile (%S)", status, &upath); 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_OPEN_FOR_BACKUP_INTENT
| FILE_DIRECTORY_FILE); | FILE_DIRECTORY_FILE);
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
{ {
debug_printf ("%p = NtOpenFile(%S)", status, &dirname); debug_printf ("%p = NtOpenFile(%S)", status, &dirname);
fileattr = 0; fileattr = 0;
} }
else else
{ {
status = NtQueryDirectoryFile (dir, NULL, NULL, 0, &io, status = NtQueryDirectoryFile (dir, NULL, NULL, 0, &io,
&fdi, sizeof fdi, &fdi, sizeof fdi,
FileDirectoryInformation, FileDirectoryInformation,
@ -3726,7 +3723,7 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt)
goto file_not_symlink; goto file_not_symlink;
} }
if (set_error (geterrno_from_win_error if (set_error (geterrno_from_win_error
(RtlNtStatusToDosError (status), EACCES))) (RtlNtStatusToDosError (status), EACCES)))
continue; 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 For now, we just don't store the path in the PEB and proceed as
usual. */ usual. */
&& len <= MAX_PATH - (nat_cwd->Buffer[len - 1] == L'\\' ? 1 : 2)) && len <= MAX_PATH - (nat_cwd->Buffer[len - 1] == L'\\' ? 1 : 2))
{ {
/* Convert to a Win32 path. */ /* Convert to a Win32 path. */
upath.Buffer += upath.Length / sizeof (WCHAR) - len; upath.Buffer += upath.Length / sizeof (WCHAR) - len;
if (upath.Buffer[1] == L'\\') /* UNC path */ if (upath.Buffer[1] == L'\\') /* UNC path */

View File

@ -96,16 +96,6 @@ public:
inline void set_has_pgid_children (bool val) {has_pgid_children = val;} 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, ...); commune_result commune_request (__uint32_t, ...);
bool alive (); bool alive ();
fhandler_pipe *pipe_fhandler (HANDLE, size_t &); fhandler_pipe *pipe_fhandler (HANDLE, size_t &);
@ -128,8 +118,6 @@ public:
HANDLE sendsig; HANDLE sendsig;
HANDLE exec_sendsig; HANDLE exec_sendsig;
DWORD exec_dwProcessId; DWORD exec_dwProcessId;
private:
sigset_t sig_mask;
public: public:
HANDLE wr_proc_pipe; HANDLE wr_proc_pipe;
DWORD wr_proc_pipe_owner; DWORD wr_proc_pipe_owner;

View File

@ -115,7 +115,6 @@ pipe_handler (LPVOID in_ps)
return 0; return 0;
} }
pipesync::pipesync (HANDLE f, DWORD is_reader): pipesync::pipesync (HANDLE f, DWORD is_reader):
reader (false), ret_handle (NULL) reader (false), ret_handle (NULL)
{ {

View File

@ -221,7 +221,6 @@ get_registry_hive_path (const PWCHAR name, PWCHAR path)
if (!RegOpenKeyExW (HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hkey)) if (!RegOpenKeyExW (HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hkey))
{ {
WCHAR buf[NT_MAX_PATH]; WCHAR buf[NT_MAX_PATH];
WCHAR tmp[NT_MAX_PATH];
DWORD type, siz; DWORD type, siz;
path[0] = L'\0'; path[0] = L'\0';

View File

@ -55,7 +55,7 @@ get_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd)
{ {
set_errno (ENOMEM); set_errno (ENOMEM);
break; break;
} }
status = NtQuerySecurityObject (fh, ALL_SECURITY_INFORMATION, status = NtQuerySecurityObject (fh, ALL_SECURITY_INFORMATION,
sd, len, &len); sd, len, &len);
} }
@ -66,7 +66,7 @@ get_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd)
} }
} }
if (!retry) if (!retry)
{ {
OBJECT_ATTRIBUTES attr; OBJECT_ATTRIBUTES attr;
IO_STATUS_BLOCK io; IO_STATUS_BLOCK io;
@ -98,7 +98,7 @@ set_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd)
for (; retry < 2; ++retry) for (; retry < 2; ++retry)
{ {
if (fh) if (fh)
{ {
status = NtSetSecurityObject (fh, ALL_SECURITY_INFORMATION, sd); status = NtSetSecurityObject (fh, ALL_SECURITY_INFORMATION, sd);
if (NT_SUCCESS (status)) if (NT_SUCCESS (status))
{ {
@ -107,7 +107,7 @@ set_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd)
} }
} }
if (!retry) if (!retry)
{ {
OBJECT_ATTRIBUTES attr; OBJECT_ATTRIBUTES attr;
IO_STATUS_BLOCK io; IO_STATUS_BLOCK io;
@ -338,7 +338,7 @@ get_file_attribute (HANDLE handle, path_conv &pc,
return 0; return 0;
} }
else else
{ {
if (uidret) if (uidret)
*uidret = ILLEGAL_UID; *uidret = ILLEGAL_UID;
if (gidret) if (gidret)

View File

@ -206,11 +206,11 @@ public:
cygsid above. */ cygsid above. */
BOOL operator+= (cygsid &si) { return add ((PSID) si, false); } BOOL operator+= (cygsid &si) { return add ((PSID) si, false); }
BOOL operator+= (const char *sidstr) { cygsid nsi (sidstr); 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+= (const PSID psid) { return add (psid, false); }
BOOL operator*= (cygsid &si) { return add ((PSID) si, true); } BOOL operator*= (cygsid &si) { return add ((PSID) si, true); }
BOOL operator*= (const char *sidstr) { cygsid nsi (sidstr); 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); } BOOL operator*= (const PSID psid) { return add (psid, true); }
void count (int ncnt) void count (int ncnt)
@ -220,7 +220,7 @@ public:
{ {
int wcnt = 0; int wcnt = 0;
for (int i = 0; i < cnt; ++i) for (int i = 0; i < cnt; ++i)
if (!sids[i].is_well_known_sid ()) if (!sids[i].is_well_known_sid ())
++wcnt; ++wcnt;
return wcnt; return wcnt;
} }
@ -236,7 +236,7 @@ public:
int next_non_well_known_sid (int idx) int next_non_well_known_sid (int idx)
{ {
while (++idx < cnt) while (++idx < cnt)
if (!sids[idx].is_well_known_sid ()) if (!sids[idx].is_well_known_sid ())
return idx; return idx;
return -1; return -1;
} }

View File

@ -160,7 +160,7 @@ pselect(int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
const struct timespec *ts, const sigset_t *set) const struct timespec *ts, const sigset_t *set)
{ {
struct timeval tv; struct timeval tv;
sigset_t oldset = myself->getsigmask (); sigset_t oldset = _my_tls.sigmask;
myfault efault; myfault efault;
if (efault.faulted (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; tv.tv_usec = ts->tv_nsec / 1000;
} }
if (set) if (set)
set_signal_mask (*set, myself->getsigmask ()); set_signal_mask (*set, _my_tls.sigmask);
int ret = cygwin_select (maxfds, readfds, writefds, exceptfds, int ret = cygwin_select (maxfds, readfds, writefds, exceptfds,
ts ? &tv : NULL); ts ? &tv : NULL);
if (set) if (set)
set_signal_mask (oldset, myself->getsigmask ()); set_signal_mask (oldset, _my_tls.sigmask);
return ret; return ret;
} }

View File

@ -147,7 +147,7 @@ usleep (useconds_t useconds)
extern "C" int extern "C" int
sigprocmask (int how, const sigset_t *set, sigset_t *oldset) 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 int __stdcall
@ -342,7 +342,7 @@ abort (void)
sigset_t sig_mask; sigset_t sig_mask;
sigfillset (&sig_mask); sigfillset (&sig_mask);
sigdelset (&sig_mask, SIGABRT); sigdelset (&sig_mask, SIGABRT);
set_signal_mask (sig_mask, myself->getsigmask ()); set_signal_mask (sig_mask, _my_tls.sigmask);
raise (SIGABRT); raise (SIGABRT);
_my_tls.call_signal_handler (); /* Call any signal handler */ _my_tls.call_signal_handler (); /* Call any signal handler */
@ -485,7 +485,7 @@ sigpause (int signal_mask)
extern "C" int extern "C" int
pause (void) pause (void)
{ {
return handle_sigsuspend (myself->getsigmask ()); return handle_sigsuspend (_my_tls.sigmask);
} }
extern "C" int extern "C" int

View File

@ -663,7 +663,7 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls)
else if (si.si_signo == __SIGPENDING) else if (si.si_signo == __SIGPENDING)
pack.mask = &pending; pack.mask = &pending;
else if (si.si_signo == __SIGFLUSH || si.si_signo > 0) else if (si.si_signo == __SIGFLUSH || si.si_signo > 0)
pack.mask = &myself->getsigmask (); pack.mask = &_my_tls.sigmask;
else else
pack.mask = NULL; pack.mask = NULL;
@ -1118,7 +1118,7 @@ pending_signals::add (sigpacket& pack)
return; return;
se = sigs + pack.si.si_signo; se = sigs + pack.si.si_signo;
*se = pack; *se = pack;
se->mask = &myself->getsigmask (); se->mask = &pack.tls->sigmask;
se->next = NULL; se->next = NULL;
if (end) if (end)
end->next = se; end->next = se;
@ -1199,7 +1199,7 @@ wait_sig (VOID *)
sigset_t dummy_mask; sigset_t dummy_mask;
if (!pack.mask) if (!pack.mask)
{ {
dummy_mask = myself->getsigmask (); dummy_mask = _main_tls->sigmask;
pack.mask = &dummy_mask; pack.mask = &dummy_mask;
} }
@ -1218,7 +1218,7 @@ wait_sig (VOID *)
unsigned bit; unsigned bit;
sigq.reset (); sigq.reset ();
while ((q = sigq.next ())) 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; *pack.mask |= bit;
break; break;
case __SIGHOLD: case __SIGHOLD:

View File

@ -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); size_t tlen = (slen == -1 ? ret : ret + 1);
if (type == HEAP_NOTHEAP) if (type == HEAP_NOTHEAP)
*tgt_p = (char *) calloc (tlen, sizeof (char)); *tgt_p = (char *) calloc (tlen, sizeof (char));
else else
*tgt_p = (char *) ccalloc ((cygheap_types) type, tlen, sizeof (char)); *tgt_p = (char *) ccalloc ((cygheap_types) type, tlen, sizeof (char));
if (!*tgt_p) if (!*tgt_p)
return 0; return 0;
ret = sys_wcstombs (*tgt_p, tlen, src, slen); ret = sys_wcstombs (*tgt_p, tlen, src, slen);
} }
return ret; return ret;
@ -97,11 +97,11 @@ sys_mbstowcs_alloc (PWCHAR *tgt_p, int type, const char *src)
if (ret) if (ret)
{ {
if (type == HEAP_NOTHEAP) if (type == HEAP_NOTHEAP)
*tgt_p = (PWCHAR) calloc (ret, sizeof (WCHAR)); *tgt_p = (PWCHAR) calloc (ret, sizeof (WCHAR));
else else
*tgt_p = (PWCHAR) ccalloc ((cygheap_types) type, ret, sizeof (WCHAR)); *tgt_p = (PWCHAR) ccalloc ((cygheap_types) type, ret, sizeof (WCHAR));
if (!*tgt_p) if (!*tgt_p)
return 0; return 0;
ret = sys_mbstowcs (*tgt_p, src, ret); ret = sys_mbstowcs (*tgt_p, src, ret);
} }
return ret; return ret;

View File

@ -287,9 +287,9 @@ try_to_bin (path_conv &win32_path, HANDLE h)
goto out; goto out;
} }
/* Next, if necessary, check if the recycler/SID dir exists and /* 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 ()) if (win32_path.fs_is_ntfs ())
{ {
NtClose (recyclerdir); NtClose (recyclerdir);
recycler.Length = recycler_user_len; recycler.Length = recycler_user_len;
status = NtCreateFile (&recyclerdir, READ_CONTROL | FILE_ADD_FILE, 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 /* 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 */ corrupted */
if (io.Information == FILE_CREATED) if (io.Information == FILE_CREATED)
{ {
HANDLE fh; HANDLE fh;
RtlInitUnicodeString (&fname, L"desktop.ini"); RtlInitUnicodeString (&fname, L"desktop.ini");
InitializeObjectAttributes (&attr, &fname, OBJ_CASE_INSENSITIVE, 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, status = NtWriteFile (fh, NULL, NULL, NULL, &io, desktop_ini,
sizeof desktop_ini - 1, NULL, NULL); sizeof desktop_ini - 1, NULL, NULL);
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
debug_printf ("NtWriteFile (%S) failed, %08x", &fname, status); debug_printf ("NtWriteFile (%S) failed, %08x", &fname, status);
NtClose (fh); NtClose (fh);
} }
if (!wincap.has_recycle_dot_bin ()) /* No INFO2 file since Vista */ 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); status = check_dir_not_empty (fh);
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
{ {
NtClose (fh); NtClose (fh);
return status; return status;
} }
@ -1504,7 +1504,7 @@ rename (const char *oldpath, const char *newpath)
{ {
stpcpy (oldbuf = (char *) alloca (olen + 1), oldpath); stpcpy (oldbuf = (char *) alloca (olen + 1), oldpath);
while (olen > 0 && isdirsep (oldbuf[olen - 1])) while (olen > 0 && isdirsep (oldbuf[olen - 1]))
oldbuf[--olen] = '\0'; oldbuf[--olen] = '\0';
oldpath = oldbuf; oldpath = oldbuf;
old_dir_requested = true; old_dir_requested = true;
} }
@ -1539,7 +1539,7 @@ rename (const char *oldpath, const char *newpath)
{ {
stpcpy (newbuf = (char *) alloca (nlen + 1), newpath); stpcpy (newbuf = (char *) alloca (nlen + 1), newpath);
while (nlen > 0 && isdirsep (newbuf[nlen - 1])) while (nlen > 0 && isdirsep (newbuf[nlen - 1]))
newbuf[--nlen] = '\0'; newbuf[--nlen] = '\0';
newpath = newbuf; newpath = newbuf;
new_dir_requested = true; new_dir_requested = true;
} }
@ -1593,7 +1593,7 @@ rename (const char *oldpath, const char *newpath)
&& newpc.get_nt_native_path ()->Length > && newpc.get_nt_native_path ()->Length >
oldpc.get_nt_native_path ()->Length oldpc.get_nt_native_path ()->Length
&& *(PWCHAR) ((PBYTE) newpc.get_nt_native_path ()->Buffer && *(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); set_errno (EINVAL);
goto out; goto out;
@ -1615,12 +1615,12 @@ rename (const char *oldpath, const char *newpath)
else if (oldpc.is_lnk_symlink () else if (oldpc.is_lnk_symlink ()
&& !RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (), && !RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
L".lnk", TRUE)) L".lnk", TRUE))
rename_append_suffix (newpc, newpath, nlen, ".lnk"); rename_append_suffix (newpc, newpath, nlen, ".lnk");
else if (oldpc.is_binary () else if (oldpc.is_binary ()
&& !RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (), && !RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
L".exe", TRUE)) L".exe", TRUE))
/* NOTE: No way to rename an executable foo.exe to foo. */ /* 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 ()) else if (newpc.isdir ())
{ {
@ -1641,7 +1641,7 @@ rename (const char *oldpath, const char *newpath)
} }
} }
else if (oldpc.is_lnk_symlink ()) else if (oldpc.is_lnk_symlink ())
{ {
if (!newpc.is_lnk_symlink () if (!newpc.is_lnk_symlink ()
&& !RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (), && !RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
L".lnk", TRUE)) L".lnk", TRUE))
@ -1658,9 +1658,9 @@ rename (const char *oldpath, const char *newpath)
rename_append_suffix (new2pc, newpath, nlen, ".exe"); rename_append_suffix (new2pc, newpath, nlen, ".exe");
removepc = &newpc; removepc = &newpc;
} }
} }
else else
{ {
if ((RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (), if ((RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
L".lnk", TRUE) L".lnk", TRUE)
|| RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (), || RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
@ -1712,7 +1712,7 @@ rename (const char *oldpath, const char *newpath)
| (dstpc->is_rep_symlink () | (dstpc->is_rep_symlink ()
? FILE_OPEN_REPARSE_POINT : 0)); ? FILE_OPEN_REPARSE_POINT : 0));
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
{ {
__seterrno_from_nt_status (status); __seterrno_from_nt_status (status);
goto out; goto out;
} }
@ -1726,7 +1726,7 @@ rename (const char *oldpath, const char *newpath)
FileBasicInformation); FileBasicInformation);
NtClose (nfh); NtClose (nfh);
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
{ {
__seterrno_from_nt_status (status); __seterrno_from_nt_status (status);
goto out; goto out;
} }
@ -1749,7 +1749,7 @@ rename (const char *oldpath, const char *newpath)
&io, FILE_SHARE_VALID_FLAGS, &io, FILE_SHARE_VALID_FLAGS,
FILE_OPEN_FOR_BACKUP_INTENT FILE_OPEN_FOR_BACKUP_INTENT
| ((removepc ?: dstpc)->is_rep_symlink () | ((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) static const size_t vsiz = sizeof (FILE_FS_VOLUME_INFORMATION)
+ 32 * sizeof (WCHAR); + 32 * sizeof (WCHAR);

View File

@ -376,6 +376,7 @@ pthread::pthread ():verifyable_object (PTHREAD_MAGIC), win32_obj_id (0),
{ {
if (this != pthread_null::get_null_pthread ()) if (this != pthread_null::get_null_pthread ())
threads.insert (this); threads.insert (this);
parent_tls = &_my_tls;
} }
pthread::~pthread () pthread::~pthread ()
@ -1738,6 +1739,7 @@ pthread::thread_init_wrapper (void *arg)
// if thread is detached force cleanup on exit // if thread is detached force cleanup on exit
if (thread->attr.joinable == PTHREAD_CREATE_DETACHED && thread->joiner == NULL) if (thread->attr.joinable == PTHREAD_CREATE_DETACHED && thread->joiner == NULL)
thread->joiner = thread; thread->joiner = thread;
_my_tls.sigmask = thread->parent_tls->sigmask;
thread->mutex.unlock (); thread->mutex.unlock ();
thread_printf ("started thread %p %p %p %p %p %p", arg, &_my_tls.local_clib, thread_printf ("started thread %p %p %p %p %p %p", arg, &_my_tls.local_clib,

View File

@ -434,6 +434,7 @@ private:
DWORD thread_id; DWORD thread_id;
__pthread_cleanup_handler *cleanup_stack; __pthread_cleanup_handler *cleanup_stack;
pthread_mutex mutex; pthread_mutex mutex;
_cygtls *parent_tls;
void suspend_except_self (); void suspend_except_self ();
void resume (); void resume ();

View File

@ -179,8 +179,7 @@ extern HANDLE tty_mutex;
}) })
/* Convert a signal to a signal mask */ /* Convert a signal to a signal mask */
#define SIGTOMASK(sig) (1 << ((sig) - signal_shift_subtract)) #define SIGTOMASK(sig) (1 << ((sig) - 1))
extern unsigned int signal_shift_subtract;
extern int __api_fatal_exit_val; 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) #define set_api_fatal_return(n) do {extern int __api_fatal_exit_val; __api_fatal_exit_val = (n);} while (0)