Re: [PATCH] add file position info to proc

2007-03-10 Thread Chris Wedgwood
On Sat, Mar 10, 2007 at 03:02:22PM +0100, Jan Engelhardt wrote:

 http://www.mail-archive.com/linux-fsdevel@vger.kernel.org/msg03964.html

to make 'lsof -o' work/happy?  is that really worth it?  we've managed
without it for years...  i'n not entirely against the concept, i just
work that we too easily add things to /proc and hence it's the mess it
is now

-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] add file position info to proc

2007-03-10 Thread Jan Engelhardt

On Sat, Mar 10, 2007 at 03:02:22PM +0100, Jan Engelhardt wrote:

 http://www.mail-archive.com/linux-fsdevel@vger.kernel.org/msg03964.html

to make 'lsof -o' work/happy?

To make the user happy. lsof is another thing.


Jan
-- 
-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] add file position info to proc

2007-03-10 Thread Miklos Szeredi
 On Sat, Mar 10, 2007 at 03:02:22PM +0100, Jan Engelhardt wrote:
 
  http://www.mail-archive.com/linux-fsdevel@vger.kernel.org/msg03964.html
 
 to make 'lsof -o' work/happy?
 
 To make the user happy. lsof is another thing.

Yeah, I occasionally come across requests for this feature, and needed
it myself a few times as well.  It's definitely not essential, but it
could be useful.

Miklos
-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] add file position info to proc

2007-03-09 Thread Dave Kleikamp
On Fri, 2007-03-09 at 14:54 +0100, Miklos Szeredi wrote:
 Comments are welcome.
 
 
 This patch adds support for finding out the current file position,
 open flags and possibly other info in the future.
 
 These new entries are added:
 
   /proc/PID/fdinfo/FD
   /proc/PID/task/TID/fdinfo/FD
 
 For each fd the information is provided in the following format:
 
 pos:  1234
 flags:012

I think this information would be a little easier to access if there
would be a single file per pid or thread containing something like:

handle  flags   pos path
0   012 1234/dev/pts/1
1   014 5678/tmp/output
etc.

-- 
David Kleikamp
IBM Linux Technology Center

-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] add file position info to proc

2007-03-09 Thread Jörn Engel
On Fri, 9 March 2007 14:54:38 +0100, Miklos Szeredi wrote:
 
 pos:  1234
 flags:012

Why are the flags in octal?

Jörn

-- 
Happiness isn't having what you want, it's wanting what you have.
-- unknown
-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] add file position info to proc

2007-03-09 Thread Benjamin LaHaise
On Fri, Mar 09, 2007 at 09:15:06AM -0600, Dave Kleikamp wrote:
 I think this information would be a little easier to access if there
 would be a single file per pid or thread containing something like:
 
 handleflags   pos path
 0 012 1234/dev/pts/1
 1 014 5678/tmp/output
 etc.

That would not be a good idea, as not all users have the same permissions 
for viewing this information.  It's also quite against the design philosophy 
used elsewhere in /proc.

-ben
-- 
Time is of no importance, Mr. President, only life is important.
Don't Email: [EMAIL PROTECTED].
-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] add file position info to proc

2007-03-09 Thread Dave Kleikamp
On Fri, 2007-03-09 at 10:23 -0500, Benjamin LaHaise wrote:
 On Fri, Mar 09, 2007 at 09:15:06AM -0600, Dave Kleikamp wrote:
  I think this information would be a little easier to access if there
  would be a single file per pid or thread containing something like:
  
  handle  flags   pos path
  0   012 1234/dev/pts/1
  1   014 5678/tmp/output
  etc.
 
 That would not be a good idea, as not all users have the same permissions 
 for viewing this information.

How will this have different permission issues than Miklos' patch?

 It's also quite against the design philosophy 
 used elsewhere in /proc.

What's so different between this and /proc/pid/maps
or /proc/pid/mounts?

-- 
David Kleikamp
IBM Linux Technology Center

-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] add file position info to proc

2007-03-09 Thread Miklos Szeredi
  
  pos:1234
  flags:  012
 
 Why are the flags in octal?

File mode bits are represented in octal in both asm-generic/fcntl.h
and bits/fcntl.h, so this is the least human unreadable format.

Miklos
-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] add file position info to proc

2007-03-09 Thread Miklos Szeredi
   
   pos:  1234
   flags:012
  
  Why are the flags in octal?
 
 File mode bits are represented in octal in both asm-generic/fcntl.h

s/mode/flag/
-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] add file position info to proc

