New proc entry under /proc/[pid]

Rajat Sharma fs.rajat at gmail.com
Tue Jan 11 01:39:41 EST 2011


Try this:
1. do a path_lookup for parent proc dir e.g. /proc/1234 and get its inode.
2. get proc_inode structure for parent from vfs inode like this:
          sruct proc_inode *parent = PROC_I(inode).
    PROC_I is defined in proc_fs.h
3. get parent proc_dir_entry object:
          struct proc_dir_entry *parent_dir = parent->pde;
4. now you can call:
          create_proc_entry("SOME file", 0644, parent_dir);
5. or you can create a directory if you want:
          proc_mkdir("your dir", parent_dir);

hope this helps.

Rajat

On Tue, Jan 11, 2011 at 12:19 AM, Mauro Romano Trajber
<trajber at gmail.com> wrote:
> I think I found:
> static const struct pid_entry tgid_base_stuff[] at fs/proc/base.c has all
> /proc/[pid] entries.
> But unfortunately it does not use create_proc_entry function, and I'm trying
> to create a new syscall that creates a new proc_entry for the caller
> process.
> Adding a new element in tgid_base_stuff[] makes the things more complicated
> than simply call a create_proc_entry function.
> Is there another way to do it ?
> Mauro Romano Trajber
>
> On Mon, Jan 10, 2011 at 3:18 PM, Mauro Romano Trajber <trajber at gmail.com>
> wrote:
>>
>> How can I create a new proc entry under /proc/[pid] ?
>> I using create_proc_entry("SOME_FILE", 0644, NULL /* here goes the pid
>> proc entry */);
>> Is there any way to get PID directory as a parent proc entry ? How ?
>> Thanks,
>> Mauro
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>



More information about the Kernelnewbies mailing list