есть вот такая функция, которая вроде как делает чего мне надо
PSTAT FUNCTION
Name
pstat_getfile2() - get information for an open file of a process
Synopsis
#include <sys/pstat.h>
int pstat_getfile2(
struct pst_fileinfo2 *buf,
size_t elemsize,
size_t elemcount,
int index,
pid_t pid
);
Description
pstat_getfile2() returns information specific to a particular open
file for a specified process. For the specified process, there is one
instance of this context for each open file descriptor. For each
instance requested, up to a maximum of elemsize bytes of data is
returned in the pst_fileinfo2 structures pointed to by buf. The
elemcount parameter specifies the number of pst_fileinfo2 structures
that are available at buf to be filled in. The index parameter
specifies the starting index within the context of open files for the
specified process: It is the file descriptor number with which to
begin. The pid parameter specifies the process ID.
Ну и так далее. Этот код как то можно подправить и компильнуть чтобы типа можно было запускать потом с требуемыми параметрами и получать рЭзультат?