RFC 2292 CMSG_FIRSTHDR macro...
From: George V. Neville-Neil (gnn_at_neville-neil.com)
Date: 04/29/04
- Previous message: The Jetman: "Re: [4.9-R]Can I Make My DSL Connect Go Faster ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 28 Apr 2004 17:09:30 -0700 To: net@freebsd.org
Howdy,
This should be a minor nit but, is there any reason we
implement this this way:
#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control)
instead of this way:
#define CMSG_FIRSTHDR(mhdr) \
( (mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
(struct cmsghdr *)(mhdr)->msg_control : \
(struct cmsghdr *)NULL )
as suggested in RFC 2292?
A coworker of mine asked about this and then I got to wondering
myself.
The RFC says:
(Note: Most existing implementations do not test the value of
msg_controllen, and just return the value of msg_control. The value
of msg_controllen must be tested, because if the application asks
recvmsg() to return ancillary data, by setting msg_control to point
to the application's buffer and setting msg_controllen to the length
of this buffer, the kernel indicates that no ancillary data is
available by setting msg_controllen to 0 on return. It is also
easier to put this test into this macro, than making the application
perform the test.)
Later,
George
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
- Previous message: The Jetman: "Re: [4.9-R]Can I Make My DSL Connect Go Faster ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|