Bill Fenner
2003-01-13 20:09:32 UTC
Folks,
I'm trying to answer the following question: can a protocol implementation
access the data in the user's buffer that he passes to getsockopt() in order
to fulfill the request? The answer for 4.4BSD is "no", the option return
is in an mbuf which is then copied into the user buffer. The answer for
FreeBSD 3.1 and later is "yes", since the struct sockopt contains the
address of the user buffer, so the getsockopt handler could call
sooptcopyin() as well as sooptcopyout().
I'm asking because we're getting pushback wrt using ioctl() in the
IGMPv3/MLDv2 API for a case where the request contains more information
than just an integer -- e.g. a case like SIOCGIFADDR where the kernel
looks up the interface passed in and returns the appropriate value in
the same buffer. The Linux kernel people say that this should be
getsockopt(), and don't accept the argument that the kernel getsockopt()
API has never required copyin before.
I'm interested in hearing about any OS that you know the details of,
not just BSD ones.
Thanks,
Bill
---------------------------------------------------------------------
The BSD APIs Discussion Mailing List
To unsubscribe:
send "unsubscribe bsd-api-discuss" to majordomo-DZEk9q7Sfju/3pe1ocb+swC/***@public.gmane.org
I'm trying to answer the following question: can a protocol implementation
access the data in the user's buffer that he passes to getsockopt() in order
to fulfill the request? The answer for 4.4BSD is "no", the option return
is in an mbuf which is then copied into the user buffer. The answer for
FreeBSD 3.1 and later is "yes", since the struct sockopt contains the
address of the user buffer, so the getsockopt handler could call
sooptcopyin() as well as sooptcopyout().
I'm asking because we're getting pushback wrt using ioctl() in the
IGMPv3/MLDv2 API for a case where the request contains more information
than just an integer -- e.g. a case like SIOCGIFADDR where the kernel
looks up the interface passed in and returns the appropriate value in
the same buffer. The Linux kernel people say that this should be
getsockopt(), and don't accept the argument that the kernel getsockopt()
API has never required copyin before.
I'm interested in hearing about any OS that you know the details of,
not just BSD ones.
Thanks,
Bill
---------------------------------------------------------------------
The BSD APIs Discussion Mailing List
To unsubscribe:
send "unsubscribe bsd-api-discuss" to majordomo-DZEk9q7Sfju/3pe1ocb+swC/***@public.gmane.org