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

pr_fcntlinject fcntl system call into victim process

Process Control Library (libproc, -lproc)

#include <libproc.h>

int
pr_fcntl(struct ps_prochandle *P, int fd, int cmd, void *argp0, void *argp1);

The () function injects the fcntl(2) system call into the target process P by means of the agent LWP. If the process handle P is NULL then this is equivalent to calling fcntl(2) on the currently running process.

The arguments fd and cmd have the same meaning as in fcntl(2). The value of cmd determines how many arguments are passed. A command that takes no arguments, like F_GETFD, should pass both argp0 and argp1 as NULL. A command that takes integer arguments, like F_SETFL or F_DUP3FD, should cast the integer arguments to a void * and pass unused arguments as NULL. See fcntl(2) for the full description and purpose of the system call and its arguments.

The () function only works on active processes. Process handles that correspond to core files, zombie processes, or ELF objects do not support system call injection.

Upon successful completion, the pr_fcntl() function's return value is that described in fcntl(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 fcntl(2).

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

fcntl(2), libproc(3LIB), proc(5)

July 30, 2024 OmniOS