Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_hostcache.c
Show First 20 Lines • Show All 627 Lines • ▼ Show 20 Lines | |||||
* unsorted order. | * unsorted order. | ||||
*/ | */ | ||||
static int | static int | ||||
sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) | sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
const int linesize = 128; | const int linesize = 128; | ||||
struct sbuf sb; | struct sbuf sb; | ||||
int i, error, len; | int i, error, len; | ||||
bool do_drain = false; | |||||
struct hc_metrics *hc_entry; | struct hc_metrics *hc_entry; | ||||
char ip4buf[INET_ADDRSTRLEN]; | char ip4buf[INET_ADDRSTRLEN]; | ||||
#ifdef INET6 | #ifdef INET6 | ||||
char ip6buf[INET6_ADDRSTRLEN]; | char ip6buf[INET6_ADDRSTRLEN]; | ||||
#endif | #endif | ||||
if (jailed_without_vnet(curthread->td_ucred) != 0) | if (jailed_without_vnet(curthread->td_ucred) != 0) | ||||
return (EPERM); | return (EPERM); | ||||
Show All 39 Lines | #endif | ||||
msec((u_long)hc_entry->rmx_rttvar * | msec((u_long)hc_entry->rmx_rttvar * | ||||
(RTM_RTTUNIT / (hz * TCP_RTTVAR_SCALE))), | (RTM_RTTUNIT / (hz * TCP_RTTVAR_SCALE))), | ||||
hc_entry->rmx_cwnd, | hc_entry->rmx_cwnd, | ||||
hc_entry->rmx_sendpipe, | hc_entry->rmx_sendpipe, | ||||
hc_entry->rmx_recvpipe, | hc_entry->rmx_recvpipe, | ||||
hc_entry->rmx_hits, | hc_entry->rmx_hits, | ||||
hc_entry->rmx_updates, | hc_entry->rmx_updates, | ||||
hc_entry->rmx_expire); | hc_entry->rmx_expire); | ||||
do_drain = true; | |||||
} | } | ||||
THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); | THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); | ||||
if (do_drain) { | |||||
sbuf_drain(&sb); | sbuf_drain(&sb); | ||||
tuexen: Maybe add a comment why you are doing this dance. It wasn't obvious for us... | |||||
do_drain = false; | |||||
} | |||||
Not Done Inline ActionsNot sure coordination is involved. Isn't it more that one should not call sbuf_drain() with an empty buffer. Please state that and finish the sentence with a full stop (.). tuexen: Not sure coordination is involved. Isn't it more that one should not call sbuf_drain() with an… | |||||
} | } | ||||
#undef msec | #undef msec | ||||
error = sbuf_finish(&sb); | error = sbuf_finish(&sb); | ||||
sbuf_delete(&sb); | sbuf_delete(&sb); | ||||
return(error); | return(error); | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines |
Maybe add a comment why you are doing this dance. It wasn't obvious for us...