Index: cygwin/cygwin.din
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/cygwin.din,v
retrieving revision 1.50
diff -u -p -r1.50 cygwin.din
--- cygwin/cygwin.din	6 Jun 2002 00:09:55 -0000	1.50
+++ cygwin/cygwin.din	7 Jun 2002 03:46:47 -0000
@@ -1270,3 +1270,4 @@ acltotext
 _acltotext = acltotext
 aclfromtext
 _aclfromtext = aclfromtext
+sem_getvalue
Index: cygwin/posix.sgml
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/posix.sgml,v
retrieving revision 1.3
diff -u -p -r1.3 posix.sgml
--- cygwin/posix.sgml	24 Jun 2001 22:26:52 -0000	1.3
+++ cygwin/posix.sgml	7 Jun 2002 03:46:47 -0000
@@ -52,7 +52,7 @@ getgrgid, getgrnam, getpwnam, getpwuid
 </para></sect2>
 <sect2><title>Synchronization (Section 11) </title><para>
 
-sem_init, sem_destroy, sem_wait, sem_trywait, sem_post,
+sem_init, sem_destroy, sem_wait, sem_trywait, sem_post, sem_getvalue,
 pthread_mutex_init, pthread_mutex_destroy, pthread_mutex_lock,
 pthread_mutex_trylock, pthread_mutex_unlock
 
Index: cygwin/pthread.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/pthread.cc,v
retrieving revision 1.11
diff -u -p -r1.11 pthread.cc
--- cygwin/pthread.cc	29 Sep 2001 09:01:01 -0000	1.11
+++ cygwin/pthread.cc	7 Jun 2002 03:46:48 -0000
@@ -476,4 +476,10 @@ sem_post (sem_t * sem)
   return __sem_post (sem);
 }
 
+int
+sem_getvalue (sem_t * sem, int * sval)
+{
+  return __sem_getvalue (sem, sval);
+}
+
 }
Index: cygwin/thread.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/thread.cc,v
retrieving revision 1.70
diff -u -p -r1.70 thread.cc
--- cygwin/thread.cc	5 Jun 2002 12:39:54 -0000	1.70
+++ cygwin/thread.cc	7 Jun 2002 03:46:51 -0000
@@ -2271,4 +2271,13 @@ __sem_post (sem_t *sem)
   return 0;
 }
 
+int
+__sem_getvalue (sem_t *sem, int *sval)
+{
+  if (verifyable_object_isvalid (sem, SEM_MAGIC) != VALID_OBJECT)
+    return EINVAL;
+  *sval = (*sem)->currentvalue;
+  return 0;
+}
+
 #endif // MT_SAFE
Index: cygwin/thread.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/thread.h,v
retrieving revision 1.34
diff -u -p -r1.34 thread.h
--- cygwin/thread.h	5 Jun 2002 12:39:55 -0000	1.34
+++ cygwin/thread.h	7 Jun 2002 03:46:52 -0000
@@ -511,6 +511,7 @@ int __sem_destroy (sem_t * sem);
 int __sem_wait (sem_t * sem);
 int __sem_trywait (sem_t * sem);
 int __sem_post (sem_t * sem);
+int __sem_getvalue (sem_t * sem, int * sval);
 };
 
 #endif // MT_SAFE
Index: cygwin/include/semaphore.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/semaphore.h,v
retrieving revision 1.1
diff -u -p -r1.1 semaphore.h
--- cygwin/include/semaphore.h	21 Mar 2001 16:06:22 -0000	1.1
+++ cygwin/include/semaphore.h	7 Jun 2002 03:46:52 -0000
@@ -33,6 +33,7 @@ extern "C"
   int sem_wait (sem_t * sem);
   int sem_trywait (sem_t * sem);
   int sem_post (sem_t * sem);
+  int sem_getvalue (sem_t * sem, int * sval);
 
 #ifdef __cplusplus
 }
Index: doc/calls.texinfo
===================================================================
RCS file: /cvs/src/src/winsup/doc/calls.texinfo,v
retrieving revision 1.3
diff -u -p -r1.3 calls.texinfo
--- doc/calls.texinfo	20 Jul 2000 11:04:33 -0000	1.3
+++ doc/calls.texinfo	7 Jun 2002 03:46:53 -0000
@@ -422,7 +422,7 @@ net release.)}
 @item pthread_mutex_unlock: P96 11.3.3.1
 @item sem_close: P96 11.2.4.1 -- unimplemented
 @item sem_destroy: P96 11.2.2.1
-@item sem_getvalue: P96 11.2.8.1 -- unimplemented
+@item sem_getvalue: P96 11.2.8.1
 @item sem_init: P96 11.2.1.1
 @item sem_open: P96 11.2.3.1 -- unimplemented
 @item sem_post: P96 11.2.7.1
