how to mention the path in third argument of create_proc_entry() function. Till now i keep NULL over there, it is working fine but i want to keep under /proc/net/ directory for that i need to mention something over third argument.Let me give the instructions to do so
Asked
Active
Viewed 937 times
0
-
This question already has been answered, but the answers were not proper. please specify if have any suggestions. tq U – Vishnu Pajjuri Sep 23 '13 at 10:58
2 Answers
0
struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, struct proc_dir_entry *parent);
proc_entry = create_proc_entry("megharaj_proc", 0666, path/NULL);

Megharaj
- 1,589
- 2
- 20
- 32
-
-
proc_entry = create_proc_entry("megharaj_proc", 0666, NULL); if NULL is used will be present in the home folder /proc. If you want it to be inside any folder of the proc use /proc/folder_name instead of NULL – Megharaj Sep 19 '13 at 10:47
-
but that is not a char * type. it is type of struct proc_dir_entry *parent then how can we pass path – Vishnu Pajjuri Sep 19 '13 at 12:43
-
-
I have seen the struct proc_dir_entry in proc_fs.h file. But i didn't get any way to pass path. mention the code if you have any idea – Vishnu Pajjuri Sep 19 '13 at 13:37
0
The third parameter is a pointer to the "parent", not a path. You can simply create a directory under /proc by calling:
proc_dir_entry *parent = NULL;
parent = proc_mkdir("your_parent_name",NULL);
Then use that pointer as your parent when creating your desired proc entry that will appear under /proc/your_parent_name/my_proc as follows:
proc_dir_entry *my_proc = NULL
my_proc = create_proc_entry("my_proc", 0666, parent);

Bob
- 31
- 2
-
I don't want to create new directory. I want to keep an entry under already existed directory e.g like /proc/net/myEntry. I tried with proc_mkdir(), it created a new directory, i lost my old entry too – Vishnu Pajjuri Sep 20 '13 at 05:13