NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Debugging socket options



brook%nmsu.edu@localhost (Brook Milligan) writes:

>> On Dec 4, 2022, at 3:16 PM, Michael van Elst <mlelstv%serpens.de@localhost> =
>wrote:
>> socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, &pair);
>> setsockopt(3, SOL_SOCKET, SO_PASSCRED, &val, sizeof(val));

>Thanks.  Where should I have been looking to find this easily?

In Linux manual pages (also in NetBSD manual pages) you find 
the calling signature of these functions and what kind of
parameters they get.

So socketpair gets a protocol family (PF_*) and socket type (SOCK_*),
and setsockopt gets a descriptor, an option level (SOL_SOCKET or a
protocol number like IPPROTO_*) and an option "name" (SO_*, also a
number).

In Linux include files you find the symbolic names for the numbers.
The assignments differ from NetBSD, e.g. SOL_SOCKET == 1 for Linux
but SOL_SOCKET == 0xffff for NetBSD. The Linux emulation layer
translates such numbers, but ktrace reports the arguments as given
to the (Linux) system call.




Home | Main Index | Thread Index | Old Index