network register on /proc fs

Peter Teoh htmldeveloper at gmail.com
Sun Dec 15 20:08:45 EST 2013


doing a "strace ifconfig -a" and you can see the following in your stderr:

open("/proc/net/dev", O_RDONLY)         = 6
open("/proc/net/if_inet6", O_RDONLY)    = 6
open("/proc/net/if_inet6", O_RDONLY)    = 6
open("/proc/net/if_inet6", O_RDONLY)    = 6

and see fd id is 6, you can also see the fd in your /proc/<pid>/fd:

ls -al /proc/<pid>fd for a particular process give:

>ls -al /proc/2187/fd
total 0

lr-x------ 1 xxx xxx 64 Dec 16 07:26 0 -> /dev/null
l-wx------ 1 xxx xxx 64 Dec 16 07:26 1 -> /dev/null
lrwx------ 1 xxx xxx 64 Dec 16 07:26 10 -> anon_inode:[eventfd]
lrwx------ 1 xxx xxx 64 Dec 16 07:26 11 -> /dev/dri/card0

registration of /proc happened when /proc is being initialized and created:

fs/proc/root.c:proc_root_init()

and the function for network is proc_net_init() inside fs/proc/proc_net.c.

On Sat, Dec 7, 2013 at 12:58 PM, Hatt Tom <net.study.sea at gmail.com> wrote:

> hi:
>
>   Does the network relevent register on  /proc fs ? when does it register ?
>
>   which entry of /proc will be used by ifconfig" command ?
>
>
> Thanks!
> --
> Best Regards!
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
Regards,
Peter Teoh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20131216/b36522a8/attachment.html 


More information about the Kernelnewbies mailing list