Go to main content

man pages section 3: Extended Library Functions, Volume 3

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

Psync (3PROC)

Name

Psignal, Pfault, Psysentry, Psysexit, Psetsignal, Psetfault, Psetsysentry, Psetsysexit, Psetflags, Punsetflags, Psync - set or unset /proc tracing flags

Synopsis

#include <libproc.h>
#include <sys/signal.h>
#include <sys/fault.h>
#include <sys/syscall.h>
int Psignal(ps_prochandle_t *Pr, int sig, int stop);
int Pfault(ps_prochandle_t *Pr, int flt, int stop);
int Psysentry(ps_prochandle_t *Pr, int scall, int stop);
int Psysexit(ps_prochandle_t *Pr, int scall, int stop);
void Psetsignal(ps_prochandle_t *Pr, const sigset_t *set);
void Psetfault(ps_prochandle_t *Pr, const fltset_t *set);
void Psetsysentry(ps_prochandle_t *Pr, const sysset_t *set);
void Psetsysexit(ps_prochandle_t *Pr, const sysset_t *set);
int Psetflags(ps_prochandle_t *Pr, int flags);
int Punsetflags(ps_prochandle_t *Pr, int flags);
void Psync(ps_prochandle_t *Pr);

Description

The /proc interface provide sets of tracing flags for the interception of receipt of signals, occurrence of machine faults, and entry to and exit from individual system call traps. For more information about enumerations of possible signals, machine faults, and system call traps, see the header files <sys/signal.h>, <sys/fault.h>, and <sys/syscall.h> respectively. For more information, see the proc(5) man page.

The Pr argument identifies a live victim process attached to the controlling process by the create and grab interfaces. For more information, see the Pcreate(3PROC) and Pgrab(3PROC) man pages.

The Psignal() function sets or unsets the stop-on-signal flag in the victim process for the signal sig. If stop is non-zero or true, receipt of signal sig will cause the process to stop. If the stop argument is 0 or false, the process will not stop on receipt of that signal.

The Pfault() function sets or unsets the stop-on-fault flag in the victim process for machine fault, flt. If the stop argument is not zero or true, an occurrence of machine fault, flt will cause the process to stop. If the stop argument is 0 or false, the process will not stop on an occurrence of that machine fault.

The Psysentry() function sets or unsets the stop-on-syscall-entry flag in the victim process for system call trap scall. If the stop argument is non-zero or true, the victim process will stop on entry to the system call trap, scall. If the stop argument is 0 or false, the process will not stop on entry to the system call trap, scall.

The Psysexit() function sets or unsets the stop-on-syscall-exit flag in the victim process for system call trap scall. If the stop argument is non-zero or true, the victim process will stop on exit from the system call trap, scall. If the stop argument is 0 or false, the process will not stop on exit from the system call trap, scall.

The Psetsignal() function installs the full set of stop-on-signal flags in the victim process.

The Psetfault() function installs the full set of stop-on-fault flags in the victim process.

The Psetsysentry() function installs the full set of stop-on-syscall-entry flags in the victim process.

The Psetsysexit() function installs the full set of stop-on-syscall-exit flags in the victim process.

The Psetflags() function sets the behavioral /proc flags specified by the flags argument in the victim process. The Punsetflags() function removes the flags specified by the flags argument from the victim process. The flags argument is constructed by a bitwise-inclusive-OR of flags in the following set:

PR_FORK

inherit-on-fork

PR_RLC

run-on-last-close

PR_KLC

kill-on-last-close

PR_ASYNC

asynchronous-stop

PR_BPTADJ

breakpoint trap pc adjustment (x86)

The Psync() function ensures that all cached state is written to the victim process. The cached state is the signal mask of the current lwp and registers and the tracing flags of the process. For performance reasons, the library will cache actions that sets these things as long as the process is stopped. They are applied when the process is set running with the Psetrun() function. So, calls to the Psync() function are rarely needed.

Return Values

On successful completion, the Psignal(), Pfault(), Psysentry(), and Psysexit() functions return 1 or true if the stop-on-signal, stop-on-fault, or stop-on-syscall flag was previously set in the victim process, else, 0 or false is set. On error, they return -1 and set errno to indicate the error. On successful completion, the Psetflags() and Punsetflags() functions return 0. On error, they return -1 and set errno to indicate the error.

There are no return values from the Psetsignal(), Psetfault(), Psetsysentry(), Psetsysexit(), and Psync() functions.

Errors

On failure, these errno values may be set:

EINVAL

Invalid argument

ENOENT

The victim process is terminated

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
Unsafe

See Also

libproc.h(3HEAD), libproc(3LIB), Pcreate(3PROC), Pgrab(3PROC), proc(5)