Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-02-15 00:20:06 +0300
committerChristopher Faylor <me@cgf.cx>2002-02-15 00:20:06 +0300
commit907dc7d0c9f64d95b6d4da91dab6601d0e6054ec (patch)
tree09bc7dae25c4c1f67767dfc04fb1ee4c3a08c371 /winsup/cygwin
parent27530c31810976dec063f8ffdc6709945dfcef39 (diff)
* 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.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog16
-rw-r--r--winsup/cygwin/exceptions.cc6
-rw-r--r--winsup/cygwin/external.cc3
-rw-r--r--winsup/cygwin/grp.cc2
-rw-r--r--winsup/cygwin/include/sys/cygwin.h3
-rw-r--r--winsup/cygwin/include/sys/strace.h1
-rw-r--r--winsup/cygwin/select.cc2
-rw-r--r--winsup/cygwin/sigproc.cc2
-rw-r--r--winsup/cygwin/strace.cc7
-rw-r--r--winsup/cygwin/sync.cc13
-rw-r--r--winsup/cygwin/sync.h21
-rw-r--r--winsup/cygwin/uinfo.cc2
12 files changed, 51 insertions, 27 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index c953857c3..86d8583fb 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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.
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index cf7aaa5e6..123571618 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -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)
);
}
}
diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc
index 8a9f3bf9b..389255939 100644
--- a/winsup/cygwin/external.cc
+++ b/winsup/cygwin/external.cc
@@ -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));
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc
index 5490d1aad..c5804b70b 100644
--- a/winsup/cygwin/grp.cc
+++ b/winsup/cygwin/grp.cc
@@ -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 ();
diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h
index 76c553ea2..b8beaa67d 100644
--- a/winsup/cygwin/include/sys/cygwin.h
+++ b/winsup/cygwin/include/sys/cygwin.h
@@ -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;
diff --git a/winsup/cygwin/include/sys/strace.h b/winsup/cygwin/include/sys/strace.h
index 8039c1838..955d77a1e 100644
--- a/winsup/cygwin/include/sys/strace.h
+++ b/winsup/cygwin/include/sys/strace.h
@@ -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)))*/;
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 56d818d56..ebc9c8881 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -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 (),
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 2cac0a006..19ac8701b 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -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;
diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc
index 993bfe1ef..00ad60139 100644
--- a/winsup/cygwin/strace.cc
+++ b/winsup/cygwin/strace.cc
@@ -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);
diff --git a/winsup/cygwin/sync.cc b/winsup/cygwin/sync.cc
index 743ee02e7..1b5145aa4 100644
--- a/winsup/cygwin/sync.cc
+++ b/winsup/cygwin/sync.cc
@@ -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
diff --git a/winsup/cygwin/sync.h b/winsup/cygwin/sync.h
index d546b71e5..756503d86 100644
--- a/winsup/cygwin/sync.h
+++ b/winsup/cygwin/sync.h
@@ -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); \
})
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index eef543c21..1ee6143c8 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -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;