netstat_get_info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I took the below lines from the file linux/net/ipv4/proc.c
inside the function 
int netstat_get_info(char *buffer, char **start, off_t offset, int length);

those lines are

	for (i=0; i<offsetof(struct linux_mib, __pad)/sizeof(unsigned long); i++)
		len += sprintf(buffer+len, " %lu", fold_field((unsigned 
long*)net_statistics, sizeof(struct linux_mib), i));

	len += sprintf (buffer + len, "\n");


can any of u please explain me what exactly happens in those three lines.

I somehow understood that this function is used to collect values to populate 
the /proc/net/netstat file.
what i exactly want to know is, whether the values 
are cpu specific or not 
like 
SyncookiesSent for cpu0
SyncookiesSent for cpu1 etc

because i found that net_statistics is an array of struc linux_mib declared as
struct linux_mib net_statistics[NR_CPUS*2]; 
in linux/net/ipv4/af_inet.c

where as NR_CPUS is a macro defined as 1 for non smp machines and 32 for smp 
machines.

why net_statistics is declared as an array of NR_CPUS*2

What exactly the file structure of /proc/net/netstat is

is it

TcpExt: SyncookiesSent SyncookiesRecv SyncookiesFail........
TcpExt: 0 0 0 0 0 0 0 0 0 11 0 0 0 0 0 24 0 0 0 0 4 0 235........

		<or>

TcpExt: SyncookiesSent SyncookiesRecv SyncookiesFail.....
TcpExt: 0 0 0 0 0 0 0 0 0 11 0 0 0 0 0 24 0 0 0 0 4 0 235......<for cpu0>
TcpExt: 0 0 0 0 0 0 0 0 0 11 0 0 0 0 0 24 0 0 0 0 4 0 235......<for cpu1>


thanks and regards,
mohan.
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux