/* * Report socket allocation statistics [[email protected]] */ int afinet_get_info(char *buffer, char **start, off_t offset, int length) { /* From net/socket.c */ extern int socket_get_info(char *, char **, off_t, int); int len = socket_get_info(buffer,start,offset,length); len += sprintf(buffer+len,"TCP: inuse %d orphan %d tw %d alloc %d mem %d\n", fold_prot_inuse(&tcp_prot), atomic_read(&tcp_orphan_count), tcp_tw_count, atomic_read(&tcp_sockets_allocated), atomic_read(&tcp_memory_allocated)); len += sprintf(buffer+len,"UDP: inuse %d\n", fold_prot_inuse(&udp_prot)); len += sprintf(buffer+len,"RAW: inuse %d\n", fold_prot_inuse(&raw_prot)); len += sprintf(buffer+len, "FRAG: inuse %d memory %d\n", ip_frag_nqueues, atomic_read(&ip_frag_mem)); if (offset >= len) { *start = buffer; return 0; } *start = buffer + offset; len -= offset; if (len > length) len = length; if (len < 0) len = 0; return len; }
/* * Report socket allocation statistics [[email protected]] */ static int sockstat_seq_show(struct seq_file *seq, void *v) { socket_seq_show(seq); seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %d\n", fold_prot_inuse(&tcp_prot), atomic_read(&tcp_orphan_count), tcp_death_row.tw_count, atomic_read(&tcp_sockets_allocated), atomic_read(&tcp_memory_allocated)); seq_printf(seq, "UDP: inuse %d\n", fold_prot_inuse(&udp_prot)); seq_printf(seq, "RAW: inuse %d\n", fold_prot_inuse(&raw_prot)); seq_printf(seq, "FRAG: inuse %d memory %d\n", ip_frag_nqueues, atomic_read(&ip_frag_mem)); return 0; }
static int sockstat6_seq_show(struct seq_file *seq, void *v) { seq_printf(seq, "TCP6: inuse %d\n", fold_prot_inuse(&tcpv6_prot)); seq_printf(seq, "UDP6: inuse %d\n", fold_prot_inuse(&udpv6_prot)); seq_printf(seq, "UDPLITE6: inuse %d\n", fold_prot_inuse(&udplitev6_prot)); seq_printf(seq, "RAW6: inuse %d\n", fold_prot_inuse(&rawv6_prot)); seq_printf(seq, "FRAG6: inuse %d memory %d\n", ip6_frag_nqueues, atomic_read(&ip6_frag_mem)); return 0; }
int afinet6_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0; len += sprintf(buffer+len, "TCP6: inuse %d\n", fold_prot_inuse(&tcpv6_prot)); len += sprintf(buffer+len, "UDP6: inuse %d\n", fold_prot_inuse(&udpv6_prot)); len += sprintf(buffer+len, "RAW6: inuse %d\n", fold_prot_inuse(&rawv6_prot)); len += sprintf(buffer+len, "FRAG6: inuse %d memory %d\n", ip6_frag_nqueues, atomic_read(&ip6_frag_mem)); *start = buffer + offset; len -= offset; if(len > length) len = length; return len; }