2001-04-09 19:41:39

by Srinivasan Venkatraman

[permalink] [raw]
Subject: Question on accessing /proc


Hi,

I am new to this list. I did go through the FAQ before posting this
question. I have a specific requirment - creating,modifying and deleting
data structures inside the kernel values of which will be passed by an
user application. I know we could do this by writing a system call or by
ioctl command to a character device. My question is can we do this by
writing to /proc file system ? Can we actually create, modify and delete
data structures by accessing this file system ?
Any pointers will be appreciated.

Thanks,
Srini.


2001-04-09 19:52:12

by Jeff Garzik

[permalink] [raw]
Subject: Re: Question on accessing /proc

Srinivasan Venkatraman wrote:
> I am new to this list. I did go through the FAQ before posting this
> question. I have a specific requirment - creating,modifying and deleting
> data structures inside the kernel values of which will be passed by an
> user application. I know we could do this by writing a system call or by
> ioctl command to a character device. My question is can we do this by
> writing to /proc file system ? Can we actually create, modify and delete
> data structures by accessing this file system ?

You could definitely use procfs, but it sounds like your example would
be complex. Lately mounting filesystems has become a cheap operation in
Linux. Mount/umount is also a convenient synchronization point. So,
maybe consider implementing your own tiny filesystems - a data
filesystem, where you mmap(2)/read(2)/write(2) data values, and a
control filesystem, where you control the system and manipulate data
values.

That way, you can use standard Unix syscalls, standard Unix tools and
standard Unix permissions to accomplish your domain-specific task.

--
Jeff Garzik | Sam: "Mind if I drive?"
Building 1024 | Max: "Not if you don't mind me clawing at the dash
MandrakeSoft | and shrieking like a cheerleader."