Summary:ASTERISK-15075: res_pktccops.c using MSG_NOSIGNAL
Reporter:Olle Johansson (oej)Labels:
Date Opened:2009-11-04 02:13:26.000-0600Date Closed:2009-12-03 23:20:25.000-0600
Versions:Frequency of
Description:MSG_NOSIGNAL doesn't exist on OS/X

According to http://lists.apple.com/archives/macnetworkprog/2002/Dec/msg00091.html OS/X has "the socket option SO_NOSIGPIPE that prevents SIGPIPE from being raised when a write fails on a socket to which there is no reader; instead the write to the socket returns with the error EPIPE."


 [CC] res_pktccops.c -> res_pktccops.o
res_pktccops.c: In function 'cops_sendmsg':
res_pktccops.c:428: error: 'MSG_NOSIGNAL' undeclared (first use in this function)
res_pktccops.c:428: error: (Each undeclared identifier is reported only once
res_pktccops.c:428: error: for each function it appears in.)
make[1]: *** [res_pktccops.o] Error 1
make: *** [res] Error 2
Comments:By: Olle Johansson (oej) 2009-11-04 06:07:00.000-0600

Found more information claiming that MSG_NOSIGNAL is not posix compliant and doesn't exist in BSD


However the man page for send() on FreeBSD includes it.
#define MSG_NOSIGNAL    0x20000 /* do not generate SIGPIPE on EOF */

The man page for OS/X Snow leopard only include two flags for send():

    The flags parameter may include one or more of the following:

    #define MSG_OOB        0x1  /* process out-of-band data */
    #define MSG_DONTROUTE  0x4  /* bypass routing, use direct interface */


By: Doug McCallum (dougm) 2009-12-03 17:25:16.000-0600

The same problem exists on OpenSolaris as well (also BSD origins).
The Mac OS/X SO_NOSIGNAL doesn't exist on Solaris. It would be nice to have
a common workaround, or better, a common solution.

By: Digium Subversion (svnbot) 2009-12-03 23:00:07.000-0600

Repository: asterisk
Revision: 232950

U   trunk/configure
U   trunk/configure.ac
U   trunk/include/asterisk/autoconfig.h.in
U   trunk/res/res_pktccops.c

r232950 | tilghman | 2009-12-03 23:00:06 -0600 (Thu, 03 Dec 2009) | 4 lines

OS X does not define MSG_NOSIGNAL, but it does have a socket option SO_NOSIGPIPE.
(closes issue ASTERISK-15075)
Reported by: oej



By: Tilghman Lesher (tilghman) 2009-12-03 23:01:59.000-0600

dougm:  It should.  MSG_NOSIGNAL is now a POSIX-required option.  See http://www.opengroup.org/onlinepubs/9699919799/functions/send.html

By: Tilghman Lesher (tilghman) 2009-12-03 23:20:25.000-0600

Additionally, OpenSolaris has acknowledged that this is a problem and will fix it:  http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6313487