* cygheap.h (cygheap_fdenum::cygheap_fdenum): Record locked state or suffer
deadlocks. (class locked_process): Move to another header. * sync.h (lock_process): Define here. * cygtls.cc (_cygtls::fixup_after_fork): Reset spinning state as well as stacklock state. * dcrt0.cc (lock_process::locker): Define. (dtable::lock_cs): Delete. * dtable.cc (dtable_init): Eliminate call to init_lock(). (dtable::fixup_after_fork): Ditto. (dtable::init_lock): Delete definition. * dtable.h (dtable::init_lock): Delete declaration. (dtable::lock): Use process lock rather than dtable-specific lock. (dtable::unlock): Ditto. * sigproc.cc (sigproc_init): Minor change to debugging output. * times.cc (utime_worker): Use build_fh_pc rather than reinterpreting the posix path name again. Return any error from path_conv immediately.
This commit is contained in:
parent
c2c020d1fb
commit
82c925af80
|
@ -1,3 +1,25 @@
|
||||||
|
2005-10-23 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* cygheap.h (cygheap_fdenum::cygheap_fdenum): Record locked state or
|
||||||
|
suffer deadlocks.
|
||||||
|
(class locked_process): Move to another header.
|
||||||
|
* sync.h (lock_process): Define here.
|
||||||
|
* cygtls.cc (_cygtls::fixup_after_fork): Reset spinning state as well
|
||||||
|
as stacklock state.
|
||||||
|
* dcrt0.cc (lock_process::locker): Define.
|
||||||
|
(dtable::lock_cs): Delete.
|
||||||
|
* dtable.cc (dtable_init): Eliminate call to init_lock().
|
||||||
|
(dtable::fixup_after_fork): Ditto.
|
||||||
|
(dtable::init_lock): Delete definition.
|
||||||
|
* dtable.h (dtable::init_lock): Delete declaration.
|
||||||
|
(dtable::lock): Use process lock rather than dtable-specific lock.
|
||||||
|
(dtable::unlock): Ditto.
|
||||||
|
|
||||||
|
* sigproc.cc (sigproc_init): Minor change to debugging output.
|
||||||
|
|
||||||
|
* times.cc (utime_worker): Use build_fh_pc rather than reinterpreting
|
||||||
|
the posix path name again. Return any error from path_conv immediately.
|
||||||
|
|
||||||
2005-10-22 Corinna Vinschen <corinna@vinschen.de>
|
2005-10-22 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* fhandler_socket.cc (fhandler_socket::connect): Don't restrict
|
* fhandler_socket.cc (fhandler_socket::connect): Don't restrict
|
||||||
|
@ -253,7 +275,6 @@
|
||||||
(pinfo::unlock): Delete.
|
(pinfo::unlock): Delete.
|
||||||
* winsup.h (get_exit_lock): Delete declaration.
|
* winsup.h (get_exit_lock): Delete declaration.
|
||||||
|
|
||||||
|
|
||||||
2005-10-03 Corinna Vinschen <corinna@vinschen.de>
|
2005-10-03 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* uname.cc (uname): Disable use of GetNativeSystemInfo.
|
* uname.cc (uname): Disable use of GetNativeSystemInfo.
|
||||||
|
|
|
@ -398,6 +398,7 @@ class cygheap_fdenum : public cygheap_fdmanip
|
||||||
public:
|
public:
|
||||||
cygheap_fdenum (int start_fd = -1, bool lockit = false)
|
cygheap_fdenum (int start_fd = -1, bool lockit = false)
|
||||||
{
|
{
|
||||||
|
locked = lockit;
|
||||||
if (lockit)
|
if (lockit)
|
||||||
cygheap->fdtab.lock ();
|
cygheap->fdtab.lock ();
|
||||||
this->start_fd = fd = start_fd < 0 ? -1 : start_fd;
|
this->start_fd = fd = start_fd < 0 ? -1 : start_fd;
|
||||||
|
@ -415,27 +416,6 @@ class cygheap_fdenum : public cygheap_fdmanip
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class lock_process
|
|
||||||
{
|
|
||||||
bool skip_unlock;
|
|
||||||
public:
|
|
||||||
lock_process (bool exiting = false)
|
|
||||||
{
|
|
||||||
cygheap->fdtab.lock ();
|
|
||||||
skip_unlock = exiting;
|
|
||||||
if (exiting && exit_state < ES_SET_MUTO)
|
|
||||||
{
|
|
||||||
exit_state = ES_SET_MUTO;
|
|
||||||
muto::set_exiting_thread ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
~lock_process ()
|
|
||||||
{
|
|
||||||
if (!skip_unlock)
|
|
||||||
cygheap->fdtab.unlock ();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class child_info;
|
class child_info;
|
||||||
void __stdcall cygheap_fixup_in_child (bool);
|
void __stdcall cygheap_fixup_in_child (bool);
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -150,7 +150,7 @@ _cygtls::fixup_after_fork ()
|
||||||
pop ();
|
pop ();
|
||||||
sig = 0;
|
sig = 0;
|
||||||
}
|
}
|
||||||
stacklock = 0;
|
stacklock = spinning = 0;
|
||||||
locals.exitsock = INVALID_SOCKET;
|
locals.exitsock = INVALID_SOCKET;
|
||||||
wq.thread_ev = NULL;
|
wq.thread_ev = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,8 +47,8 @@ HANDLE NO_COPY hMainProc = (HANDLE) -1;
|
||||||
HANDLE NO_COPY hMainThread;
|
HANDLE NO_COPY hMainThread;
|
||||||
HANDLE NO_COPY hProcToken;
|
HANDLE NO_COPY hProcToken;
|
||||||
HANDLE NO_COPY hProcImpToken;
|
HANDLE NO_COPY hProcImpToken;
|
||||||
muto NO_COPY dtable::lock_cs; /* This should be in dtable.cc but it causes inexplicable
|
|
||||||
errors there. */
|
muto NO_COPY lock_process::locker;
|
||||||
|
|
||||||
bool display_title;
|
bool display_title;
|
||||||
bool strip_title_path;
|
bool strip_title_path;
|
||||||
|
@ -636,6 +636,7 @@ get_cygwin_startup_info ()
|
||||||
void __stdcall
|
void __stdcall
|
||||||
dll_crt0_0 ()
|
dll_crt0_0 ()
|
||||||
{
|
{
|
||||||
|
lock_process::init ();
|
||||||
init_console_handler (TRUE);
|
init_console_handler (TRUE);
|
||||||
_impure_ptr = _GLOBAL_REENT;
|
_impure_ptr = _GLOBAL_REENT;
|
||||||
_impure_ptr->_stdin = &_impure_ptr->__sf[0];
|
_impure_ptr->_stdin = &_impure_ptr->__sf[0];
|
||||||
|
|
|
@ -47,8 +47,6 @@ dtable_init ()
|
||||||
{
|
{
|
||||||
if (!cygheap->fdtab.size)
|
if (!cygheap->fdtab.size)
|
||||||
cygheap->fdtab.extend (NOFILE_INCR);
|
cygheap->fdtab.extend (NOFILE_INCR);
|
||||||
cygheap->fdtab.init_lock ();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void __stdcall
|
void __stdcall
|
||||||
|
@ -60,12 +58,6 @@ set_std_handle (int fd)
|
||||||
SetStdHandle (std_consts[fd], cygheap->fdtab[fd]->get_output_handle ());
|
SetStdHandle (std_consts[fd], cygheap->fdtab[fd]->get_output_handle ());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
dtable::init_lock ()
|
|
||||||
{
|
|
||||||
lock_cs.init ("lock_cs");
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
dtable::extend (int howmuch)
|
dtable::extend (int howmuch)
|
||||||
{
|
{
|
||||||
|
@ -687,7 +679,6 @@ dtable::fixup_after_exec ()
|
||||||
{
|
{
|
||||||
first_fd_for_open = 0;
|
first_fd_for_open = 0;
|
||||||
fhandler_base *fh;
|
fhandler_base *fh;
|
||||||
cygheap->fdtab.init_lock ();
|
|
||||||
for (size_t i = 0; i < size; i++)
|
for (size_t i = 0; i < size; i++)
|
||||||
if ((fh = fds[i]) != NULL)
|
if ((fh = fds[i]) != NULL)
|
||||||
{
|
{
|
||||||
|
@ -713,7 +704,6 @@ void
|
||||||
dtable::fixup_after_fork (HANDLE parent)
|
dtable::fixup_after_fork (HANDLE parent)
|
||||||
{
|
{
|
||||||
fhandler_base *fh;
|
fhandler_base *fh;
|
||||||
cygheap->fdtab.init_lock ();
|
|
||||||
for (size_t i = 0; i < size; i++)
|
for (size_t i = 0; i < size; i++)
|
||||||
if ((fh = fds[i]) != NULL)
|
if ((fh = fds[i]) != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,6 @@ class fhandler_fifo;
|
||||||
#define BFH_OPTS (PC_NULLEMPTY | PC_FULL | PC_POSIX)
|
#define BFH_OPTS (PC_NULLEMPTY | PC_FULL | PC_POSIX)
|
||||||
class dtable
|
class dtable
|
||||||
{
|
{
|
||||||
static muto lock_cs;
|
|
||||||
fhandler_base **fds;
|
fhandler_base **fds;
|
||||||
#ifdef NEWVFORK
|
#ifdef NEWVFORK
|
||||||
fhandler_base **fds_on_hold;
|
fhandler_base **fds_on_hold;
|
||||||
|
@ -31,9 +30,8 @@ class dtable
|
||||||
static const int initial_archetype_size = 8;
|
static const int initial_archetype_size = 8;
|
||||||
int first_fd_for_open;
|
int first_fd_for_open;
|
||||||
int cnt_need_fixup_before;
|
int cnt_need_fixup_before;
|
||||||
void lock () {lock_cs.acquire ();}
|
void lock () {lock_process::locker.acquire ();}
|
||||||
void unlock () {lock_cs.release ();}
|
void unlock () {lock_process::locker.release ();}
|
||||||
void init_lock ();
|
|
||||||
public:
|
public:
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
|
|
|
@ -485,7 +485,7 @@ sigproc_init ()
|
||||||
hwait_sig->zap_h ();
|
hwait_sig->zap_h ();
|
||||||
|
|
||||||
global_sigs[SIGSTOP].sa_flags = SA_RESTART | SA_NODEFER;
|
global_sigs[SIGSTOP].sa_flags = SA_RESTART | SA_NODEFER;
|
||||||
sigproc_printf ("process/signal handling enabled(%x)", myself->process_state);
|
sigproc_printf ("process/signal handling enabled, state %p", myself->process_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called on process termination to terminate signal and process threads.
|
/* Called on process termination to terminate signal and process threads.
|
||||||
|
|
|
@ -44,4 +44,28 @@ public:
|
||||||
static void set_exiting_thread () {exiting_thread = GetCurrentThreadId ();}
|
static void set_exiting_thread () {exiting_thread = GetCurrentThreadId ();}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class lock_process
|
||||||
|
{
|
||||||
|
bool skip_unlock;
|
||||||
|
static muto locker;
|
||||||
|
public:
|
||||||
|
static void init () {locker.init ("lock_process");}
|
||||||
|
lock_process (bool exiting = false)
|
||||||
|
{
|
||||||
|
locker.acquire ();
|
||||||
|
skip_unlock = exiting;
|
||||||
|
if (exiting && exit_state < ES_SET_MUTO)
|
||||||
|
{
|
||||||
|
exit_state = ES_SET_MUTO;
|
||||||
|
muto::set_exiting_thread ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
~lock_process ()
|
||||||
|
{
|
||||||
|
if (!skip_unlock)
|
||||||
|
locker.release ();
|
||||||
|
}
|
||||||
|
friend class dtable;
|
||||||
|
};
|
||||||
|
|
||||||
#endif /*_SYNC_H*/
|
#endif /*_SYNC_H*/
|
||||||
|
|
|
@ -445,36 +445,42 @@ static int
|
||||||
utimes_worker (const char *path, const struct timeval *tvp, int nofollow)
|
utimes_worker (const char *path, const struct timeval *tvp, int nofollow)
|
||||||
{
|
{
|
||||||
int res = -1;
|
int res = -1;
|
||||||
path_conv win32 (path, nofollow ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW);
|
path_conv win32 (path, PC_POSIX | (nofollow ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW));
|
||||||
fhandler_base *fh = NULL;
|
|
||||||
bool fromfd = false;
|
|
||||||
|
|
||||||
cygheap_fdenum cfd;
|
if (win32.error)
|
||||||
while (cfd.next () >= 0)
|
set_errno (win32.error);
|
||||||
if (cfd->get_access () & (FILE_WRITE_ATTRIBUTES | GENERIC_WRITE)
|
else
|
||||||
&& strcmp (cfd->get_win32_name (), win32) == 0)
|
|
||||||
{
|
|
||||||
fh = cfd;
|
|
||||||
fromfd = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fh)
|
|
||||||
{
|
|
||||||
if (!(fh = build_fh_name (path, NULL, PC_SYM_FOLLOW)))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (fh->error ())
|
|
||||||
{
|
{
|
||||||
debug_printf ("got %d error from build_fh_name", fh->error ());
|
fhandler_base *fh = NULL;
|
||||||
set_errno (fh->error ());
|
bool fromfd = false;
|
||||||
|
|
||||||
|
cygheap_fdenum cfd;
|
||||||
|
while (cfd.next () >= 0)
|
||||||
|
if (cfd->get_access () & (FILE_WRITE_ATTRIBUTES | GENERIC_WRITE)
|
||||||
|
&& strcmp (cfd->get_win32_name (), win32) == 0)
|
||||||
|
{
|
||||||
|
fh = cfd;
|
||||||
|
fromfd = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fh)
|
||||||
|
{
|
||||||
|
if (!(fh = build_fh_pc (win32)))
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
if (fh->error ())
|
||||||
|
{
|
||||||
|
debug_printf ("got %d error from build_fh_name", fh->error ());
|
||||||
|
set_errno (fh->error ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
res = fh->utimes (tvp);
|
||||||
|
|
||||||
|
if (!fromfd)
|
||||||
|
delete fh;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
res = fh->utimes (tvp);
|
|
||||||
|
|
||||||
if (!fromfd)
|
|
||||||
delete fh;
|
|
||||||
|
|
||||||
error:
|
error:
|
||||||
syscall_printf ("%d = utimes (%s, %p)", res, path, tvp);
|
syscall_printf ("%d = utimes (%s, %p)", res, path, tvp);
|
||||||
|
|
Loading…
Reference in New Issue