Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] procfs pseudo-file without a module load?



Hi TLUG'ers. Long time no see. Things go well at MongoDB @ Sydney. I'll be back in Tokyo for a short visit in Sep too.

I have some discretionary time at the office for the next few days to hack whatever I like. I had an idea to add a procfs entry underneath the /proc/<pid> directory for my program.

E.g. 

~]$ nohup my_prog > /tmp/my_prog.log 2>&1 
[1] 2876
~]$ ls /proc/2876
total 0
dr-xr-xr-x  2 akira akira 0 Jul 20 10:40 attr
-rw-r--r--  1 akira akira 0 Jul 20 10:40 autogroup
...
...
-r--r--r--  1 akira akira 0 Jul 20 10:40 statm
-r--r--r--  1 akira akira 0 Jul 20 09:47 status
-r--------  1 akira akira 0 Jul 20 10:40 syscall
dr-xr-xr-x 35 akira akira 0 Jul 20 09:49 task
-r--r--r--  1 akira akira 0 Jul 20 10:40 wchan

I want to add my own entry in here, only under the /proc/<pid> directory of my program's process. E.g. a "merged_conf" pseudo-file which will reflect the config settings in effect.

~]$ cat /proc/2876/merged_conf
threads: 8
bind_ports: 3401 3402
~]$ 

I can make this, but the way I've learnt takes the whole linux module building environment. And I don't feel I can add that prerequisite for others building the same project.

If anyone knows of an open source project that can use the procfs API without needing module loading could you please let me know? Or alternatively point me to an another project that did with kernel module loading- it could be effective enough proof that it's unavoidable.

Regards,

Akira

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links