whitespace cleanup to force snapshot.
This commit is contained in:
parent
718dee922f
commit
de935f6d9f
|
@ -927,8 +927,8 @@ ctrl_c_handler (DWORD type)
|
||||||
int sig = SIGINT;
|
int sig = SIGINT;
|
||||||
/* If intr and quit are both mapped to ^C, send SIGQUIT on ^BREAK */
|
/* If intr and quit are both mapped to ^C, send SIGQUIT on ^BREAK */
|
||||||
if (type == CTRL_BREAK_EVENT
|
if (type == CTRL_BREAK_EVENT
|
||||||
&& t->ti.c_cc[VINTR] == 3 && t->ti.c_cc[VQUIT] == 3)
|
&& t->ti.c_cc[VINTR] == 3 && t->ti.c_cc[VQUIT] == 3)
|
||||||
sig = SIGQUIT;
|
sig = SIGQUIT;
|
||||||
t->last_ctrl_c = GetTickCount ();
|
t->last_ctrl_c = GetTickCount ();
|
||||||
killsys (-myself->pid, sig);
|
killsys (-myself->pid, sig);
|
||||||
t->last_ctrl_c = GetTickCount ();
|
t->last_ctrl_c = GetTickCount ();
|
||||||
|
@ -1269,12 +1269,12 @@ _cygtls::call_signal_handler ()
|
||||||
sigfunc (thissig);
|
sigfunc (thissig);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
siginfo_t thissi = infodata;
|
siginfo_t thissi = infodata;
|
||||||
void (*sigact) (int, siginfo_t *, void *) = (void (*) (int, siginfo_t *, void *)) func;
|
void (*sigact) (int, siginfo_t *, void *) = (void (*) (int, siginfo_t *, void *)) func;
|
||||||
/* no ucontext_t information provided yet */
|
/* no ucontext_t information provided yet */
|
||||||
sigact (thissig, &thissi, NULL);
|
sigact (thissig, &thissi, NULL);
|
||||||
}
|
}
|
||||||
incyg++;
|
incyg++;
|
||||||
set_signal_mask (this_oldmask, myself->getsigmask ());
|
set_signal_mask (this_oldmask, myself->getsigmask ());
|
||||||
if (this_errno >= 0)
|
if (this_errno >= 0)
|
||||||
|
|
|
@ -571,7 +571,7 @@ fhandler_disk_file::fchown (__uid32_t uid, __gid32_t gid)
|
||||||
permissions of symlinks to a sensible value which allows the
|
permissions of symlinks to a sensible value which allows the
|
||||||
world to read the symlink and only the new owner to change it. */
|
world to read the symlink and only the new owner to change it. */
|
||||||
if (pc.issymlink ())
|
if (pc.issymlink ())
|
||||||
attrib = S_IFLNK | STD_RBITS | STD_WBITS;
|
attrib = S_IFLNK | STD_RBITS | STD_WBITS;
|
||||||
res = set_file_attribute (pc.has_acls (), get_io_handle (), pc,
|
res = set_file_attribute (pc.has_acls (), get_io_handle (), pc,
|
||||||
uid, gid, attrib);
|
uid, gid, attrib);
|
||||||
}
|
}
|
||||||
|
@ -1306,15 +1306,15 @@ fhandler_disk_file::rmdir ()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* On 9X ERROR_ACCESS_DENIED is returned if you try to remove a
|
/* On 9X ERROR_ACCESS_DENIED is returned if you try to remove a
|
||||||
non-empty directory. */
|
non-empty directory. */
|
||||||
if (err == ERROR_ACCESS_DENIED
|
if (err == ERROR_ACCESS_DENIED
|
||||||
&& wincap.access_denied_on_delete ())
|
&& wincap.access_denied_on_delete ())
|
||||||
err = ERROR_DIR_NOT_EMPTY;
|
err = ERROR_DIR_NOT_EMPTY;
|
||||||
/* ...and, that's *not* funny, when trying to remove a non-existing
|
/* ...and, that's *not* funny, when trying to remove a non-existing
|
||||||
directory on a share, which is hosted by a 9x machine, the error
|
directory on a share, which is hosted by a 9x machine, the error
|
||||||
code ERROR_INVALID_FUNCTION is returned. */
|
code ERROR_INVALID_FUNCTION is returned. */
|
||||||
else if (err == ERROR_INVALID_FUNCTION)
|
else if (err == ERROR_INVALID_FUNCTION)
|
||||||
err = ERROR_FILE_NOT_FOUND;
|
err = ERROR_FILE_NOT_FOUND;
|
||||||
|
|
||||||
__seterrno_from_win_error (err);
|
__seterrno_from_win_error (err);
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ fhandler_dev_floppy::get_drive_info (struct hd_geometry *geo)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Getting the partition size by using the drive geometry information
|
/* Getting the partition size by using the drive geometry information
|
||||||
looks wrong, but this is a historical necessity. NT4 didn't maintain
|
looks wrong, but this is a historical necessity. NT4 didn't maintain
|
||||||
partition information for the whole drive (aka "partition 0"), but
|
partition information for the whole drive (aka "partition 0"), but
|
||||||
returned ERROR_INVALID_HANDLE instead. That got fixed in W2K. */
|
returned ERROR_INVALID_HANDLE instead. That got fixed in W2K. */
|
||||||
drive_size = di->Cylinders.QuadPart * di->TracksPerCylinder *
|
drive_size = di->Cylinders.QuadPart * di->TracksPerCylinder *
|
||||||
|
@ -119,7 +119,7 @@ fhandler_dev_floppy::get_drive_info (struct hd_geometry *geo)
|
||||||
else if (pi)
|
else if (pi)
|
||||||
geo->start = pi->StartingOffset.QuadPart >> 9ULL;
|
geo->start = pi->StartingOffset.QuadPart >> 9ULL;
|
||||||
else
|
else
|
||||||
geo->start = 0;
|
geo->start = 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -461,7 +461,7 @@ fhandler_dev_floppy::ioctl (unsigned int cmd, void *buf)
|
||||||
}
|
}
|
||||||
case RDSETBLK:
|
case RDSETBLK:
|
||||||
/* Just check the restriction that blocksize must be a multiple
|
/* Just check the restriction that blocksize must be a multiple
|
||||||
of the sector size of the underlying volume sector size,
|
of the sector size of the underlying volume sector size,
|
||||||
then fall through to fhandler_dev_raw::ioctl. */
|
then fall through to fhandler_dev_raw::ioctl. */
|
||||||
struct rdop *op = (struct rdop *) buf;
|
struct rdop *op = (struct rdop *) buf;
|
||||||
if (op->rd_parm % bytes_per_sector)
|
if (op->rd_parm % bytes_per_sector)
|
||||||
|
|
|
@ -1063,9 +1063,9 @@ fhandler_socket::recvfrom (void *ptr, size_t len, int flags,
|
||||||
return len;
|
return len;
|
||||||
|
|
||||||
/* ESHUTDOWN isn't defined for recv in SUSv3. Simply EOF is returned
|
/* ESHUTDOWN isn't defined for recv in SUSv3. Simply EOF is returned
|
||||||
in this case. */
|
in this case. */
|
||||||
if (WSAGetLastError () == WSAESHUTDOWN)
|
if (WSAGetLastError () == WSAESHUTDOWN)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
set_winsock_errno ();
|
set_winsock_errno ();
|
||||||
}
|
}
|
||||||
|
@ -1152,9 +1152,9 @@ fhandler_socket::recvmsg (struct msghdr *msg, int flags, ssize_t tot)
|
||||||
return len;
|
return len;
|
||||||
|
|
||||||
/* ESHUTDOWN isn't defined for recv in SUSv3. Simply EOF is returned
|
/* ESHUTDOWN isn't defined for recv in SUSv3. Simply EOF is returned
|
||||||
in this case. */
|
in this case. */
|
||||||
if (WSAGetLastError () == WSAESHUTDOWN)
|
if (WSAGetLastError () == WSAESHUTDOWN)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
set_winsock_errno ();
|
set_winsock_errno ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1237,7 +1237,7 @@ fhandler_dev_tape::open (int flags, mode_t)
|
||||||
TAPE_SPACE_FILEMARKS, 1, true);
|
TAPE_SPACE_FILEMARKS, 1, true);
|
||||||
|
|
||||||
if (!(flags & O_DIRECT))
|
if (!(flags & O_DIRECT))
|
||||||
{
|
{
|
||||||
devbufsiz = mt->drive (driveno ())->dp ()->MaximumBlockSize;
|
devbufsiz = mt->drive (driveno ())->dp ()->MaximumBlockSize;
|
||||||
devbuf = new char [devbufsiz];
|
devbuf = new char [devbufsiz];
|
||||||
}
|
}
|
||||||
|
@ -1466,7 +1466,7 @@ fhandler_dev_tape::dup (fhandler_base *child)
|
||||||
lock (-1);
|
lock (-1);
|
||||||
fhandler_dev_tape *fh = (fhandler_dev_tape *) child;
|
fhandler_dev_tape *fh = (fhandler_dev_tape *) child;
|
||||||
if (!DuplicateHandle (hMainProc, mt_mtx, hMainProc, &fh->mt_mtx, 0, TRUE,
|
if (!DuplicateHandle (hMainProc, mt_mtx, hMainProc, &fh->mt_mtx, 0, TRUE,
|
||||||
DUPLICATE_SAME_ACCESS))
|
DUPLICATE_SAME_ACCESS))
|
||||||
{
|
{
|
||||||
debug_printf ("dup(%s) failed, mutex handle %x, %E",
|
debug_printf ("dup(%s) failed, mutex handle %x, %E",
|
||||||
get_name (), mt_mtx);
|
get_name (), mt_mtx);
|
||||||
|
@ -1476,7 +1476,7 @@ fhandler_dev_tape::dup (fhandler_base *child)
|
||||||
fh->mt_evt = NULL;
|
fh->mt_evt = NULL;
|
||||||
if (mt_evt &&
|
if (mt_evt &&
|
||||||
!DuplicateHandle (hMainProc, mt_evt, hMainProc, &fh->mt_evt, 0, TRUE,
|
!DuplicateHandle (hMainProc, mt_evt, hMainProc, &fh->mt_evt, 0, TRUE,
|
||||||
DUPLICATE_SAME_ACCESS))
|
DUPLICATE_SAME_ACCESS))
|
||||||
{
|
{
|
||||||
debug_printf ("dup(%s) failed, event handle %x, %E",
|
debug_printf ("dup(%s) failed, event handle %x, %E",
|
||||||
get_name (), mt_evt);
|
get_name (), mt_evt);
|
||||||
|
|
|
@ -150,13 +150,13 @@ dll_entry (HANDLE h, DWORD reason, void *static_load)
|
||||||
dynamically_loaded = (static_load == NULL);
|
dynamically_loaded = (static_load == NULL);
|
||||||
|
|
||||||
/* Is the stack at an unusual address? This is, an address which
|
/* Is the stack at an unusual address? This is, an address which
|
||||||
is in the usual space occupied by the process image, but below
|
is in the usual space occupied by the process image, but below
|
||||||
the auto load address of DLLs?
|
the auto load address of DLLs?
|
||||||
Check if we're running in WOW64 on a 64 bit machine *and* are
|
Check if we're running in WOW64 on a 64 bit machine *and* are
|
||||||
spawned by a genuine 64 bit process. If so, respawn. */
|
spawned by a genuine 64 bit process. If so, respawn. */
|
||||||
if (&is_wow64_proc >= (PBOOL) 0x400000
|
if (&is_wow64_proc >= (PBOOL) 0x400000
|
||||||
&& &is_wow64_proc <= (PBOOL) 0x10000000
|
&& &is_wow64_proc <= (PBOOL) 0x10000000
|
||||||
&& IsWow64Process (GetCurrentProcess (), &is_wow64_proc)
|
&& IsWow64Process (GetCurrentProcess (), &is_wow64_proc)
|
||||||
&& is_wow64_proc)
|
&& is_wow64_proc)
|
||||||
respawn_wow64_process ();
|
respawn_wow64_process ();
|
||||||
|
|
||||||
|
|
|
@ -216,9 +216,9 @@ CreateMapping9x (HANDLE fhdl, size_t len, _off64_t off, DWORD openflags,
|
||||||
debug_printf ("named sharing");
|
debug_printf ("named sharing");
|
||||||
DWORD access = gen_access (openflags, flags);
|
DWORD access = gen_access (openflags, flags);
|
||||||
/* Different access modes result in incompatible mappings. So we
|
/* Different access modes result in incompatible mappings. So we
|
||||||
create different maps per access mode by using different names. */
|
create different maps per access mode by using different names. */
|
||||||
switch (access)
|
switch (access)
|
||||||
{
|
{
|
||||||
case FILE_MAP_READ:
|
case FILE_MAP_READ:
|
||||||
namebuf[0] = 'R';
|
namebuf[0] = 'R';
|
||||||
break;
|
break;
|
||||||
|
@ -242,7 +242,7 @@ CreateMapping9x (HANDLE fhdl, size_t len, _off64_t off, DWORD openflags,
|
||||||
high = (off + len) >> 32;
|
high = (off + len) >> 32;
|
||||||
low = (off + len) & UINT32_MAX;
|
low = (off + len) & UINT32_MAX;
|
||||||
/* Auto-grow only works if the protection is PAGE_READWRITE. So,
|
/* Auto-grow only works if the protection is PAGE_READWRITE. So,
|
||||||
first we call CreateFileMapping with PAGE_READWRITE, then, if the
|
first we call CreateFileMapping with PAGE_READWRITE, then, if the
|
||||||
requested protection is different, we close the mapping and
|
requested protection is different, we close the mapping and
|
||||||
reopen it again with the correct protection, if auto-grow worked. */
|
reopen it again with the correct protection, if auto-grow worked. */
|
||||||
h = CreateFileMapping (fhdl, &sec_none, PAGE_READWRITE,
|
h = CreateFileMapping (fhdl, &sec_none, PAGE_READWRITE,
|
||||||
|
@ -286,14 +286,14 @@ CreateMappingNT (HANDLE fhdl, size_t len, _off64_t off, DWORD openflags,
|
||||||
else if (autogrow (flags))
|
else if (autogrow (flags))
|
||||||
{
|
{
|
||||||
/* Auto-grow only works if the protection is PAGE_READWRITE. So,
|
/* Auto-grow only works if the protection is PAGE_READWRITE. So,
|
||||||
first we call NtCreateSection with PAGE_READWRITE, then, if the
|
first we call NtCreateSection with PAGE_READWRITE, then, if the
|
||||||
requested protection is different, we close the mapping and
|
requested protection is different, we close the mapping and
|
||||||
reopen it again with the correct protection, if auto-grow worked. */
|
reopen it again with the correct protection, if auto-grow worked. */
|
||||||
sectionsize.QuadPart += off;
|
sectionsize.QuadPart += off;
|
||||||
ret = NtCreateSection (&h, SECTION_ALL_ACCESS, &oa,
|
ret = NtCreateSection (&h, SECTION_ALL_ACCESS, &oa,
|
||||||
§ionsize, PAGE_READWRITE, attributes, fhdl);
|
§ionsize, PAGE_READWRITE, attributes, fhdl);
|
||||||
if (NT_SUCCESS (ret) && protect != PAGE_READWRITE)
|
if (NT_SUCCESS (ret) && protect != PAGE_READWRITE)
|
||||||
{
|
{
|
||||||
CloseHandle (h);
|
CloseHandle (h);
|
||||||
ret = NtCreateSection (&h, SECTION_ALL_ACCESS, &oa,
|
ret = NtCreateSection (&h, SECTION_ALL_ACCESS, &oa,
|
||||||
§ionsize, protect, attributes, fhdl);
|
§ionsize, protect, attributes, fhdl);
|
||||||
|
@ -302,7 +302,7 @@ CreateMappingNT (HANDLE fhdl, size_t len, _off64_t off, DWORD openflags,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Zero len creates mapping for whole file and allows
|
/* Zero len creates mapping for whole file and allows
|
||||||
AT_EXTENDABLE_FILE mapping, if we ever use it... */
|
AT_EXTENDABLE_FILE mapping, if we ever use it... */
|
||||||
sectionsize.QuadPart = 0;
|
sectionsize.QuadPart = 0;
|
||||||
ret = NtCreateSection (&h, SECTION_ALL_ACCESS, &oa,
|
ret = NtCreateSection (&h, SECTION_ALL_ACCESS, &oa,
|
||||||
§ionsize, protect, attributes, fhdl);
|
§ionsize, protect, attributes, fhdl);
|
||||||
|
@ -361,7 +361,7 @@ MapViewNT (HANDLE h, void *addr, size_t len, DWORD openflags,
|
||||||
{
|
{
|
||||||
base = NULL;
|
base = NULL;
|
||||||
ret = NtMapViewOfSection (h, GetCurrentProcess (), &base, 0, commitsize,
|
ret = NtMapViewOfSection (h, GetCurrentProcess (), &base, 0, commitsize,
|
||||||
&offset, &viewsize, ViewShare, 0, protect);
|
&offset, &viewsize, ViewShare, 0, protect);
|
||||||
}
|
}
|
||||||
if (!NT_SUCCESS (ret))
|
if (!NT_SUCCESS (ret))
|
||||||
{
|
{
|
||||||
|
@ -376,7 +376,7 @@ MapViewNT (HANDLE h, void *addr, size_t len, DWORD openflags,
|
||||||
struct mmap_func_t
|
struct mmap_func_t
|
||||||
{
|
{
|
||||||
HANDLE (*CreateMapping)(HANDLE, size_t, _off64_t, DWORD, int, int,
|
HANDLE (*CreateMapping)(HANDLE, size_t, _off64_t, DWORD, int, int,
|
||||||
const char *);
|
const char *);
|
||||||
void * (*MapView)(HANDLE, void *, size_t, DWORD, int, int, _off64_t);
|
void * (*MapView)(HANDLE, void *, size_t, DWORD, int, int, _off64_t);
|
||||||
BOOL (*VirtualProt)(PVOID, SIZE_T, DWORD, PDWORD);
|
BOOL (*VirtualProt)(PVOID, SIZE_T, DWORD, PDWORD);
|
||||||
BOOL (*VirtualProtEx)(HANDLE, PVOID, SIZE_T, DWORD, PDWORD);
|
BOOL (*VirtualProtEx)(HANDLE, PVOID, SIZE_T, DWORD, PDWORD);
|
||||||
|
@ -439,7 +439,7 @@ class mmap_record
|
||||||
|
|
||||||
public:
|
public:
|
||||||
mmap_record (int nfd, HANDLE h, DWORD of, int p, int f, _off64_t o, DWORD l,
|
mmap_record (int nfd, HANDLE h, DWORD of, int p, int f, _off64_t o, DWORD l,
|
||||||
caddr_t b) :
|
caddr_t b) :
|
||||||
fd (nfd),
|
fd (nfd),
|
||||||
mapping_hdl (h),
|
mapping_hdl (h),
|
||||||
openflags (of),
|
openflags (of),
|
||||||
|
@ -758,7 +758,7 @@ list::search_record (caddr_t addr, DWORD len, caddr_t &m_addr, DWORD &m_len,
|
||||||
low = (addr >= recs[i].get_address ()) ? addr : recs[i].get_address ();
|
low = (addr >= recs[i].get_address ()) ? addr : recs[i].get_address ();
|
||||||
high = recs[i].get_address ();
|
high = recs[i].get_address ();
|
||||||
if (recs[i].filler ())
|
if (recs[i].filler ())
|
||||||
high += recs[i].get_len ();
|
high += recs[i].get_len ();
|
||||||
else
|
else
|
||||||
high += (PAGE_CNT (recs[i].get_len ()) * getpagesize ());
|
high += (PAGE_CNT (recs[i].get_len ()) * getpagesize ());
|
||||||
high = (addr + len < high) ? addr + len : high;
|
high = (addr + len < high) ? addr + len : high;
|
||||||
|
@ -992,7 +992,7 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off)
|
||||||
to enable remapping of formerly mapped pages. If no matching
|
to enable remapping of formerly mapped pages. If no matching
|
||||||
free pages exist, check addr again, this time for the real alignment. */
|
free pages exist, check addr again, this time for the real alignment. */
|
||||||
DWORD checkpagesize = wincap.has_mmap_alignment_bug () ?
|
DWORD checkpagesize = wincap.has_mmap_alignment_bug () ?
|
||||||
getsystempagesize () : pagesize;
|
getsystempagesize () : pagesize;
|
||||||
if (fixed (flags) && ((uintptr_t) addr % checkpagesize))
|
if (fixed (flags) && ((uintptr_t) addr % checkpagesize))
|
||||||
{
|
{
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
|
@ -1018,14 +1018,14 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off)
|
||||||
fd = -1;
|
fd = -1;
|
||||||
flags |= MAP_ANONYMOUS;
|
flags |= MAP_ANONYMOUS;
|
||||||
/* Anonymous mappings are always forced to pagesize length with
|
/* Anonymous mappings are always forced to pagesize length with
|
||||||
no offset. */
|
no offset. */
|
||||||
len = roundup2 (len, pagesize);
|
len = roundup2 (len, pagesize);
|
||||||
off = 0;
|
off = 0;
|
||||||
}
|
}
|
||||||
else if (fh->get_device () == FH_FS)
|
else if (fh->get_device () == FH_FS)
|
||||||
{
|
{
|
||||||
/* EACCES error conditions according to SUSv3. File must be opened
|
/* EACCES error conditions according to SUSv3. File must be opened
|
||||||
for reading, regardless of the requested protection, and file must
|
for reading, regardless of the requested protection, and file must
|
||||||
be opened for writing when PROT_WRITE together with MAP_SHARED
|
be opened for writing when PROT_WRITE together with MAP_SHARED
|
||||||
is requested. */
|
is requested. */
|
||||||
if (!(fh->get_access () & GENERIC_READ)
|
if (!(fh->get_access () & GENERIC_READ)
|
||||||
|
@ -1037,9 +1037,9 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* On 9x you can't create mappings with PAGE_WRITECOPY protection if
|
/* On 9x you can't create mappings with PAGE_WRITECOPY protection if
|
||||||
the file isn't explicitely opened with WRITE access. */
|
the file isn't explicitely opened with WRITE access. */
|
||||||
if (!wincap.is_winnt () && priv (flags)
|
if (!wincap.is_winnt () && priv (flags)
|
||||||
&& !(fh->get_access () & GENERIC_WRITE))
|
&& !(fh->get_access () & GENERIC_WRITE))
|
||||||
{
|
{
|
||||||
HANDLE h = CreateFile (fh->get_win32_name (),
|
HANDLE h = CreateFile (fh->get_win32_name (),
|
||||||
fh->get_access () | GENERIC_WRITE,
|
fh->get_access () | GENERIC_WRITE,
|
||||||
|
@ -1059,9 +1059,9 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* On NT you can't create mappings with PAGE_EXECUTE protection if
|
/* On NT you can't create mappings with PAGE_EXECUTE protection if
|
||||||
the file isn't explicitely opened with EXECUTE access. */
|
the file isn't explicitely opened with EXECUTE access. */
|
||||||
if (wincap.is_winnt ())
|
if (wincap.is_winnt ())
|
||||||
{
|
{
|
||||||
HANDLE h = CreateFile (fh->get_win32_name (),
|
HANDLE h = CreateFile (fh->get_win32_name (),
|
||||||
fh->get_access () | GENERIC_EXECUTE,
|
fh->get_access () | GENERIC_EXECUTE,
|
||||||
wincap.shared (), &sec_none_nih,
|
wincap.shared (), &sec_none_nih,
|
||||||
|
@ -1119,7 +1119,7 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off)
|
||||||
if (autogrow (flags))
|
if (autogrow (flags))
|
||||||
{
|
{
|
||||||
/* Allow mapping beyond EOF if MAP_AUTOGROW flag is set.
|
/* Allow mapping beyond EOF if MAP_AUTOGROW flag is set.
|
||||||
Check if file has been opened for writing, otherwise
|
Check if file has been opened for writing, otherwise
|
||||||
MAP_AUTOGROW is invalid. */
|
MAP_AUTOGROW is invalid. */
|
||||||
if (!(fh->get_access () & GENERIC_WRITE))
|
if (!(fh->get_access () & GENERIC_WRITE))
|
||||||
{
|
{
|
||||||
|
@ -1148,9 +1148,9 @@ go_ahead:
|
||||||
{
|
{
|
||||||
caddr_t tried = map_list->try_map (addr, len, flags, off);
|
caddr_t tried = map_list->try_map (addr, len, flags, off);
|
||||||
/* try_map returns NULL if no map matched, otherwise it returns
|
/* try_map returns NULL if no map matched, otherwise it returns
|
||||||
a valid address, of MAP_FAILED in case of a fatal error. */
|
a valid address, of MAP_FAILED in case of a fatal error. */
|
||||||
if (tried)
|
if (tried)
|
||||||
{
|
{
|
||||||
ret = tried;
|
ret = tried;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1433,7 +1433,7 @@ mprotect (void *addr, size_t len, int prot)
|
||||||
|
|
||||||
ret = VirtualQuery (addr, &mbi, sizeof mbi);
|
ret = VirtualQuery (addr, &mbi, sizeof mbi);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
/* If write protection is requested, check if the page was
|
/* If write protection is requested, check if the page was
|
||||||
originally protected writecopy. In this case call VirtualProtect
|
originally protected writecopy. In this case call VirtualProtect
|
||||||
requesting PAGE_WRITECOPY, otherwise the VirtualProtect will fail
|
requesting PAGE_WRITECOPY, otherwise the VirtualProtect will fail
|
||||||
|
@ -1519,7 +1519,7 @@ mlock (const void *addr, size_t len)
|
||||||
else if (!NT_SUCCESS (status))
|
else if (!NT_SUCCESS (status))
|
||||||
__seterrno_from_nt_status (status);
|
__seterrno_from_nt_status (status);
|
||||||
else
|
else
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
while (status == STATUS_WORKING_SET_QUOTA);
|
while (status == STATUS_WORKING_SET_QUOTA);
|
||||||
|
|
||||||
|
@ -1609,7 +1609,7 @@ fhandler_dev_zero::mmap (caddr_t *addr, size_t len, int prot,
|
||||||
if (priv (flags) && !filler (prot))
|
if (priv (flags) && !filler (prot))
|
||||||
{
|
{
|
||||||
/* Private anonymous maps are now implemented using VirtualAlloc.
|
/* Private anonymous maps are now implemented using VirtualAlloc.
|
||||||
This has two advantages:
|
This has two advantages:
|
||||||
|
|
||||||
- VirtualAlloc has a smaller footprint than a copy-on-write
|
- VirtualAlloc has a smaller footprint than a copy-on-write
|
||||||
anonymous map.
|
anonymous map.
|
||||||
|
@ -1697,7 +1697,7 @@ fhandler_dev_zero::fixup_mmap_after_fork (HANDLE h, int prot, int flags,
|
||||||
{
|
{
|
||||||
DWORD alloc_type = MEM_RESERVE | (noreserve (flags) ? 0 : MEM_COMMIT);
|
DWORD alloc_type = MEM_RESERVE | (noreserve (flags) ? 0 : MEM_COMMIT);
|
||||||
/* Always allocate R/W so that ReadProcessMemory doesn't fail
|
/* Always allocate R/W so that ReadProcessMemory doesn't fail
|
||||||
due to a non-writable target address. The protection is
|
due to a non-writable target address. The protection is
|
||||||
set to the correct one anyway in the fixup loop. */
|
set to the correct one anyway in the fixup loop. */
|
||||||
base = VirtualAlloc (address, size, alloc_type, PAGE_READWRITE);
|
base = VirtualAlloc (address, size, alloc_type, PAGE_READWRITE);
|
||||||
}
|
}
|
||||||
|
@ -1730,7 +1730,7 @@ fhandler_disk_file::mmap (caddr_t *addr, size_t len, int prot,
|
||||||
}
|
}
|
||||||
|
|
||||||
void *base = mmap_func->MapView (h, *addr, len, get_access (),
|
void *base = mmap_func->MapView (h, *addr, len, get_access (),
|
||||||
prot, flags, off);
|
prot, flags, off);
|
||||||
if (!base || (fixed (flags) && base != *addr))
|
if (!base || (fixed (flags) && base != *addr))
|
||||||
{
|
{
|
||||||
if (!base)
|
if (!base)
|
||||||
|
@ -1828,13 +1828,13 @@ fhandler_dev_mem::mmap (caddr_t *addr, size_t len, int prot,
|
||||||
}
|
}
|
||||||
|
|
||||||
void *base = MapViewNT (h, *addr, len, get_access (),
|
void *base = MapViewNT (h, *addr, len, get_access (),
|
||||||
prot, flags | MAP_ANONYMOUS, off);
|
prot, flags | MAP_ANONYMOUS, off);
|
||||||
if (!base || (fixed (flags) && base != *addr))
|
if (!base || (fixed (flags) && base != *addr))
|
||||||
{
|
{
|
||||||
if (!base)
|
if (!base)
|
||||||
__seterrno ();
|
__seterrno ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NtUnmapViewOfSection (GetCurrentProcess (), base);
|
NtUnmapViewOfSection (GetCurrentProcess (), base);
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
debug_printf ("MapView: address shift with MAP_FIXED given");
|
debug_printf ("MapView: address shift with MAP_FIXED given");
|
||||||
|
@ -1922,7 +1922,7 @@ fixup_mmaps_after_fork (HANDLE parent)
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
if (rec->attached ())
|
if (rec->attached ())
|
||||||
{
|
{
|
||||||
system_printf ("Warning: Fixup mapping beyond EOF failed");
|
system_printf ("Warning: Fixup mapping beyond EOF failed");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1937,21 +1937,21 @@ fixup_mmaps_after_fork (HANDLE parent)
|
||||||
address += mbi.RegionSize)
|
address += mbi.RegionSize)
|
||||||
{
|
{
|
||||||
if (!VirtualQueryEx (parent, address, &mbi, sizeof mbi))
|
if (!VirtualQueryEx (parent, address, &mbi, sizeof mbi))
|
||||||
{
|
{
|
||||||
system_printf ("VirtualQueryEx failed for MAP_PRIVATE "
|
system_printf ("VirtualQueryEx failed for MAP_PRIVATE "
|
||||||
"address %p, %E", address);
|
"address %p, %E", address);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* Just skip reserved pages. */
|
/* Just skip reserved pages. */
|
||||||
if (mbi.State == MEM_RESERVE)
|
if (mbi.State == MEM_RESERVE)
|
||||||
continue;
|
continue;
|
||||||
/* Copy-on-write pages must be copied to the child to circumvent
|
/* Copy-on-write pages must be copied to the child to circumvent
|
||||||
a strange notion how copy-on-write is supposed to work. */
|
a strange notion how copy-on-write is supposed to work. */
|
||||||
if (rec->priv ())
|
if (rec->priv ())
|
||||||
{
|
{
|
||||||
if (rec->anonymous () && rec->noreserve ()
|
if (rec->anonymous () && rec->noreserve ()
|
||||||
&& !VirtualAlloc (address, mbi.RegionSize,
|
&& !VirtualAlloc (address, mbi.RegionSize,
|
||||||
MEM_COMMIT, PAGE_READWRITE))
|
MEM_COMMIT, PAGE_READWRITE))
|
||||||
{
|
{
|
||||||
system_printf ("VirtualAlloc failed for MAP_PRIVATE "
|
system_printf ("VirtualAlloc failed for MAP_PRIVATE "
|
||||||
"address %p, %E", address);
|
"address %p, %E", address);
|
||||||
|
@ -1999,7 +1999,7 @@ fixup_mmaps_after_fork (HANDLE parent)
|
||||||
MEMORY_BASIC_INFORMATION m;
|
MEMORY_BASIC_INFORMATION m;
|
||||||
VirtualQuery (address, &m, sizeof m);
|
VirtualQuery (address, &m, sizeof m);
|
||||||
system_printf ("VirtualProtect failed for "
|
system_printf ("VirtualProtect failed for "
|
||||||
"address %p, "
|
"address %p, "
|
||||||
"parentstate: 0x%x, "
|
"parentstate: 0x%x, "
|
||||||
"state: 0x%x, "
|
"state: 0x%x, "
|
||||||
"parentprot: 0x%x, "
|
"parentprot: 0x%x, "
|
||||||
|
|
|
@ -681,10 +681,10 @@ cygwin_setsockopt (int fd, int level, int optname, const void *optval,
|
||||||
{
|
{
|
||||||
/* Old applications still use the old Winsock1 IPPROTO_IP values. */
|
/* Old applications still use the old Winsock1 IPPROTO_IP values. */
|
||||||
if (level == IPPROTO_IP && CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES)
|
if (level == IPPROTO_IP && CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES)
|
||||||
optname = convert_ws1_ip_optname (optname);
|
optname = convert_ws1_ip_optname (optname);
|
||||||
/* FOR THE RECORDS:
|
/* FOR THE RECORDS:
|
||||||
|
|
||||||
Setting IP_TOS is disabled by default since W2K, the official
|
Setting IP_TOS is disabled by default since W2K, the official
|
||||||
reason being that IP_TOS setting would interfere with Windows
|
reason being that IP_TOS setting would interfere with Windows
|
||||||
QOS settings. As result, setsockopt returns with WinSock error
|
QOS settings. As result, setsockopt returns with WinSock error
|
||||||
10022, WSAEINVAL, when running under W2K or later, instead of
|
10022, WSAEINVAL, when running under W2K or later, instead of
|
||||||
|
@ -731,7 +731,7 @@ cygwin_getsockopt (int fd, int level, int optname, void *optval, int *optlen)
|
||||||
{
|
{
|
||||||
/* Old applications still use the old Winsock1 IPPROTO_IP values. */
|
/* Old applications still use the old Winsock1 IPPROTO_IP values. */
|
||||||
if (level == IPPROTO_IP && CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES)
|
if (level == IPPROTO_IP && CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES)
|
||||||
optname = convert_ws1_ip_optname (optname);
|
optname = convert_ws1_ip_optname (optname);
|
||||||
res = getsockopt (fh->get_socket (), level, optname, (char *) optval,
|
res = getsockopt (fh->get_socket (), level, optname, (char *) optval,
|
||||||
(int *) optlen);
|
(int *) optlen);
|
||||||
|
|
||||||
|
|
|
@ -247,7 +247,7 @@ normalize_posix_path (const char *src, char *dst, char *&tail)
|
||||||
return get_errno ();
|
return get_errno ();
|
||||||
tail = strchr (tail, '\0');
|
tail = strchr (tail, '\0');
|
||||||
if (isslash (dst[0]) && isslash (dst[1]))
|
if (isslash (dst[0]) && isslash (dst[1]))
|
||||||
++dst_start;
|
++dst_start;
|
||||||
if (*src == '.')
|
if (*src == '.')
|
||||||
{
|
{
|
||||||
if (tail == dst_start + 1 && *dst_start == '/')
|
if (tail == dst_start + 1 && *dst_start == '/')
|
||||||
|
@ -1112,14 +1112,14 @@ normalize_win32_path (const char *src, char *dst, char *&tail)
|
||||||
if (beg_src_slash && isdirsep (src[1]))
|
if (beg_src_slash && isdirsep (src[1]))
|
||||||
{
|
{
|
||||||
if (isdirsep (src[2]))
|
if (isdirsep (src[2]))
|
||||||
{
|
{
|
||||||
/* More than two slashes are just folded into one. */
|
/* More than two slashes are just folded into one. */
|
||||||
src += 2;
|
src += 2;
|
||||||
while (isdirsep (src[1]))
|
while (isdirsep (src[1]))
|
||||||
++src;
|
++src;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Two slashes start a network or device path. */
|
/* Two slashes start a network or device path. */
|
||||||
*tail++ = '\\';
|
*tail++ = '\\';
|
||||||
src++;
|
src++;
|
||||||
|
@ -3717,10 +3717,10 @@ realpath (const char *path, char *resolved)
|
||||||
{
|
{
|
||||||
if (!resolved)
|
if (!resolved)
|
||||||
{
|
{
|
||||||
resolved = (char *) malloc (strlen (real_path.normalized_path) + 1);
|
resolved = (char *) malloc (strlen (real_path.normalized_path) + 1);
|
||||||
if (!resolved)
|
if (!resolved)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return strcpy (resolved, real_path.normalized_path);
|
return strcpy (resolved, real_path.normalized_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ sysconf (int in)
|
||||||
case _SC_TTY_NAME_MAX:
|
case _SC_TTY_NAME_MAX:
|
||||||
return TTY_NAME_MAX;
|
return TTY_NAME_MAX;
|
||||||
case _SC_MEMLOCK_RANGE:
|
case _SC_MEMLOCK_RANGE:
|
||||||
return _POSIX_MEMLOCK_RANGE;
|
return _POSIX_MEMLOCK_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invalid input or unimplemented sysconf name */
|
/* Invalid input or unimplemented sysconf name */
|
||||||
|
|
|
@ -233,7 +233,7 @@ out:
|
||||||
sprintf (pribuf, "<%d>", priority);
|
sprintf (pribuf, "<%d>", priority);
|
||||||
struct iovec iv[2] =
|
struct iovec iv[2] =
|
||||||
{
|
{
|
||||||
{ pribuf, strlen (pribuf) },
|
{ pribuf, strlen (pribuf) },
|
||||||
{ (char *) msg, len }
|
{ (char *) msg, len }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue