public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] Add pthread_sigqueue(3)
@ 2012-01-01 18:59 Yaakov (Cygwin/X)
  2012-01-02 18:00 ` Christopher Faylor
  0 siblings, 1 reply; 4+ messages in thread
From: Yaakov (Cygwin/X) @ 2012-01-01 18:59 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 281 bytes --]

This patchset adds pthread_sigqueue(3), a GNU extension:

http://www.kernel.org/doc/man-pages/online/pages/man3/pthread_sigqueue.3.html

The implementation is based on the existing sigqueue(2) and
pthread_kill(3) code.

Patches for winsup/cygwin and winsup/doc attached.


Yaakov


[-- Attachment #2: cygwin-pthread_sigqueue.patch --]
[-- Type: text/x-patch, Size: 3540 bytes --]

2012-01-??  Yaakov Selkowitz  <yselkowitz@...>

	* cygwin.din (pthread_sigqueue): Export.
	* posix.sgml (std-gnu): Add pthread_sigqueue.
	* thread.cc (pthread_sigqueue): New function.
	* include/thread.h (pthread_sigqueue): New function.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.

Index: cygwin.din
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/cygwin.din,v
retrieving revision 1.246
diff -u -p -r1.246 cygwin.din
--- cygwin.din	3 Aug 2011 19:17:02 -0000	1.246
+++ cygwin.din	4 Aug 2011 09:21:52 -0000
@@ -1270,6 +1270,7 @@ pthread_setschedparam SIGFE
 pthread_setschedprio SIGFE
 pthread_setspecific SIGFE
 pthread_sigmask SIGFE
+pthread_sigqueue SIGFE
 pthread_suspend SIGFE
 pthread_spin_destroy SIGFE
 pthread_spin_init SIGFE
Index: posix.sgml
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/posix.sgml,v
retrieving revision 1.70
diff -u -p -r1.70 posix.sgml
--- posix.sgml	3 Aug 2011 19:17:02 -0000	1.70
+++ posix.sgml	4 Aug 2011 09:21:53 -0000
@@ -1133,6 +1133,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008)
     pow10f
     ppoll
     pthread_getattr_np
+    pthread_sigqueue
     ptsname_r
     removexattr
     setxattr
Index: thread.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/thread.cc,v
retrieving revision 1.246
diff -u -p -r1.246 thread.cc
--- thread.cc	3 Aug 2011 19:17:02 -0000	1.246
+++ thread.cc	4 Aug 2011 09:21:53 -0000
@@ -3093,6 +3093,24 @@ pthread_sigmask (int operation, const si
   return res;
 }
 
+extern "C" int
+pthread_sigqueue (pthread_t *thread, int sig, const union sigval value)
+{
+  siginfo_t si = {0};
+
+  if (!pthread::is_good_object (thread))
+    return EINVAL;
+  if (!(*thread)->valid)
+    return ESRCH;
+
+  si.si_signo = sig;
+  si.si_code = SI_QUEUE;
+  si.si_value = value;
+  si.si_pid = myself->pid;
+  si.si_uid = myself->uid;
+  return sig_send (NULL, si, (*thread)->cygtls);
+}
+
 /* ID */
 
 extern "C" int
Index: include/pthread.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/pthread.h,v
retrieving revision 1.34
diff -u -p -r1.34 pthread.h
--- include/pthread.h	21 Jul 2011 09:39:22 -0000	1.34
+++ include/pthread.h	4 Aug 2011 09:21:53 -0000
@@ -202,6 +202,7 @@ void pthread_testcancel (void);
 /* Non posix calls */
 
 int pthread_getattr_np (pthread_t, pthread_attr_t *);
+int pthread_sigqueue (pthread_t *, int, const union sigval);
 int pthread_suspend (pthread_t);
 int pthread_continue (pthread_t);
 int pthread_yield (void);
Index: include/cygwin/version.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/version.h,v
retrieving revision 1.351
diff -u -p -r1.351 version.h
--- include/cygwin/version.h	3 Aug 2011 19:17:02 -0000	1.351
+++ include/cygwin/version.h	4 Aug 2011 09:21:53 -0000
@@ -427,12 +427,13 @@ details. */
       256: Add CW_ALLOC_DRIVE_MAP, CW_MAP_DRIVE_MAP, CW_FREE_DRIVE_MAP.
       257: Export getpt.
       258: Export get_current_dir_name.
+      259: Export pthread_sigqueue.
      */
 
      /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 258
+#define CYGWIN_VERSION_API_MINOR 259
 
      /* There is also a compatibity version number associated with the
 	shared memory regions.  It is incremented when incompatible

[-- Attachment #3: doc-pthread_sigqueue.patch --]
[-- Type: text/x-patch, Size: 735 bytes --]

2012-01-??  Yaakov Selkowitz  <yselkowitz@...>

	* new-features.sgml (ov-new1.7.10): Document pthread_sigqueue.

Index: new-features.sgml
===================================================================
RCS file: /cvs/src/src/winsup/doc/new-features.sgml,v
retrieving revision 1.96
diff -u -p -r1.96 new-features.sgml
--- new-features.sgml	1 Jan 2012 18:55:40 -0000	1.96
+++ new-features.sgml	1 Jan 2012 18:56:51 -0000
@@ -103,7 +103,7 @@ dlopen now supports the Glibc-specific R
 <listitem><para>
 Other new API: clock_settime, __fpurge, getgrouplist, get_current_dir_name,
 getpt, ppoll, psiginfo, psignal, ptsname_r, sys_siglist, pthread_setschedprio,
-sysinfo.
+pthread_sigqueue, sysinfo.
 </para></listitem>
 
 </itemizedlist>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add pthread_sigqueue(3)
  2012-01-01 18:59 [PATCH] Add pthread_sigqueue(3) Yaakov (Cygwin/X)
@ 2012-01-02 18:00 ` Christopher Faylor
  2012-01-02 18:09   ` Daniel Colascione
  0 siblings, 1 reply; 4+ messages in thread
From: Christopher Faylor @ 2012-01-02 18:00 UTC (permalink / raw)
  To: cygwin-patches

On Sun, Jan 01, 2012 at 12:59:00PM -0600, Yaakov (Cygwin/X) wrote:
>This patchset adds pthread_sigqueue(3), a GNU extension:
>
>http://www.kernel.org/doc/man-pages/online/pages/man3/pthread_sigqueue.3.html
>
>The implementation is based on the existing sigqueue(2) and
>pthread_kill(3) code.
>
>Patches for winsup/cygwin and winsup/doc attached.


>2012-01-??  Yaakov Selkowitz  <yselkowitz@...>
>
>	* cygwin.din (pthread_sigqueue): Export.
>	* posix.sgml (std-gnu): Add pthread_sigqueue.
>	* thread.cc (pthread_sigqueue): New function.
>	* include/thread.h (pthread_sigqueue): New function.
>	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.

I guess this can go in since I already "implemented" sigqueue but
SI_QUEUE isn't actually fully functional.  Cygwin doesn't queue signals
and I don't believe it handles the sigval union correctly.

But, anyway, thanks for the patch.  Go ahead and check in.

cgf

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add pthread_sigqueue(3)
  2012-01-02 18:00 ` Christopher Faylor
@ 2012-01-02 18:09   ` Daniel Colascione
  2012-01-02 18:12     ` Christopher Faylor
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Colascione @ 2012-01-02 18:09 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 491 bytes --]

On 1/2/12 9:59 AM, Christopher Faylor wrote:
> On Sun, Jan 01, 2012 at 12:59:00PM -0600, Yaakov (Cygwin/X) wrote:
> I guess this can go in since I already "implemented" sigqueue but
> SI_QUEUE isn't actually fully functional.  Cygwin doesn't queue signals
> and I don't believe it handles the sigval union correctly.

By the way: have you had a chance to track down the signal-related
crash bug at http://sourceware.org/ml/cygwin/2010-04/msg00989.html ? I
can still reproduce it.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 235 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add pthread_sigqueue(3)
  2012-01-02 18:09   ` Daniel Colascione
@ 2012-01-02 18:12     ` Christopher Faylor
  0 siblings, 0 replies; 4+ messages in thread
From: Christopher Faylor @ 2012-01-02 18:12 UTC (permalink / raw)
  To: cygwin-patches

On Mon, Jan 02, 2012 at 10:09:21AM -0800, Daniel Colascione wrote:
>On 1/2/12 9:59 AM, Christopher Faylor wrote:
>> On Sun, Jan 01, 2012 at 12:59:00PM -0600, Yaakov (Cygwin/X) wrote:
>> I guess this can go in since I already "implemented" sigqueue but
>> SI_QUEUE isn't actually fully functional.  Cygwin doesn't queue signals
>> and I don't believe it handles the sigval union correctly.
>
>By the way: have you had a chance to track down the signal-related
>crash bug at http://sourceware.org/ml/cygwin/2010-04/msg00989.html ? I
>can still reproduce it.

This is not a bug-reporting mailing list.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-02 18:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-01 18:59 [PATCH] Add pthread_sigqueue(3) Yaakov (Cygwin/X)
2012-01-02 18:00 ` Christopher Faylor
2012-01-02 18:09   ` Daniel Colascione
2012-01-02 18:12     ` Christopher Faylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).