0

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

2 Answers2

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
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