* exceptions.cc (unused_sig_wrapper): Eliminate unused parameter to asm.
* external.cc (cygwin_internal): Change CW_STRACE_ON to CW_STRACE_TOGGLE. * strace.cc (strace::hello): Toggle strace on and off. * sync.cc (muto::init): Renamed from constructor. * sync.h (muto::new): Delete. (muto::delete): Ditto. (new_muto): Simplify. Use muto.init for nearly everything. * uinfo.cc (uinfo_init): Avoid closing a NULL handle. * include/sys/cygwin.h (cygwin_getinfo_types): Rename CW_STRACE_OFF to CW_STRACE_TOGGLE. Delete CW_STRACE_OFF. * include/sys/strace.h (strace): Add "inited" field.
This commit is contained in:
parent
27530c3181
commit
907dc7d0c9
|
@ -1,3 +1,19 @@
|
|||
2002-02-14 Christopher Faylor <cgf@redhat.com>
|
||||
|
||||
* exceptions.cc (unused_sig_wrapper): Eliminate unused parameter to
|
||||
asm.
|
||||
* external.cc (cygwin_internal): Change CW_STRACE_ON to
|
||||
CW_STRACE_TOGGLE.
|
||||
* strace.cc (strace::hello): Toggle strace on and off.
|
||||
* sync.cc (muto::init): Renamed from constructor.
|
||||
* sync.h (muto::new): Delete.
|
||||
(muto::delete): Ditto.
|
||||
(new_muto): Simplify. Use muto.init for nearly everything.
|
||||
* uinfo.cc (uinfo_init): Avoid closing a NULL handle.
|
||||
* include/sys/cygwin.h (cygwin_getinfo_types): Rename CW_STRACE_OFF to
|
||||
CW_STRACE_TOGGLE. Delete CW_STRACE_OFF.
|
||||
* include/sys/strace.h (strace): Add "inited" field.
|
||||
|
||||
2001-02-12 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* include/cygwin/acl.h: Fix definition of aclent_t.
|
||||
|
|
|
@ -1220,14 +1220,14 @@ _sigdelayed0: \n\
|
|||
pushl %%ecx \n\
|
||||
pushl %%ebx \n\
|
||||
pushl %%eax \n\
|
||||
pushl %7 # saved errno \n\
|
||||
pushl %6 # saved errno \n\
|
||||
pushl %3 # oldmask \n\
|
||||
pushl %4 # signal argument \n\
|
||||
pushl $_sigreturn \n\
|
||||
\n\
|
||||
call _reset_signal_arrived@0 \n\
|
||||
pushl %5 # signal number \n\
|
||||
pushl %8 # newmask \n\
|
||||
pushl %7 # newmask \n\
|
||||
movl $0,%0 # zero the signal number as a \n\
|
||||
# flag to the signal handler thread\n\
|
||||
# that it is ok to set up sigsave\n\
|
||||
|
@ -1238,7 +1238,7 @@ _sigdelayed0: \n\
|
|||
__no_sig_end: \n\
|
||||
" : "=m" (sigsave.sig) : "m" (&_impure_ptr->_errno),
|
||||
"g" (sigsave.retaddr), "g" (sigsave.oldmask), "g" (sigsave.sig),
|
||||
"g" (sigsave.func), "o" (pid_offset), "g" (sigsave.saved_errno), "g" (sigsave.newmask)
|
||||
"g" (sigsave.func), "g" (sigsave.saved_errno), "g" (sigsave.newmask)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ cygwin_internal (cygwin_getinfo_types t, ...)
|
|||
# undef cr
|
||||
}
|
||||
|
||||
case CW_STRACE_ON:
|
||||
case CW_STRACE_TOGGLE:
|
||||
{
|
||||
pid_t pid = va_arg (arg, pid_t);
|
||||
pinfo p (pid);
|
||||
|
@ -221,6 +221,7 @@ cygwin_internal (cygwin_getinfo_types t, ...)
|
|||
return (DWORD) -1;
|
||||
}
|
||||
}
|
||||
|
||||
case CW_CYGWIN_PID_TO_WINPID:
|
||||
{
|
||||
pinfo p (va_arg (arg, pid_t));
|
||||
|
|
|
@ -145,7 +145,7 @@ read_etc_group ()
|
|||
|
||||
strncpy (group_name, "Administrators", sizeof (group_name));
|
||||
|
||||
static NO_COPY group_lock here;
|
||||
static NO_COPY group_lock here = group_lock();
|
||||
if (cygwin_finished_initializing)
|
||||
here.arm ();
|
||||
|
||||
|
|
|
@ -67,8 +67,7 @@ typedef enum
|
|||
CW_GET_CYGDRIVE_INFO,
|
||||
CW_SET_CYGWIN_REGISTRY_NAME,
|
||||
CW_GET_CYGWIN_REGISTRY_NAME,
|
||||
CW_STRACE_ON,
|
||||
CW_STRACE_OFF,
|
||||
CW_STRACE_TOGGLE,
|
||||
CW_CYGWIN_PID_TO_WINPID
|
||||
} cygwin_getinfo_types;
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
int active;
|
||||
int lmicrosec;
|
||||
int execing;
|
||||
int inited;
|
||||
strace() : version(1) {}
|
||||
void hello ();
|
||||
void prntf (unsigned, const char *func, const char *, ...) /*__attribute__ ((regparm(3)))*/;
|
||||
|
|
|
@ -452,7 +452,7 @@ peek_pipe (select_record *s, bool from_select)
|
|||
n = -1;
|
||||
}
|
||||
else if (!n || !guard_mutex)
|
||||
/* no guard mutex or nothing to read fromt he pipe. */;
|
||||
/* no guard mutex or nothing to read from the pipe. */;
|
||||
else if (WaitForSingleObject (guard_mutex, 0) != WAIT_OBJECT_0)
|
||||
{
|
||||
select_printf ("%s, couldn't get mutex %p, %E", fh->get_name (),
|
||||
|
|
|
@ -1182,7 +1182,7 @@ wait_sig (VOID *)
|
|||
/* just forcing the loop */
|
||||
break;
|
||||
|
||||
/* Internal signal to force a flush of strace data to disk. */
|
||||
/* Internal signal to turn on stracing. */
|
||||
case __SIGSTRACE:
|
||||
strace.hello ();
|
||||
break;
|
||||
|
|
|
@ -34,6 +34,13 @@ void
|
|||
strace::hello()
|
||||
{
|
||||
char buf[30];
|
||||
|
||||
if (inited)
|
||||
{
|
||||
active ^= 1;
|
||||
return;
|
||||
}
|
||||
|
||||
__small_sprintf (buf, "cYg%8x %x", _STRACE_INTERFACE_ACTIVATE_ADDR, &active);
|
||||
OutputDebugString (buf);
|
||||
|
||||
|
|
|
@ -28,18 +28,24 @@ muto NO_COPY muto_start;
|
|||
#undef WaitForSingleObject
|
||||
|
||||
/* Constructor */
|
||||
muto::muto (int inh, const char *s) : sync (0), visits(0), waiters(-1), tid (0), next (NULL)
|
||||
muto *
|
||||
muto::init (int inh, const char *s)
|
||||
{
|
||||
waiters = -1;
|
||||
/* Create event which is used in the fallback case when blocking is necessary */
|
||||
if (!(bruteforce = CreateEvent (inh ? &sec_all_nih : &sec_none_nih, FALSE, FALSE, name)))
|
||||
if (!(bruteforce = CreateEvent (inh ? &sec_all_nih : &sec_none_nih, FALSE, FALSE, NULL)))
|
||||
{
|
||||
DWORD oerr = GetLastError ();
|
||||
SetLastError (oerr);
|
||||
return;
|
||||
return NULL;
|
||||
}
|
||||
name = s;
|
||||
next = muto_start.next;
|
||||
muto_start.next = this;
|
||||
return this;
|
||||
}
|
||||
|
||||
#if 0 /* FIXME: Do we need this? mutos aren't destroyed until process exit */
|
||||
/* Destructor (racy?) */
|
||||
muto::~muto ()
|
||||
{
|
||||
|
@ -52,6 +58,7 @@ muto::~muto ()
|
|||
if (h)
|
||||
CloseHandle (h);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Acquire the lock. Argument is the number of milliseconds to wait for
|
||||
the lock. Multiple visits from the same thread are allowed and should
|
||||
|
|
|
@ -23,17 +23,13 @@ public:
|
|||
class muto *next;
|
||||
const char *name;
|
||||
|
||||
muto() {}
|
||||
/* The real constructor. */
|
||||
muto(int inh, const char *name);
|
||||
muto *init(int inh, const char *name) __attribute__ ((regparm (3)));
|
||||
|
||||
void *operator new (size_t, void *p) {return p;}
|
||||
void *operator new (size_t) {return ::new muto; }
|
||||
void operator delete (void *) {;} /* can't handle allocated mutos
|
||||
currently */
|
||||
|
||||
~muto ();
|
||||
int acquire (DWORD ms = INFINITE) __attribute__ ((regparm(1))); /* Acquire the lock. */
|
||||
#if 0 /* FIXME: See comment in sync.cc */
|
||||
~muto ()
|
||||
#endif
|
||||
int acquire (DWORD ms = INFINITE) __attribute__ ((regparm (1))); /* Acquire the lock. */
|
||||
int release (); /* Release the lock. */
|
||||
|
||||
/* Return true if caller thread owns the lock. */
|
||||
|
@ -48,9 +44,6 @@ extern muto muto_start;
|
|||
/* Use a statically allocated buffer as the storage for a muto */
|
||||
#define new_muto(__inh, __name) \
|
||||
({ \
|
||||
static volatile __attribute__((section(".data_cygwin_nocopy"))) muto __mbuf; \
|
||||
(void) new ((void *) &__mbuf) muto (__inh, __name); \
|
||||
__mbuf.next = muto_start.next; \
|
||||
muto_start.next = (muto *) &__mbuf; \
|
||||
(muto *) &__mbuf; \
|
||||
static muto __mbuf __attribute__((section(".data_cygwin_nocopy"))); \
|
||||
__mbuf.init (__inh, __name); \
|
||||
})
|
||||
|
|
|
@ -244,7 +244,7 @@ uinfo_init ()
|
|||
Setting `impersonated' to TRUE seems to be wrong but it
|
||||
isn't. Impersonated is thought as "Current User and `token'
|
||||
are coincident". See seteuid() for the mechanism behind that. */
|
||||
if (cygheap->user.token != INVALID_HANDLE_VALUE)
|
||||
if (cygheap->user.token != INVALID_HANDLE_VALUE && cygheap->user.token != NULL)
|
||||
CloseHandle (cygheap->user.token);
|
||||
cygheap->user.token = INVALID_HANDLE_VALUE;
|
||||
cygheap->user.impersonated = TRUE;
|
||||
|
|
Loading…
Reference in New Issue