Nov. 30, 2019
10:34 a.m.
On Sat, 30 Nov 2019 11:10:50 +0100, Bj�rn Mork said:
My version of setsockopt(2) says (...) ERRORS EBADF The argument sockfd is not a valid file descrip‐ tor.
Note that there is no general *guarantee* that a syscall cannot return any values other than the ones in the manpage.
If you look at e.g. udp_lib_setsockopt() you'll see that it conforms strictly to this. I don't know why do_tcp_setsockopt() doesn't.
Probably because those are the only errors that the UDP version can hit, but the TCP case can hit cases like "socket must be in a connected state" and possibly other error codes. Now, I admit wondering why it uses ENOTSUPP rather than ENOTCONN for this particular case.