tgid from ctx

View: New views
6 Messages — Rating Filter:   Alert me  

tgid from ctx

by Corentin Chary-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
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 ? Would a
patch adding tgid to context be accepted ?
Thanks,

--
Corentin Chary
http://xf.iksaif.net

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
fuse-devel mailing list
fuse-devel@...
https://lists.sourceforge.net/lists/listinfo/fuse-devel

Re: tgid from ctx

by Sven Utcke-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?

Sven
--
    _  ___  ___  ___
 __| |/ __|| __|/ __|                             The dCache File System
/ _` | (__ | _| \__ \              An archive file-system for PB of data
\__,_|\___||_|  |___/                    http://www.desy.de/~utcke/Data/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
fuse-devel mailing list
fuse-devel@...
https://lists.sourceforge.net/lists/listinfo/fuse-devel

Re: tgid from ctx

by Corentin Chary-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?
>
> Sven

Nop,
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.

--
Corentin Chary
http://xf.iksaif.net

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
fuse-devel mailing list
fuse-devel@...
https://lists.sourceforge.net/lists/listinfo/fuse-devel

Re: tgid from ctx

by Corentin Chary-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Oct 22, 2009 at 10:30 AM, Corentin Chary
<corentin.chary@...> wrote:

> 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?
>>
>> Sven
>
> Nop,
> 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.

Hi Mklos,
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 ?
Thanks


--
Corentin Chary
http://xf.iksaif.net

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
fuse-devel mailing list
fuse-devel@...
https://lists.sourceforge.net/lists/listinfo/fuse-devel

Re: tgid from ctx

by Miklos Szeredi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 22 Oct 2009, Corentin Chary wrote:
> > 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.
>
> Hi Mklos,
> 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 ?

It's a feature.  Why do you need the tgid?

One way I know you can get the tgid from the pid is something along
these lines:

  grep "^Tgid:" /proc/$PID/task/$PID/status

Thanks,
Miklos

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
fuse-devel mailing list
fuse-devel@...
https://lists.sourceforge.net/lists/listinfo/fuse-devel

Re: tgid from ctx

by Corentin Chary-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Nov 5, 2009 at 2:09 PM, Miklos Szeredi <miklos@...> wrote:

> On Thu, 22 Oct 2009, Corentin Chary wrote:
>> > 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.
>>
>> Hi Mklos,
>> 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 ?
>
> It's a feature.  Why do you need the tgid?
>
> One way I know you can get the tgid from the pid is something along
> these lines:
>
>  grep "^Tgid:" /proc/$PID/task/$PID/status
>
> Thanks,
> Miklos
>

In GlusterFS the tgid is used for some performance features.
It was previously also used for locks, but there are patch to use
lock_owner instead.


--
Corentin Chary
http://xf.iksaif.net

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
fuse-devel mailing list
fuse-devel@...
https://lists.sourceforge.net/lists/listinfo/fuse-devel