Changeset View
Changeset View
Standalone View
Standalone View
tests/sys/netinet/so_reuseport_lb_test.c
Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | lb_simple_accept_loop(int domain, const struct sockaddr *addr, int sds[], | ||||
for (i = 0; i < nsds; i++) | for (i = 0; i < nsds; i++) | ||||
ATF_REQUIRE_MSG(acceptcnt[i] > excnt, "uneven balancing"); | ATF_REQUIRE_MSG(acceptcnt[i] > excnt, "uneven balancing"); | ||||
} | } | ||||
static int | static int | ||||
lb_listen_socket(int domain, int flags) | lb_listen_socket(int domain, int flags) | ||||
{ | { | ||||
size_t one; | unsigned int one; | ||||
melifaro: Sorry, why //unsigned// ?
`setsockopt(2)` indirectly suggests that in should be plain int… | |||||
fernando.valle_eldorado.org.brAuthorUnsubmitted Done Inline ActionsYes, I read this on the manpage... but I thought of changing the type to the most corresponding one possible, according to the unix specifications size_t is an unsigned integral type. fernando.valle_eldorado.org.br: Yes, I read this on the manpage... but I thought of changing the type to the most corresponding… | |||||
melifaroUnsubmitted Not Done Inline ActionsKernel reads the value as int, which is consistent with the manpage. Would it be possible to reflect it here? melifaro: Kernel [[ https://svnweb.freebsd.org/base/head/sys/kern/uipc_socket.c? | |||||
int error, sd; | int error, sd; | ||||
sd = socket(domain, SOCK_STREAM | flags, 0); | sd = socket(domain, SOCK_STREAM | flags, 0); | ||||
ATF_REQUIRE_MSG(sd >= 0, "socket() failed: %s", strerror(errno)); | ATF_REQUIRE_MSG(sd >= 0, "socket() failed: %s", strerror(errno)); | ||||
one = 1; | one = 1; | ||||
error = setsockopt(sd, SOL_SOCKET, SO_REUSEPORT_LB, &one, sizeof(one)); | error = setsockopt(sd, SOL_SOCKET, SO_REUSEPORT_LB, &one, sizeof(one)); | ||||
ATF_REQUIRE_MSG(error == 0, "setsockopt(SO_REUSEPORT_LB) failed: %s", | ATF_REQUIRE_MSG(error == 0, "setsockopt(SO_REUSEPORT_LB) failed: %s", | ||||
▲ Show 20 Lines • Show All 123 Lines • Show Last 20 Lines |
Sorry, why unsigned ?
setsockopt(2) indirectly suggests that in should be plain int: Most socket-level options utilize an int argument for optval.