This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Use kinfo_getfile to implement fdwalk on FreeBSD.
- From: Tom Tromey <tom at tromey dot com>
- To: John Baldwin <jhb at FreeBSD dot org>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 30 Nov 2018 15:15:16 -0700
- Subject: Re: [PATCH] Use kinfo_getfile to implement fdwalk on FreeBSD.
- References: <20181130212331.59989-1-jhb@FreeBSD.org>
>>>>> "John" == John Baldwin <jhb@FreeBSD.org> writes:
John> kinfo_getfile() requires a couple of system calls to fetch the list of
John> open file descriptors. This can be much cheaper than invoking fstat
John> on all of the values from 0 to the open file resource limit maximum.
John> gdb/ChangeLog:
John> * common/filestuff.c [HAVE_KINFO_GETFILE]: Include headers.
John> (fdwalk) [HAVE_KINFO_GETFILE]: Use kinfo_getfile.
Thanks.
John> +#ifdef HAVE_KINFO_GETFILE
John> + gdb::unique_xmalloc_ptr<struct kinfo_file> fdtbl;
John> + int nfd;
John> + fdtbl.reset (kinfo_getfile (getpid (), &nfd));
I think this should be combined with the declaration; no need to call
reset.
This is ok with that change.
Tom