Conversation

int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len);

What kind of abomination is this function signature

1
0
1
@meeper i dont recall it being that long but i guess i developed a tolerance to legacy libc design choices
1
0
1
@kirby They have an arguement specifially for the type size of the arguement to an option which is a bitmask and that just feels wrong
2
0
0

@kirby

also

int yes=1;
//char yes='1'; // Solaris people use this
// lose the pesky "Address already in use" error message
setsockopt(listener, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof yes);

sizeof yes

0
1
2
@meeper @kirby Not all socket options are bitmasks or single integers, some are entire structs, particularly for PMTU/multicast/timeouts. Also considering there can be arbitrary number of OS-specific sockets like netlink, it makes sense for generic API to not even try to provide typed variants.
0
0
0