procfs

How can i match each /proc/net/tcp entry to each opened socket?

血红的双手。 提交于 2019-11-27 13:17:11
I'm trying to parse socket info from /proc/net/tcp and while I can identify some fields, such as memory addresses or send queue use, I can't find how each entry is bound to its socket descriptor. e.g., with this data: 1: 5922140A:E459 D5C43B45:0050 01 00000000:00000000 00:00000000 00000000 1000 0 507218 1 f6ab1300 57 3 12 4 -1 I want to know which is the correspondant socket descriptor. Take the inode number (in this case, 507218). Each open file descriptor to that socket (there may be multiple file descriptors for the same socket) will appear as a link of the form: /proc/<PID>/fd/<N> ->

List of possible internal socket statuses from /proc

半腔热情 提交于 2019-11-27 11:14:16
问题 I would like to know the possible values of st column in /proc/net/tcp . I think the st column equates to STATE column from netstat(8) or ss(8) . I have managed to identify three codes: sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode 0: 0100007F:08A0 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 7321 1 ffff81002f449980 3000 0 0 2 -1 1: 00000000:006F 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 6656 1 ffff81003a30c080 3000 0

dmesg is not showing printk statement

只愿长相守 提交于 2019-11-27 05:57:22
问题 I'm trying to create a proc entry. My init_module function is as below int init_module() { printk(KERN_INFO "proc2:Module Loaded\n"); proc_entry=proc_create_data(proc_name,0644,NULL,&fops,NULL); if(proc_entry==NULL) { printk(KERN_INFO "proc2:Error registering proc entry"); } else { printk(KERN_INFO "proc2:Proc Entry Created"); } return 0; } following is cleanup method void cleanup_module() { printk(KERN_INFO "proc2:module unloaded"); remove_proc_entry(proc_name,proc_entry); } rest of program

How can i match each /proc/net/tcp entry to each opened socket?

喜欢而已 提交于 2019-11-26 16:16:26
问题 I'm trying to parse socket info from /proc/net/tcp and while I can identify some fields, such as memory addresses or send queue use, I can't find how each entry is bound to its socket descriptor. e.g., with this data: 1: 5922140A:E459 D5C43B45:0050 01 00000000:00000000 00:00000000 00000000 1000 0 507218 1 f6ab1300 57 3 12 4 -1 I want to know which is the correspondant socket descriptor. 回答1: Take the inode number (in this case, 507218). Each open file descriptor to that socket (there may be

How to know linux scheduler time slice?

一曲冷凌霜 提交于 2019-11-26 02:34:50
问题 I\'m looking for the value of the time slice (or quantum) of my Linux kernel. Specific Questions: Is there a /proc file which expose such an information ? (Or) Is it well-defined in the Linux header of my distributions ? (Or) Is there a C function of the Linux API (maybe sysinfo) that expose this value ? 回答1: The quantum allocated for a particular process may vary: You can tune "slice" by adjusting sched_latency_ns and sched_min_granularity_ns , but note that "slice" is not a fixed quantum.