From: DervishD <raul@pleyades.net>
To: mra@pobox.com, linux-kernel@vger.kernel.org
Subject: Re: How can a process easily get a list of all it's open fd?
Date: Wed, 28 Aug 2002 01:21:45 +0200 [thread overview]
Message-ID: <3D6C0989.mail6E21O4HV@pleyades.net> (raw)
In-Reply-To: <m38z2s1fkj.fsf@khem.blackfedora.com>
Hi Mark :)
>So what's the "right way" to do it?
AFAIK, the for loop, with getdtablesize() instead of 'OPEN_MAX'.
I do it that way, but I don't really know if it is the 'right way'(tm).
>I would *love* for there to be an ioctl or some syscall that I could
>pass a pointer to an int and a pointer to an int array, and it would
>come back telling me how many open fd's I've got, and fill in the
>array with those fd's.
The array should be allocated by the kernel, or the syscall won't
work as expected ;) If you have 2000 fd open and the array whose
address you pass to the ioctl has an smaller size... Anyway, you can
call the ioctl a few times ;)
Your proposal seems reasonable (unless there is any other way of
doing this portably), but portability will be an issue...
Raúl
next prev parent reply other threads:[~2002-08-27 23:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-26 20:06 [PATCH] make raid5 checksums preempt-safe Robert Love
2002-08-26 21:09 ` Thunder from the hill
2002-08-26 21:15 ` Robert Love
2002-08-27 1:38 ` Horst von Brand
2002-08-27 15:25 ` Thunder from the hill
2002-08-27 15:34 ` How can a process easily get a list of all it's open fd? Mark Atwood
2002-08-27 16:08 ` Alex Riesen
2002-08-27 21:26 ` Mike Touloumtzis
2002-08-28 8:28 ` Alex Riesen
2002-08-27 23:21 ` DervishD [this message]
2002-08-26 22:33 ` [PATCH] make raid5 checksums preempt-safe Brian Gerst
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3D6C0989.mail6E21O4HV@pleyades.net \
--to=raul@pleyades.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mra@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).