2007-03-09 Thread Miklos Szeredi
 On Fri, 2007-03-09 at 10:23 -0500, Benjamin LaHaise wrote:
  On Fri, Mar 09, 2007 at 09:15:06AM -0600, Dave Kleikamp wrote:
   I think this information would be a little easier to access if there
   would be a single file per pid or thread containing something like:
   
   handleflags   pos path
   0 012 1234/dev/pts/1
   1 014 5678/tmp/output
   etc.
  
  That would not be a good idea, as not all users have the same permissions 
  for viewing this information.
 
 How will this have different permission issues than Miklos' patch?
 
  It's also quite against the design philosophy 
  used elsewhere in /proc.
 
 What's so different between this and /proc/pid/maps
 or /proc/pid/mounts?

I think the problem is not with permissions, but with scaling to large
numbers of file descriptors.

The user is usually interested in a single file descriptor, so it
would be a large waste of resources to put together all this info at
the kernel end, just to let the user parse it all and select the
single line in which s/he is interested in.

Miklos
-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] add file position info to proc

2007-03-09 Thread Jan Engelhardt
Hello,


first of all, big thanks to Miklos for rebasing the patch to a
newer kernel. :-)

On Mar 9 2007 17:00, Miklos Szeredi wrote:
 I think this information would be a little easier to access if there
 would be a single file per pid or thread containing something like:
 
 handle flags   pos path
 0  012 1234/dev/pts/1
 1  014 5678/tmp/output
 etc.
 
 That would not be a good idea, as not all users have the same permissions
 for viewing this information.

Since /proc/$$/fd is S_IRWXU, only the user owning the process (plus
usually root) can view it. So making the single file you propose S_IRWXU
too should solve any security issue, should not it?

I think the problem is not with permissions, but with scaling to large
numbers of file descriptors.

Would not that be dealt accordingly with seq_file? (You do not seem to use
a seq_file in your patch.)

The user is usually interested in a single file descriptor, so it
would be a large waste of resources to put together all this info at
the kernel end, just to let the user parse it all and select the
single line in which s/he is interested in.

And in case s/he is interested in all fds, one could just run

grep ^offset: /proc/$$/fdpos/*

and get a neat view.


Jan
-- 
-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] add file position info to proc

2007-03-09 Thread Miklos Szeredi
  I think this information would be a little easier to access if there
  would be a single file per pid or thread containing something like:
  
  handle   flags   pos path
  0012 1234/dev/pts/1
  1014 5678/tmp/output
  etc.
  
  That would not be a good idea, as not all users have the same permissions
  for viewing this information.
 
 Since /proc/$$/fd is S_IRWXU, only the user owning the process (plus
 usually root) can view it. So making the single file you propose S_IRWXU
 too should solve any security issue, should not it?
 
 I think the problem is not with permissions, but with scaling to large
 numbers of file descriptors.
 
 Would not that be dealt accordingly with seq_file?

Yes, most likely it wouldn't be so bad either. But it _would_ be:

 a) more complex, this implementation reuses most of the  the /proc/fd code
 b) less efficient for querying a single fd

So I prefer the current solution, but not very strongly.

Miklos
-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] add file position info to proc

2007-03-09 Thread Dave Kleikamp
On Fri, 2007-03-09 at 22:03 +0100, Miklos Szeredi wrote:
   I think this information would be a little easier to access if there
   would be a single file per pid or thread containing something like:
   
   handle flags   pos path
   0  012 1234/dev/pts/1
   1  014 5678/tmp/output
   etc.
   
   That would not be a good idea, as not all users have the same 
   permissions
   for viewing this information.
  
  Since /proc/$$/fd is S_IRWXU, only the user owning the process (plus
  usually root) can view it. So making the single file you propose S_IRWXU
  too should solve any security issue, should not it?
  
  I think the problem is not with permissions, but with scaling to large
  numbers of file descriptors.
  
  Would not that be dealt accordingly with seq_file?
 
 Yes, most likely it wouldn't be so bad either. But it _would_ be:
 
  a) more complex, this implementation reuses most of the  the /proc/fd code
  b) less efficient for querying a single fd
 
 So I prefer the current solution, but not very strongly.

I don't have a real strong opinion, but I wanted to throw that out as a
suggestion.  You're the one writing the code.

Thanks,
Shaggy
-- 
David Kleikamp
IBM Linux Technology Center

-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] add file position info to proc

2007-03-09 Thread Chris Wedgwood
On Fri, Mar 09, 2007 at 02:54:38PM +0100, Miklos Szeredi wrote:

 This patch adds support for finding out the current file position,
 open flags and possibly other info in the future.

who needs this?  /proc/ is an ugly beast at the best of times, is this
really needed?
-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html