Which API will allow me to implement a Linux file system that knows which process is accessing it?

I would like to implement the Linux file system, either using FUSE, or as a kernel module that knows the process that is looking at it so that it can adapt the contents of the file system to the access process.

A specific example of this behavior is found in /proc/self, which is a symbolic link to /proc/PIDwhere PID is the current PID process.

Is there a FUSE or kernel API that will allow me to do this?

The implementation for /proc/selfis here:

https://github.com/torvalds/linux/blob/v4.3/fs/proc/self.c

It uses all kinds of juju core, so maybe FUSE is out of the question.

+4
source share
1 answer

The helpful people on the fuse-devel mailing list pointed me to the answer:

fuse_req_ctx()in fuse_lowlevel.h returns a structure fuse_ctxfor the current request that contains the stream identifier, group identifier, and user identifier.

+4
source

All Articles