* dcrt0.cc (get_exit_lock): Use myself.lock rather than exit_lock.
* exceptions.cc (exit_lock): Delete. (events_init): Don't init exit_lock. * (_pinfo::commune_process): Add per-PICOM debugging. * sigproc.cc (talktome): Add some temporary debugging statements. * fhandler_proc.cc (format_proc_cpuinfo): Cosmetic change. (format_proc_partitions): Ditto. * syscalls.cc (locked_append): Ditto.
This commit is contained in:
parent
f5cfdc0fa4
commit
0cb6fc5d30
|
@ -1,3 +1,15 @@
|
|||
2005-10-01 Christopher Faylor <cgf@timesys.com>
|
||||
|
||||
* dcrt0.cc (get_exit_lock): Use myself.lock rather than exit_lock.
|
||||
* exceptions.cc (exit_lock): Delete.
|
||||
(events_init): Don't init exit_lock.
|
||||
* (_pinfo::commune_process): Add per-PICOM debugging.
|
||||
* sigproc.cc (talktome): Add some temporary debugging statements.
|
||||
|
||||
* fhandler_proc.cc (format_proc_cpuinfo): Cosmetic change.
|
||||
(format_proc_partitions): Ditto.
|
||||
* syscalls.cc (locked_append): Ditto.
|
||||
|
||||
2005-09-30 Christopher Faylor <cgf@timesys.com>
|
||||
|
||||
* dcrt0.cc (do_exit): Don't set ES_SET_MUTO here. Call get_exit_lock()
|
||||
|
|
|
@ -1141,8 +1141,7 @@ _exit (int n)
|
|||
void
|
||||
get_exit_lock ()
|
||||
{
|
||||
extern CRITICAL_SECTION exit_lock;
|
||||
EnterCriticalSection (&exit_lock);
|
||||
myself.lock ();
|
||||
if (exit_state < ES_SET_MUTO)
|
||||
{
|
||||
exit_state = ES_SET_MUTO;
|
||||
|
|
|
@ -1167,8 +1167,6 @@ exit_sig:
|
|||
signal_exit (si.si_signo); /* never returns */
|
||||
}
|
||||
|
||||
CRITICAL_SECTION NO_COPY exit_lock;
|
||||
|
||||
/* Cover function to `do_exit' to handle exiting even in presence of more
|
||||
exceptions. We used to call exit, but a SIGSEGV shouldn't cause atexit
|
||||
routines to run. */
|
||||
|
@ -1229,7 +1227,6 @@ events_init ()
|
|||
windows_system_directory_length = end - windows_system_directory;
|
||||
debug_printf ("windows_system_directory '%s', windows_system_directory_length %d",
|
||||
windows_system_directory, windows_system_directory_length);
|
||||
InitializeCriticalSection (&exit_lock);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -635,7 +635,7 @@ format_proc_cpuinfo (char *destbuf, size_t maxsize)
|
|||
|
||||
GetSystemInfo (&siSystemInfo);
|
||||
|
||||
for (cpu_number = 0;;cpu_number++)
|
||||
for (cpu_number = 0; ; cpu_number++)
|
||||
{
|
||||
__small_sprintf (szBuffer, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\%d", cpu_number);
|
||||
|
||||
|
@ -945,7 +945,7 @@ format_proc_partitions (char *destbuf, size_t maxsize)
|
|||
|
||||
if (wincap.is_winnt ())
|
||||
{
|
||||
for (int drive_number=0;;drive_number++)
|
||||
for (int drive_number=0; ; drive_number++)
|
||||
{
|
||||
CHAR szDriveName[CYG_MAX_PATH];
|
||||
__small_sprintf (szDriveName, "\\\\.\\PHYSICALDRIVE%d", drive_number);
|
||||
|
|
|
@ -394,6 +394,7 @@ _pinfo::commune_process (siginfo_t& si)
|
|||
{
|
||||
case PICOM_CMDLINE:
|
||||
{
|
||||
sigproc_printf ("processing PICOM_CMDLINE");
|
||||
unsigned n = 1;
|
||||
extern int __argc_safe;
|
||||
const char *argv[__argc_safe + 1];
|
||||
|
@ -428,6 +429,7 @@ _pinfo::commune_process (siginfo_t& si)
|
|||
}
|
||||
case PICOM_CWD:
|
||||
{
|
||||
sigproc_printf ("processing PICOM_CWD");
|
||||
unsigned int n = strlen (cygheap->cwd.get (path, 1, 1,
|
||||
CYG_MAX_PATH)) + 1;
|
||||
if (!WriteFile (tothem, &n, sizeof n, &nr, NULL))
|
||||
|
@ -438,6 +440,7 @@ _pinfo::commune_process (siginfo_t& si)
|
|||
}
|
||||
case PICOM_ROOT:
|
||||
{
|
||||
sigproc_printf ("processing PICOM_ROOT");
|
||||
unsigned n;
|
||||
if (cygheap->root.exists ())
|
||||
n = strlen (strcpy (path, cygheap->root.posix_path ())) + 1;
|
||||
|
@ -451,6 +454,7 @@ _pinfo::commune_process (siginfo_t& si)
|
|||
}
|
||||
case PICOM_FDS:
|
||||
{
|
||||
sigproc_printf ("processing PICOM_FDS");
|
||||
unsigned int n = 0;
|
||||
int fd;
|
||||
cygheap_fdenum cfd;
|
||||
|
@ -469,27 +473,29 @@ _pinfo::commune_process (siginfo_t& si)
|
|||
break;
|
||||
}
|
||||
case PICOM_PIPE_FHANDLER:
|
||||
{
|
||||
HANDLE hdl = si._si_commune._si_pipe_fhandler;
|
||||
unsigned int n = 0;
|
||||
cygheap_fdenum cfd;
|
||||
while (cfd.next () >= 0)
|
||||
if (cfd->get_handle () == hdl)
|
||||
{
|
||||
fhandler_pipe *fh = cfd;
|
||||
n = sizeof *fh;
|
||||
if (!WriteFile (tothem, &n, sizeof n, &nr, NULL))
|
||||
sigproc_printf ("WriteFile sizeof hdl failed, %E");
|
||||
else if (!WriteFile (tothem, fh, n, &nr, NULL))
|
||||
sigproc_printf ("WriteFile hdl failed, %E");
|
||||
break;
|
||||
}
|
||||
if (!n && !WriteFile (tothem, &n, sizeof n, &nr, NULL))
|
||||
sigproc_printf ("WriteFile sizeof hdl failed, %E");
|
||||
break;
|
||||
}
|
||||
{
|
||||
sigproc_printf ("processing PICOM_FDS");
|
||||
HANDLE hdl = si._si_commune._si_pipe_fhandler;
|
||||
unsigned int n = 0;
|
||||
cygheap_fdenum cfd;
|
||||
while (cfd.next () >= 0)
|
||||
if (cfd->get_handle () == hdl)
|
||||
{
|
||||
fhandler_pipe *fh = cfd;
|
||||
n = sizeof *fh;
|
||||
if (!WriteFile (tothem, &n, sizeof n, &nr, NULL))
|
||||
sigproc_printf ("WriteFile sizeof hdl failed, %E");
|
||||
else if (!WriteFile (tothem, fh, n, &nr, NULL))
|
||||
sigproc_printf ("WriteFile hdl failed, %E");
|
||||
break;
|
||||
}
|
||||
if (!n && !WriteFile (tothem, &n, sizeof n, &nr, NULL))
|
||||
sigproc_printf ("WriteFile sizeof hdl failed, %E");
|
||||
break;
|
||||
}
|
||||
case PICOM_FD:
|
||||
{
|
||||
sigproc_printf ("processing PICOM_FD");
|
||||
int fd = si._si_commune._si_fd;
|
||||
unsigned int n = 0;
|
||||
cygheap_fdget cfd (fd);
|
||||
|
@ -505,6 +511,7 @@ _pinfo::commune_process (siginfo_t& si)
|
|||
}
|
||||
case PICOM_FIFO:
|
||||
{
|
||||
sigproc_printf ("processing PICOM_FIFO");
|
||||
fhandler_fifo *fh = cygheap->fdtab.find_fifo (si._si_commune._si_str);
|
||||
HANDLE it[2];
|
||||
if (fh == NULL)
|
||||
|
@ -530,7 +537,11 @@ _pinfo::commune_process (siginfo_t& si)
|
|||
}
|
||||
if (process_sync)
|
||||
{
|
||||
WaitForSingleObject (process_sync, INFINITE);
|
||||
DWORD res = WaitForSingleObject (process_sync, 5000);
|
||||
if (res != WAIT_OBJECT_0)
|
||||
sigproc_printf ("WFSO failed - %d, %E", res);
|
||||
else
|
||||
sigproc_printf ("synchronized with pid %d", si.si_pid);
|
||||
ForceCloseHandle (process_sync);
|
||||
}
|
||||
CloseHandle (tothem);
|
||||
|
@ -586,7 +597,11 @@ _pinfo::commune_request (__uint32_t code, ...)
|
|||
|
||||
si.si_signo = __SIGCOMMUNE;
|
||||
if (sig_send (this, si))
|
||||
goto err;
|
||||
{
|
||||
ForceCloseHandle (request_sync); /* don't signal semaphore since there was apparently no receiving process */
|
||||
request_sync = NULL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
size_t n;
|
||||
switch (code)
|
||||
|
|
|
@ -970,7 +970,9 @@ stopped_or_terminated (waitq *parent_w, _pinfo *child)
|
|||
static void
|
||||
talktome (siginfo_t& si, HANDLE readsig)
|
||||
{
|
||||
sigproc_printf ("pid %d wants some information", si.si_pid);
|
||||
pinfo pi (si.si_pid);
|
||||
sigproc_printf ("pid %d pi %p", si.si_pid, (_pinfo *) pi); // DELETEME
|
||||
if (si._si_commune._si_code & PICOM_EXTRASTR)
|
||||
{
|
||||
size_t n;
|
||||
|
@ -1173,6 +1175,7 @@ wait_sig (VOID *)
|
|||
break;
|
||||
}
|
||||
|
||||
CloseHandle (readsig);
|
||||
sigproc_printf ("signal thread exiting");
|
||||
ExitThread (0);
|
||||
}
|
||||
|
|
|
@ -2610,10 +2610,10 @@ locked_append (int fd, const void * buf, size_t size)
|
|||
int count = 0;
|
||||
|
||||
do
|
||||
if ((lock_buffer.l_start = lseek64 (fd, 0, SEEK_END)) != (_off64_t)-1
|
||||
if ((lock_buffer.l_start = lseek64 (fd, 0, SEEK_END)) != (_off64_t) -1
|
||||
&& fcntl_worker (fd, F_SETLKW, &lock_buffer) != -1)
|
||||
{
|
||||
if (lseek64 (fd, 0, SEEK_END) != (_off64_t)-1)
|
||||
if (lseek64 (fd, 0, SEEK_END) != (_off64_t) -1)
|
||||
write (fd, buf, size);
|
||||
lock_buffer.l_type = F_UNLCK;
|
||||
fcntl_worker (fd, F_SETLK, &lock_buffer);
|
||||
|
|
Loading…
Reference in New Issue