cvs commit: src/sys/compat/linux linux_socket.c

Maxim Sobolev sobomax at portaone.com
Wed Mar 9 00:10:03 GMT 2005


Looks fine, though it's hard for me to comment about adding yet another 
flag that not present in standards. However, in my pretty 
unauthoritative opinion, since Linux has it, while many people and ISVs 
out there use it as a sort of reference when developing  free software, 
it will probably make sense to support it as well, especially 
considering that it's pretty easy to do.

In any case, since it's definitelty an API/ABI change (programs that use 
MSG_NOSIGNAL won't compile on older systems, while binary programs that 
use it may not work correctly on older systems) it also warrants 
__FreeBSD_version bump and proper documentation in the Porter's 
Handbook. Also the ABI argument probably puts MFC out of question.

Thanks!

-Maxim

Alfred Perlstein wrote:
> * Alfred Perlstein <alfred at freebsd.org> [050308 13:04] wrote:
> 
>>* Maxim Sobolev <sobomax at portaone.com> [050308 08:14] wrote:
>>
>>>Alfred Perlstein wrote:
>>>
>>>>Why not just expand our API to do this as well?  It shouldn't be
>>>>that hard and then we'll gain the additional functionality.
>>>
>>>I have been erroneously assuming that it would be much harder to do, but 
>>>closer investigation is revealed that it's very simple to do.
>>>
>>>Committed, thank you for suggestion!
>>
>>You rule, thank you!
> 
> 
> I was about to update the docs to include it as part of our API, but
> then noticed you left it behind #ifdef _KERNEL, what about taking it
> out?
> 
> I've taken it out and added documentation, can you review this?
> 
> 
> Index: lib/libc/sys/send.2
> ===================================================================
> RCS file: /home/ncvs/src/lib/libc/sys/send.2,v
> retrieving revision 1.30
> diff -u -r1.30 send.2
> --- lib/libc/sys/send.2	13 Feb 2005 22:25:13 -0000	1.30
> +++ lib/libc/sys/send.2	8 Mar 2005 23:19:18 -0000
> @@ -103,11 +103,12 @@
>  .Fa flags
>  argument may include one or more of the following:
>  .Bd -literal
> -#define	MSG_OOB		0x1   /* process out-of-band data */
> -#define	MSG_PEEK	0x2   /* peek at incoming message */
> -#define	MSG_DONTROUTE	0x4   /* bypass routing, use direct interface */
> -#define MSG_EOR		0x8   /* data completes record */
> -#define	MSG_EOF		0x100 /* data completes transaction */
> +#define	MSG_OOB		0x00001 /* process out-of-band data */
> +#define	MSG_PEEK	0x00002 /* peek at incoming message */
> +#define	MSG_DONTROUTE	0x00004 /* bypass routing, use direct interface */
> +#define MSG_EOR		0x00008 /* data completes record */
> +#define	MSG_EOF		0x00100 /* data completes transaction */
> +#define	MSG_NOSIGNAL	0x20000 /* do not generate SIGPIPE on EOF */
>  .Ed
>  .Pp
>  The flag
> @@ -135,6 +136,9 @@
>  .Xr ttcp 4 ) .
>  .Dv MSG_DONTROUTE
>  is usually used only by diagnostic or routing programs.
> +.Dv MSG_NOSIGNAL
> +is used to prevent SIGPIPE generation when writing a socket that
> +may be closed.
>  .Pp
>  See
>  .Xr recv 2
> Index: sys/sys/socket.h
> ===================================================================
> RCS file: /home/ncvs/src/sys/sys/socket.h,v
> retrieving revision 1.86
> diff -u -r1.86 socket.h
> --- sys/sys/socket.h	8 Mar 2005 16:11:41 -0000	1.86
> +++ sys/sys/socket.h	8 Mar 2005 23:20:44 -0000
> @@ -398,7 +398,9 @@
>  #endif
>  #ifdef _KERNEL
>  #define	MSG_SOCALLBCK   0x10000		/* for use by socket callbacks - soreceive (TCP) */
> -#define	MSG_NOSIGNAL	0x20000		/* for use with emulation layers */
> +#endif
> +#if __BSD_VISIBLE
> +#define	MSG_NOSIGNAL	0x20000		/* do not generate SIGPIPE on EOF */
>  #endif
>  
>  /*
> 
> 
> 



More information about the cvs-src mailing list