* Merge in cygwin-64bit-branch.
This commit is contained in:
@@ -170,7 +170,7 @@ allow_others_to_sync ()
|
||||
MAX_PROCESS_SD_SIZE, &len);
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
debug_printf ("NtQuerySecurityObject: %p", status);
|
||||
debug_printf ("NtQuerySecurityObject: %y", status);
|
||||
return;
|
||||
}
|
||||
/* Create a valid dacl pointer and set its size to be as big as
|
||||
@@ -197,14 +197,14 @@ allow_others_to_sync ()
|
||||
well_known_world_sid);
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
debug_printf ("RtlAddAccessAllowedAce: %p", status);
|
||||
debug_printf ("RtlAddAccessAllowedAce: %y", status);
|
||||
return;
|
||||
}
|
||||
/* Set the size of the DACL correctly. */
|
||||
status = RtlFirstFreeAce (dacl, &ace);
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
debug_printf ("RtlFirstFreeAce: %p", status);
|
||||
debug_printf ("RtlFirstFreeAce: %y", status);
|
||||
return;
|
||||
}
|
||||
dacl->AclSize = (char *) ace - (char *) dacl;
|
||||
@@ -212,7 +212,7 @@ allow_others_to_sync ()
|
||||
status = NtSetSecurityObject (NtCurrentProcess (), DACL_SECURITY_INFORMATION, sd);
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
debug_printf ("NtSetSecurityObject: %p", status);
|
||||
debug_printf ("NtSetSecurityObject: %y", status);
|
||||
return;
|
||||
}
|
||||
done = true;
|
||||
@@ -228,7 +228,7 @@ get_obj_handle_count (HANDLE h)
|
||||
|
||||
status = NtQueryObject (h, ObjectBasicInformation, &obi, sizeof obi, NULL);
|
||||
if (!NT_SUCCESS (status))
|
||||
debug_printf ("NtQueryObject: %p\n", status);
|
||||
debug_printf ("NtQueryObject: %y", status);
|
||||
else
|
||||
hdl_cnt = obi.HandleCount;
|
||||
return hdl_cnt;
|
||||
@@ -248,9 +248,9 @@ class lockf_t
|
||||
public:
|
||||
uint16_t lf_flags; /* Semantics: F_POSIX, F_FLOCK, F_WAIT */
|
||||
uint16_t lf_type; /* Lock type: F_RDLCK, F_WRLCK */
|
||||
_off64_t lf_start; /* Byte # of the start of the lock */
|
||||
_off64_t lf_end; /* Byte # of the end of the lock (-1=EOF) */
|
||||
int64_t lf_id; /* Cygwin PID for POSIX locks, a unique id per
|
||||
off_t lf_start; /* Byte # of the start of the lock */
|
||||
off_t lf_end; /* Byte # of the end of the lock (-1=EOF) */
|
||||
int64_t lf_id; /* Cygwin PID for POSIX locks, a unique id per
|
||||
file table entry for BSD flock locks. */
|
||||
DWORD lf_wid; /* Win PID of the resource holding the lock */
|
||||
uint16_t lf_ver; /* Version number of the lock. If a released
|
||||
@@ -268,7 +268,7 @@ class lockf_t
|
||||
lf_next (NULL), lf_obj (NULL)
|
||||
{}
|
||||
lockf_t (class inode_t *node, class lockf_t **head,
|
||||
short flags, short type, _off64_t start, _off64_t end,
|
||||
short flags, short type, off_t start, off_t end,
|
||||
long long id, DWORD wid, uint16_t ver)
|
||||
: lf_flags (flags), lf_type (type), lf_start (start), lf_end (end),
|
||||
lf_id (id), lf_wid (wid), lf_ver (ver), lf_head (head), lf_inode (node),
|
||||
@@ -308,8 +308,8 @@ class inode_t
|
||||
lockf_t *i_lockf; /* List of locks of this process. */
|
||||
lockf_t *i_all_lf; /* Temp list of all locks for this file. */
|
||||
|
||||
__dev32_t i_dev; /* Device ID */
|
||||
__ino64_t i_ino; /* inode number */
|
||||
dev_t i_dev; /* Device ID */
|
||||
ino_t i_ino; /* inode number */
|
||||
|
||||
private:
|
||||
HANDLE i_dir;
|
||||
@@ -317,7 +317,7 @@ class inode_t
|
||||
uint32_t i_cnt; /* # of threads referencing this instance. */
|
||||
|
||||
public:
|
||||
inode_t (__dev32_t dev, __ino64_t ino);
|
||||
inode_t (dev_t dev, ino_t ino);
|
||||
~inode_t ();
|
||||
|
||||
void *operator new (size_t size)
|
||||
@@ -325,7 +325,7 @@ class inode_t
|
||||
void operator delete (void *p)
|
||||
{ cfree (p); }
|
||||
|
||||
static inode_t *get (__dev32_t dev, __ino64_t ino,
|
||||
static inode_t *get (dev_t dev, ino_t ino,
|
||||
bool create_if_missing, bool lock);
|
||||
|
||||
void LOCK () { WaitForSingleObject (i_mtx, INFINITE); }
|
||||
@@ -482,7 +482,7 @@ fixup_lockf_after_exec ()
|
||||
file. The file is specified by the device and inode_t number. If inode_t
|
||||
doesn't exist, create it. */
|
||||
inode_t *
|
||||
inode_t::get (__dev32_t dev, __ino64_t ino, bool create_if_missing, bool lock)
|
||||
inode_t::get (dev_t dev, ino_t ino, bool create_if_missing, bool lock)
|
||||
{
|
||||
inode_t *node;
|
||||
|
||||
@@ -504,7 +504,7 @@ inode_t::get (__dev32_t dev, __ino64_t ino, bool create_if_missing, bool lock)
|
||||
return node;
|
||||
}
|
||||
|
||||
inode_t::inode_t (__dev32_t dev, __ino64_t ino)
|
||||
inode_t::inode_t (dev_t dev, ino_t ino)
|
||||
: i_lockf (NULL), i_all_lf (NULL), i_dev (dev), i_ino (ino), i_cnt (0L)
|
||||
{
|
||||
HANDLE parent_dir;
|
||||
@@ -522,14 +522,14 @@ inode_t::inode_t (__dev32_t dev, __ino64_t ino)
|
||||
parent_dir, everyone_sd (FLOCK_INODE_DIR_ACCESS));
|
||||
status = NtCreateDirectoryObject (&i_dir, FLOCK_INODE_DIR_ACCESS, &attr);
|
||||
if (!NT_SUCCESS (status))
|
||||
api_fatal ("NtCreateDirectoryObject(inode): %p", status);
|
||||
api_fatal ("NtCreateDirectoryObject(inode): %y", status);
|
||||
/* Create a mutex object in the file specific dir, which is used for
|
||||
access synchronization on the dir and its objects. */
|
||||
InitializeObjectAttributes (&attr, &ro_u_mtx, OBJ_INHERIT | OBJ_OPENIF, i_dir,
|
||||
everyone_sd (CYG_MUTANT_ACCESS));
|
||||
status = NtCreateMutant (&i_mtx, CYG_MUTANT_ACCESS, &attr, FALSE);
|
||||
if (!NT_SUCCESS (status))
|
||||
api_fatal ("NtCreateMutant(inode): %p", status);
|
||||
api_fatal ("NtCreateMutant(inode): %y", status);
|
||||
}
|
||||
|
||||
/* Enumerate all lock event objects for this file and create a lockf_t
|
||||
@@ -554,10 +554,10 @@ lockf_t::from_obj_name (inode_t *node, lockf_t **head, const wchar_t *name)
|
||||
lf_type = wcstol (endptr + 1, &endptr, 16);
|
||||
if ((lf_type != F_RDLCK && lf_type != F_WRLCK) || !endptr || *endptr != L'-')
|
||||
return false;
|
||||
lf_start = (_off64_t) wcstoull (endptr + 1, &endptr, 16);
|
||||
lf_start = (off_t) wcstoull (endptr + 1, &endptr, 16);
|
||||
if (lf_start < 0 || !endptr || *endptr != L'-')
|
||||
return false;
|
||||
lf_end = (_off64_t) wcstoull (endptr + 1, &endptr, 16);
|
||||
lf_end = (off_t) wcstoull (endptr + 1, &endptr, 16);
|
||||
if (lf_end < -1LL
|
||||
|| (lf_end > 0 && lf_end < lf_start)
|
||||
|| !endptr || *endptr != L'-')
|
||||
@@ -640,8 +640,8 @@ create_lock_in_parent (PVOID param)
|
||||
OBJECT_NAME_INFORMATION *ntfn;
|
||||
NTSTATUS status;
|
||||
wchar_t *lockname, *inodename, *endptr;
|
||||
__dev32_t dev;
|
||||
__ino64_t ino;
|
||||
dev_t dev;
|
||||
ino_t ino;
|
||||
inode_t *node;
|
||||
lockf_t newlock, *lock;
|
||||
int cnt;
|
||||
@@ -753,7 +753,7 @@ lockf_t::create_lock_obj ()
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
if (status != STATUS_OBJECT_NAME_COLLISION)
|
||||
api_fatal ("NtCreateEvent(lock): %p", status);
|
||||
api_fatal ("NtCreateEvent(lock): %y", status);
|
||||
/* If we get a STATUS_OBJECT_NAME_COLLISION, the event still exists
|
||||
because some other process is waiting for it in lf_setlock.
|
||||
If so, check the event's signal state. If we can't open it, it
|
||||
@@ -764,7 +764,7 @@ lockf_t::create_lock_obj ()
|
||||
if (open_lock_obj ())
|
||||
{
|
||||
if (!IsEventSignalled (lf_obj))
|
||||
api_fatal ("NtCreateEvent(lock): %p", status);
|
||||
api_fatal ("NtCreateEvent(lock): %y", status);
|
||||
close_lock_obj ();
|
||||
/* Increment the lf_ver field until we have no collision. */
|
||||
++lf_ver;
|
||||
@@ -910,15 +910,15 @@ static int maxlockdepth = MAXDEPTH;
|
||||
static int lf_clearlock (lockf_t *, lockf_t **, HANDLE);
|
||||
static int lf_findoverlap (lockf_t *, lockf_t *, int, lockf_t ***, lockf_t **);
|
||||
static lockf_t *lf_getblock (lockf_t *, inode_t *node);
|
||||
static int lf_getlock (lockf_t *, inode_t *, struct __flock64 *);
|
||||
static int lf_getlock (lockf_t *, inode_t *, struct flock *);
|
||||
static int lf_setlock (lockf_t *, inode_t *, lockf_t **, HANDLE);
|
||||
static void lf_split (lockf_t *, lockf_t *, lockf_t **);
|
||||
static void lf_wakelock (lockf_t *, HANDLE);
|
||||
|
||||
int
|
||||
fhandler_disk_file::lock (int a_op, struct __flock64 *fl)
|
||||
fhandler_disk_file::lock (int a_op, struct flock *fl)
|
||||
{
|
||||
_off64_t start, end, oadd;
|
||||
off_t start, end, oadd;
|
||||
int error = 0;
|
||||
|
||||
short a_flags = fl->l_type & (F_POSIX | F_FLOCK);
|
||||
@@ -1499,7 +1499,7 @@ lf_clearlock (lockf_t *unlock, lockf_t **clean, HANDLE fhdl)
|
||||
* and if so return its process identifier.
|
||||
*/
|
||||
static int
|
||||
lf_getlock (lockf_t *lock, inode_t *node, struct __flock64 *fl)
|
||||
lf_getlock (lockf_t *lock, inode_t *node, struct flock *fl)
|
||||
{
|
||||
lockf_t *block;
|
||||
tmp_pathbuf tp;
|
||||
@@ -1577,7 +1577,7 @@ static int
|
||||
lf_findoverlap (lockf_t *lf, lockf_t *lock, int type, lockf_t ***prev,
|
||||
lockf_t **overlap)
|
||||
{
|
||||
_off64_t start, end;
|
||||
off_t start, end;
|
||||
|
||||
*overlap = lf;
|
||||
if (lf == NOLOCKF)
|
||||
@@ -1716,7 +1716,7 @@ flock (int fd, int operation)
|
||||
{
|
||||
int res = -1;
|
||||
int cmd;
|
||||
struct __flock64 fl = { 0, SEEK_SET, 0, 0, 0 };
|
||||
struct flock fl = { 0, SEEK_SET, 0, 0, 0 };
|
||||
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
@@ -1751,11 +1751,11 @@ done:
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
lockf (int filedes, int function, _off64_t size)
|
||||
lockf (int filedes, int function, off_t size)
|
||||
{
|
||||
int res = -1;
|
||||
int cmd;
|
||||
struct __flock64 fl;
|
||||
struct flock fl;
|
||||
|
||||
pthread_testcancel ();
|
||||
|
||||
|
Reference in New Issue
Block a user