PR_STAT(3PROC) Process Control Library Functions PR_STAT(3PROC)

NAME


pr_fstat, pr_fstat64, pr_lstat, pr_lstat64, pr_stat, pr_stat64 - inject
stat system call into victim process

LIBRARY


Process Control Library (libproc, -lproc)

SYNOPSIS


#include <libproc.h>

int
pr_fstat(struct ps_prochandle *P, int fd, struct stat *buf);

int
pr_fstat64(struct ps_prochandle *P, int fd, struct stat64 *buf);

int
pr_lstat(struct ps_prochandle *P, const char *path, struct stat *buf);

int
pr_lstat64(struct ps_prochandle *P, const char *path, struct stat64 *buf);

int
pr_stat(struct ps_prochandle *P, const char *path, struct stat *buf);

int
pr_stat64(struct ps_prochandle *P, const char *path, struct stat64 *buf);

DESCRIPTION


The pr_stat(), pr_lstat(), and pr_fast() functions inject the stat(2),
lstat(2), and fstat(2) system calls respectively into the target process P
by means of the agent LWP. If the process handle P is the value NULL then
this will be equivalent to calling stat(2), lstat(2), or fstat(2) on the
currently running process.

The arguments path, and buf to the pr_stat() function have the same meaning
as in stat(2). See stat(2) for the full description and purpose of the
stat system call and its arguments.

The arguments fd, and buf to the pr_fstat() function have the same meaning
as in fstat(2), see fstat(2) for the full description and purpose of the
fstat system call and its arguments.

The arguments path, and buf to the pr_lstat() function have the same
meaning as in lstat(2), see lstat(2) for the full description and purpose
of the lstat system call and its arguments.

The pr_stat(), pr_lstat(), and pr_fstat() functions only work on active
processes. Process handles that correspond to core files, zombie
processes, or ELF objects do not support system call injection.

The pr_stat64(), pr_fstat64(), and pr_lstat64() functions are equivalent to
pr_stat(), pr_fstat(), and pr_lstat() respectively; however, rather than
having the stat information be subject to the data model of the target
process, they always provide 64-bit stat information. See lf64(7) for more
information.

RETURN VALUES


Upon successful completion, the pr_stat() function's return value is that
described in stat(2). Otherwise, -1 is returned and errno is set to ENOSYS
to indicate that the system call could not be injected.

ERRORS


For the full list of errors see the ERRORS section in stat(2).

The pr_stat() function will fail if:

ENOSYS An error occurred while trying to invoke the agent LWP
and inject a system call in the process handle P or the
process handle P does not support system call injection.

INTERFACE STABILITY


Uncommitted

MT-LEVEL
See LOCKING in libproc(3LIB).

SEE ALSO


stat(2), libproc(3LIB), proc(5), lf64(7)

illumos November 27, 2023 illumos