On Thu, Oct 22, 2009 at 10:30 AM, Corentin Chary
> On Thu, Oct 22, 2009 at 10:15 AM, Sven Utcke
> <utcke+fuse@...> wrote:
>> Hello Corentin,
>>> currently ctx->pid is current->pid .
>>> On linux, if you do a getpid(), current->tgid is returned and gettid()
>>> returns the current->pid.
>>> I need to get the tgid, is there I way to do that with fuse ?
>> Hmm, not sure if I understand you correctly, but would something along
>> the lines of:
>> #include <sys/types.h> /* gettid() */
>> #include <linux/unistd.h> /* gettid() */
>> long int tid = (long int) syscall(__NR_gettid);
>> do what you want?
> gettid() returns current->pid (Thread ID)
> getpid() returns current->tgid (Process ID, Thread Group ID)
> In fuse/kernel/dev.c, the ctx->pid is set to current->pid (Thread ID)
> What I need it the Process ID (or *t*hread *g*roup *id*), but it seems
> there is no way to get it.
> I'm sure sure if ctx->pid being current->pid is a bug or a feature,
> but reading fuse.h comments it seems to be a feature.
> I think tgid should also be available in the ctx.
Any comment on that ?
If it's a bug, I can make a patch to fix that. If it's a feature,
would you accept a patch adding a tgid field in fuse_context ?