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

pr_fstat, pr_fstat64, pr_lstat, pr_lstat64, pr_stat, pr_stat64inject stat system call into victim process

Process Control Library (libproc, -lproc)

#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);

The (), pr_lstat(), and () 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 () function have the same meaning as in stat(2). See stat(2) for the full description and purpose of the system call and its arguments.

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

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

The (), 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 (), (), and () 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.

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

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

The pr_stat() function will fail if:

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.

See in libproc(3LIB).

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

November 27, 2023 OmniOS