[PATCH] Use kinfo_getfile to implement fdwalk on FreeBSD.
Tom Tromey
tom@tromey.com
Fri Nov 30 22:15:00 GMT 2018
>>>>> "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
More information about the Gdb-patches
mailing list