diff options
Diffstat (limited to 'usr/src/man/man3proc')
144 files changed, 14206 insertions, 72 deletions
diff --git a/usr/src/man/man3proc/Lctlfd.3proc b/usr/src/man/man3proc/Lctlfd.3proc new file mode 100644 index 0000000000..0c1537d871 --- /dev/null +++ b/usr/src/man/man3proc/Lctlfd.3proc @@ -0,0 +1,58 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt LCTLFD 3PROC +.Os +.Sh NAME +.Nm Lctlfd +.Nd obtain the thread control file descriptor +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Lctlfd +.Fa "struct ps_lwphandle *L" +.Fc +.Sh DESCRIPTION +The +.Fn Lctlfd +function returns a file descriptor to the underlying /proc file system +.Sy ctl +file for the thread identified by the handle +.Fa L . +This may be used for injecting control operations manually; however, +many interfaces for using it are provided by +.Xr libproc 3LIB +itself. +.Pp +The file descriptor is invalidated when the thread handle is released +through +.Xr Lfree 3PROC . +The caller +.Em must not +call +.Xr close 2 +on the returned file descriptor. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Lfree 3PROC , +.Xr Lgrab 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Lfree.3proc b/usr/src/man/man3proc/Lfree.3proc new file mode 100644 index 0000000000..fcbb4cf0c0 --- /dev/null +++ b/usr/src/man/man3proc/Lfree.3proc @@ -0,0 +1,53 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt LFREE 3PROC +.Os +.Sh NAME +.Nm Lfree +.Nd free a control handle to a thread +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "void" +.Fo Lfree +.Fa "struct ps_lwphandle *L" +.Fc +.Sh DESCRIPTION +The +.Fn Lfree +function releases all control resources associated with the the handle +.Fa L . +After +.Fn Lfree +, calls to other +.Sy libproc +routines which leverage information from the handle +.Fa L +will no longer work as the handle has been invalidated. +.Pp +The state of the thread controlled by +.Fa L +is not affected by the call to +.Fn Lfree . +The thread's state will not transition from running to stopped or +vice-versa. It will retain its state prior to the call to +.Fn Lfree . +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Lgrab 3PROC diff --git a/usr/src/man/man3proc/Lgrab.3proc b/usr/src/man/man3proc/Lgrab.3proc new file mode 100644 index 0000000000..24ad4a44b5 --- /dev/null +++ b/usr/src/man/man3proc/Lgrab.3proc @@ -0,0 +1,113 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt LGRAB 3PROC +.Os +.Sh NAME +.Nm Lgrab +.Nd obtain a handle to control a thread +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "struct ps_lwphandle *" +.Fo Lgrab +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "int *perr" +.Fc +.Sh DESCRIPTION +The +.Fn Lgrab +function obtains a control handle to the thread identified by +.Fa lwpid +residing under the process +.Fa P . +This handle is then passed as argument to other +.Sy libproc +routines. The +.Fa lwpid +can be obtained from the +.Sy pr_lwpid +member of the +.Sy lwpstatus_t +structure. +.Pp +The +.Fa perr +argument must point to a valid pointer that will be used to store an +error code in the event that +.Fn Lgrab +is unable to successfully obtain a handle to the process. The possible +errors are defined below in the +.Sx ERRORS +section. The code may be transformed into a human readable string +through the use of +.Xr Lgrab_error 3PROC . +.Pp +The handle to the thread is valid until the +.Xr Lfree 3PROC +function is called, which also releases associated resources from the +handle. Only a single handle to a specific thread may exist at any +time. If the handle already exists and another caller attempts to grab +that thread, it will result in an error. The caller must call +.Fn Lfree +before releasing the handle associated with +.Fa P . +.Pp +Unlike grabbing a process, grabbing a thread does not change the current +state of the thread. If it is running, it will remain running. If it is +stopped, it will remain stopped. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Lgrab +function returns a pointer to the control handle for the specified +thread. Otherwise, the +.Dv NULL +pointer is returned and +.Fa perr +is set to indicate the error. +.Sh ERRORS +The +.Fn Lgrab +function will fail if: +.Bl -tag -width Er +.It Er G_BUSY +Another handle already exists for the thread identified by +.Fa lwpid . +The handle need not exist in the current process and may exist in +another process. +.It Er G_NOPROC +The thread identified by +.Fa lwpid +does not exist or has already become a zombie. +.It Er G_STRANGE +An unanticipated system error occurred while trying to create the +handle. When this occurs, then the value of +.Sy errno +is meaningful. See +.Xr errno 3C +for more information and +.Xr Intro 2 +for the list of possible errors. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr errno 3C , +.Xr libproc 3LIB , +.Xr Lfree 3PROC , +.Xr Lgrab_error 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Lgrab_error.3proc b/usr/src/man/man3proc/Lgrab_error.3proc new file mode 100644 index 0000000000..cb544f9398 --- /dev/null +++ b/usr/src/man/man3proc/Lgrab_error.3proc @@ -0,0 +1,49 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt LGRAB_ERROR 3PROC +.Os +.Sh NAME +.Nm Lgrab_error +.Nd get Lgrab error message string +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "const char *" +.Fo Lgrab_error +.Fa "int error" +.Fc +.Sh DESCRIPTION +The +.Fn Lgrab_error +function returns a pointer to a human-readable character string +describing the error that occurred. The +.Fn Lgrab_error +function only knows how to translate error codes that were stored in +the third argument +.Pf ( Fa perr Ns ) +of a call to +.Xr Lgrab 3PROC . +.Sh RETURN VALUES +The +.Fn Lgrab_error +function always returns a pointer to a character string describing the +error that occurred, even if it is an unknown error. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Lgrab 3PROC diff --git a/usr/src/man/man3proc/Lprochandle.3proc b/usr/src/man/man3proc/Lprochandle.3proc new file mode 100644 index 0000000000..7472c74b9c --- /dev/null +++ b/usr/src/man/man3proc/Lprochandle.3proc @@ -0,0 +1,54 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt LPROCHANDLE 3PROC +.Os +.Sh NAME +.Nm Lprochandle +.Nd get process control handle from thread control handle +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "struct ps_prochandle *" +.Fo Lprochandle +.Fa "struct ps_lwphandle *L" +.Fc +.Sh DESCRIPTION +The +.Fn Lprochandle +function returns the process handle to which the thread handle +.Fa L +belongs. This proccess handle may be used with other +.Xr libproc 3PROC +functions just as if +.Xr Pgrab 3PROC was called. The returned handle is valid even if +.Xr Lfree 3PROC +is called on +.Fa L . +.Sh RETURN VALUES +Upon successful completion, the +.Fn Lprochandle +function returns a pointer to process handle. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Lfree 3PROC , +.Xr Pgrab 3PROC , +.Xr Prelease 3PROC diff --git a/usr/src/man/man3proc/Lpsinfo.3proc b/usr/src/man/man3proc/Lpsinfo.3proc new file mode 100644 index 0000000000..d9ff12afb1 --- /dev/null +++ b/usr/src/man/man3proc/Lpsinfo.3proc @@ -0,0 +1,56 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt LPSINFO 3PROC +.Os +.Sh NAME +.Nm Lpsinfo +.Nd get process ps information +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "const lwpsinfo_t *" +.Fo Lpsinfo +.Fa "struct ps_lwphandle *L" +.Fc +.Sh DESCRIPTION +The +.Fn Lpsinfo +function returns the thread handle +.Fa L Ns 's +.Xr ps 1 +information. The +.Sy lwpsinfo_t +structure that is returned is defined in +.Xr proc 4 +and is valid until a subsequent call to +.Xr Lfree 3PROC . +.Sh RETURN VALUES +Upon successful completion, the +.Fn Lpsinfo +function returns a pointer to the thread's ps information. Otherwise, +.Dv NULL +is returned to indicate that it could not be found. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr ps 1 , +.Xr libproc 3LIB , +.Xr Lfree 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Lstate.3proc b/usr/src/man/man3proc/Lstate.3proc new file mode 100644 index 0000000000..febec067a3 --- /dev/null +++ b/usr/src/man/man3proc/Lstate.3proc @@ -0,0 +1,44 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt LSTATE 3PROC +.Os +.Sh NAME +.Nm Lstate +.Nd obtain thread handle state +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Lstate +.Fa "struct ps_lwphandle *L" +.Fc +.Sh DESCRIPTION +The +.Fn Lstate +function returns the state of the thread handle +.Fa L . +The list of states is available in the +.Xr libproc 3PROC . +.Sh RETURN VALUES +Upon successful completion, the current state is returned. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB diff --git a/usr/src/man/man3proc/Lstatus.3proc b/usr/src/man/man3proc/Lstatus.3proc new file mode 100644 index 0000000000..b02b63f6db --- /dev/null +++ b/usr/src/man/man3proc/Lstatus.3proc @@ -0,0 +1,59 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt LSTATUS 3PROC +.Os +.Sh NAME +.Nm Lstatus +.Nd obtain thread status structure +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "const lwpstatus_t *" +.Fo Pstatus +.Fa "struct ps_lwphandle *L" +.Fc +.Sh DESCRIPTION +The +.Fn Lstatus +function returns the status information about the thread handle +.Fa L . +The +.Sy lwpstatus_t +structure is defined in +.Xr proc 4 +and contains information about the thread including its flags, the size +of its stack, its user and system time, and more. +.Pp +The returned pointer is only valid as long as the thread handle +.Fa L +is valid. After a call to +.Xr Ltree 3PROC , +the returned data pointer is invalid. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Lstatus +function returns a pointer to the status information of the process. +It always succeeds. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Lfree 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Makefile b/usr/src/man/man3proc/Makefile index 1d4cd7aaf5..cb9c1d7649 100644 --- a/usr/src/man/man3proc/Makefile +++ b/usr/src/man/man3proc/Makefile @@ -12,56 +12,408 @@ # # Copyright 2011, Richard Lowe # Copyright 2013 Nexenta Systems, Inc. All rights reserved. +# Copyright 2015 Joyent, Inc. # include $(SRC)/Makefile.master MANSECT= 3proc -MANFILES= proc_service.3proc \ +MANFILES= \ + Lctlfd.3proc \ + Lfree.3proc \ + Lgrab_error.3proc \ + Lgrab.3proc \ + Lprochandle.3proc \ + Lpsinfo.3proc \ + Lstate.3proc \ + Lstatus.3proc \ + Paddr_to_ctf.3proc \ + Paddr_to_loadobj.3proc \ + Paddr_to_map.3proc \ + Pasfd.3proc \ + Pclearfault.3proc \ + Pclearsig.3proc \ + Pcontent.3proc \ + Pcreate_agent.3proc \ + Pcreate_error.3proc \ + Pcreate.3proc \ + Pcred.3proc \ + Pctlfd.3proc \ + Pdelbkpt.3proc \ + Pdelwapt.3proc \ + Pdestroy_agent.3proc \ + Penv_iter.3proc \ + Perror_printf.3proc \ + Pexecname.3proc \ + Pfault.3proc \ + Pfdinfo_iter.3proc \ + Pgcore.3proc \ + Pgetareg.3proc \ + Pgetauxval.3proc \ + Pgetauxvec.3proc \ + Pgetenv.3proc \ + Pgrab_core.3proc \ + Pgrab_error.3proc \ + Pgrab_file.3proc \ + Pgrab.3proc \ + Pisprocdir.3proc \ + Pissyscall.3proc \ + Pldt.3proc \ + Plmid.3proc \ + Plookup_by_addr.3proc \ + Plwp_getasrs.3proc \ + Plwp_getgwindows.3proc \ + Plwp_getpsinfo.3proc \ + Plwp_getregs.3proc \ + Plwp_getspymaster.3proc \ + Plwp_getxregs.3proc \ + Plwp_iter.3proc \ + Plwp_stack.3proc \ + Pmapping_iter.3proc \ + Pobjname.3proc \ + Pplatform.3proc \ + Ppltdest.3proc \ + Ppriv.3proc \ + Ppsinfo.3proc \ + pr_access.3proc \ + pr_close.3proc \ + pr_creat.3proc \ + pr_door_info.3proc \ + pr_exit.3proc \ + pr_fcntl.3proc \ + pr_fstatvfs.3proc \ + pr_getitimer.3proc \ + pr_getpeername.3proc \ + pr_getpeerucred.3proc \ + pr_getprojid.3proc \ + pr_getrctl.3proc \ + pr_getrlimit.3proc \ + pr_getsockname.3proc \ + pr_getsockopt.3proc \ + pr_gettaskid.3proc \ + pr_getzoneid.3proc \ + pr_ioctl.3proc \ + pr_link.3proc \ + pr_llseek.3proc \ + pr_lseek.3proc \ + pr_memcntl.3proc \ + pr_meminfo.3proc \ + pr_mmap.3proc \ + pr_munmap.3proc \ + pr_open.3proc \ + pr_processor_bind.3proc \ + pr_rename.3proc \ + pr_setitimer.3proc \ + pr_setrctl.3proc \ + pr_setrlimit.3proc \ + pr_settaskid.3proc \ + pr_sigaction.3proc \ + pr_stat.3proc \ + pr_statvfs.3proc \ + pr_unlink.3proc \ + pr_waitid.3proc \ + Prd_agent.3proc \ + Pread.3proc \ + Prelease.3proc \ + Preopen.3proc \ + Preset_maps.3proc \ + proc_arg_grab.3proc \ + proc_arg_psinfo.3proc \ + proc_content2str.3proc \ + proc_fltname.3proc \ + proc_fltset2str.3proc \ + proc_get_auxv.3proc \ + proc_get_cred.3proc \ + proc_get_priv.3proc \ + proc_get_psinfo.3proc \ + proc_get_status.3proc \ + proc_initstdio.3proc \ + proc_lwp_in_set.3proc \ + proc_service.3proc \ + proc_str2flt.3proc \ + proc_str2fltset.3proc \ + proc_unctrl_psinfo.3proc \ + proc_walk.3proc \ + Psetbkpt.3proc \ + Psetcred.3proc \ + Psetfault.3proc \ + Psetflags.3proc \ + Psetpriv.3proc \ + Psetrun.3proc \ + Psetsignal.3proc \ + Psetsysentry.3proc \ + Psetwapt.3proc \ + Psetzoneid.3proc \ + Psignal.3proc \ + Pstack_iter.3proc \ + Pstate.3proc \ + Pstatus.3proc \ + Pstopstatus.3proc \ + Psymbol_iter.3proc \ + Psync.3proc \ + Psysentry.3proc \ + Puname.3proc \ + Pupdate_maps.3proc \ + Pupdate_syms.3proc \ + Pwrite.3proc \ + Pxecbkpt.3proc \ + Pzonename.3proc \ ps_lgetregs.3proc \ ps_pglobal_lookup.3proc \ ps_pread.3proc \ ps_pstop.3proc -MANLINKS= ps_kill.3proc \ - ps_lcontinue.3proc \ - ps_lgetfpregs.3proc \ - ps_lgetxregs.3proc \ - ps_lgetxregsize.3proc \ - ps_lrolltoaddr.3proc \ - ps_lsetfpregs.3proc \ - ps_lsetregs.3proc \ - ps_lsetxregs.3proc \ - ps_lstop.3proc \ - ps_pcontinue.3proc \ - ps_pdread.3proc \ - ps_pdwrite.3proc \ - ps_pglobal_sym.3proc \ - ps_ptread.3proc \ - ps_ptwrite.3proc \ - ps_pwrite.3proc - -ps_lgetfpregs.3proc := LINKSRC = ps_lgetregs.3proc -ps_lgetxregs.3proc := LINKSRC = ps_lgetregs.3proc -ps_lgetxregsize.3proc := LINKSRC = ps_lgetregs.3proc -ps_lsetfpregs.3proc := LINKSRC = ps_lgetregs.3proc -ps_lsetregs.3proc := LINKSRC = ps_lgetregs.3proc -ps_lsetxregs.3proc := LINKSRC = ps_lgetregs.3proc - -ps_pglobal_sym.3proc := LINKSRC = ps_pglobal_lookup.3proc - -ps_pdread.3proc := LINKSRC = ps_pread.3proc -ps_pdwrite.3proc := LINKSRC = ps_pread.3proc -ps_ptread.3proc := LINKSRC = ps_pread.3proc -ps_ptwrite.3proc := LINKSRC = ps_pread.3proc -ps_pwrite.3proc := LINKSRC = ps_pread.3proc - -ps_kill.3proc := LINKSRC = ps_pstop.3proc -ps_lcontinue.3proc := LINKSRC = ps_pstop.3proc -ps_lrolltoaddr.3proc := LINKSRC = ps_pstop.3proc -ps_lstop.3proc := LINKSRC = ps_pstop.3proc -ps_pcontinue.3proc := LINKSRC = ps_pstop.3proc + +MANLINKS= \ + Lalt_stack.3proc \ + Lclearfault.3proc \ + Lclearsig.3proc \ + Ldstop.3proc \ + Lgetareg.3proc \ + Lmain_stack.3proc \ + Lputareg.3proc \ + Lsetrun.3proc \ + Lstack.3proc \ + Lstop.3proc \ + Lsync.3proc \ + Lwait.3proc \ + Lxecbkpt.3proc \ + Lxecwapt.3proc \ + Paddr_to_text_map.3proc \ + Pcreate_callback.3proc \ + Pdstop.3proc \ + Pfgcore.3proc \ + Pfgrab_core.3proc \ + Pfree.3proc \ + Pissyscall_prev.3proc \ + Plmid_to_ctf.3proc \ + Plmid_to_loadobj.3proc \ + Plmid_to_map.3proc \ + Plookup_by_name.3proc \ + Plwp_alt_stack.3proc \ + Plwp_getfpregs.3proc \ + Plwp_iter_all.3proc \ + Plwp_main_stack.3proc \ + Plwp_setasrs.3proc \ + Plwp_setfpregs.3proc \ + Plwp_setregs.3proc \ + Plwp_setxregs.3proc \ + Pmapping_iter_resolved.3proc \ + Pname_to_ctf.3proc \ + Pname_to_loadobj.3proc \ + Pname_to_map.3proc \ + Pobject_iter_resolved.3proc \ + Pobject_iter.3proc \ + Pobjname_resolved.3proc \ + Ppriv_free.3proc \ + Pputareg.3proc \ + pr_fstat.3proc \ + pr_fstat64.3proc \ + pr_getrlimit64.3proc \ + pr_lstat.3proc \ + pr_lstat64.3proc \ + pr_setrlimit64.3proc \ + pr_stat64.3proc \ + Pread_string.3proc \ + proc_arg_xgrab.3proc \ + proc_arg_xpsinfo.3proc \ + proc_finistdio.3proc \ + proc_flushstdio.3proc \ + proc_free_priv.3proc \ + proc_get_ldt.3proc \ + proc_lwp_range_valid.3proc \ + proc_signame.3proc \ + proc_sigset2str.3proc \ + proc_str2content.3proc \ + proc_str2sig.3proc \ + proc_str2sigset.3proc \ + proc_str2sys.3proc \ + proc_str2sysset.3proc \ + proc_sysname.3proc \ + proc_sysset2str.3proc \ + ps_kill.3proc \ + ps_lcontinue.3proc \ + ps_lgetfpregs.3proc \ + ps_lgetxregs.3proc \ + ps_lgetxregsize.3proc \ + ps_lrolltoaddr.3proc \ + ps_lsetfpregs.3proc \ + ps_lsetregs.3proc \ + ps_lsetxregs.3proc \ + ps_lstop.3proc \ + ps_pcontinue.3proc \ + ps_pdread.3proc \ + ps_pdwrite.3proc \ + ps_pglobal_sym.3proc \ + ps_ptread.3proc \ + ps_ptwrite.3proc \ + ps_pwrite.3proc \ + Psetsysexit.3proc \ + Pstop.3proc \ + Psymbol_iter_by_addr.3proc \ + Psymbol_iter_by_lmid.3proc \ + Psymbol_iter_by_name.3proc \ + Psysexit.3proc \ + Punsetflags.3proc \ + Pwait.3proc \ + Pxcreate.3proc \ + Pxecwapt.3proc \ + Pxlookup_by_addr_resolved.3proc \ + Pxlookup_by_addr.3proc \ + Pxlookup_by_name.3proc \ + Pxsymbol_iter.3proc \ + Pzonepath.3proc \ + Pzoneroot.3proc + + +ps_lgetfpregs.3proc := LINKSRC = ps_lgetregs.3proc +ps_lgetxregs.3proc := LINKSRC = ps_lgetregs.3proc +ps_lgetxregsize.3proc := LINKSRC = ps_lgetregs.3proc +ps_lsetfpregs.3proc := LINKSRC = ps_lgetregs.3proc +ps_lsetregs.3proc := LINKSRC = ps_lgetregs.3proc +ps_lsetxregs.3proc := LINKSRC = ps_lgetregs.3proc + +ps_pglobal_sym.3proc := LINKSRC = ps_pglobal_lookup.3proc + +ps_pdread.3proc := LINKSRC = ps_pread.3proc +ps_pdwrite.3proc := LINKSRC = ps_pread.3proc +ps_ptread.3proc := LINKSRC = ps_pread.3proc +ps_ptwrite.3proc := LINKSRC = ps_pread.3proc +ps_pwrite.3proc := LINKSRC = ps_pread.3proc + +ps_kill.3proc := LINKSRC = ps_pstop.3proc +ps_lcontinue.3proc := LINKSRC = ps_pstop.3proc +ps_lrolltoaddr.3proc := LINKSRC = ps_pstop.3proc +ps_lstop.3proc := LINKSRC = ps_pstop.3proc +ps_pcontinue.3proc := LINKSRC = ps_pstop.3proc + + +Pxcreate.3proc := LINKSRC = Pcreate.3proc +Pcreate_callback.3proc := LINKSRC = Pcreate.3proc + +Pfgrab_core.3proc := LINKSRC = Pgrab_core.3proc + +Pfree.3proc := LINKSRC = Prelease.3proc + +Plwp_iter_all.3proc := LINKSRC = Plwp_iter.3proc + +Pmapping_iter_resolved.3proc := LINKSRC = Pmapping_iter.3proc +Pobject_iter.3proc := LINKSRC = Pmapping_iter.3proc +Pobject_iter_resolved.3proc := LINKSRC = Pmapping_iter.3proc + +Psymbol_iter_by_addr.3proc := LINKSRC = Psymbol_iter.3proc +Psymbol_iter_by_lmid.3proc := LINKSRC = Psymbol_iter.3proc +Psymbol_iter_by_name.3proc := LINKSRC = Psymbol_iter.3proc +Pxsymbol_iter.3proc := LINKSRC = Psymbol_iter.3proc + +Plmid_to_ctf.3proc := LINKSRC = Paddr_to_ctf.3proc +Pname_to_ctf.3proc := LINKSRC = Paddr_to_ctf.3proc + +Plmid_to_loadobj.3proc := LINKSRC = Paddr_to_loadobj.3proc +Pname_to_loadobj.3proc := LINKSRC = Paddr_to_loadobj.3proc + +Paddr_to_text_map.3proc := LINKSRC = Paddr_to_map.3proc +Plmid_to_map.3proc := LINKSRC = Paddr_to_map.3proc +Pname_to_map.3proc := LINKSRC = Paddr_to_map.3proc + +Pdstop.3proc := LINKSRC = Pstopstatus.3proc +Pstop.3proc := LINKSRC = Pstopstatus.3proc +Pwait.3proc := LINKSRC = Pstopstatus.3proc +Ldstop.3proc := LINKSRC = Pstopstatus.3proc +Lstop.3proc := LINKSRC = Pstopstatus.3proc +Lwait.3proc := LINKSRC = Pstopstatus.3proc + +Lsync.3proc := LINKSRC = Psync.3proc + +Pfgcore.3proc := LINKSRC = Pgcore.3proc + +Pputareg.3proc := LINKSRC = Pgetareg.3proc +Lgetareg.3proc := LINKSRC = Pgetareg.3proc +Lputareg.3proc := LINKSRC = Pgetareg.3proc + +Pissyscall_prev.3proc := LINKSRC = Pissyscall.3proc + +Pxlookup_by_addr.3proc := LINKSRC = Plookup_by_addr.3proc +Pxlookup_by_addr_resolved.3proc := LINKSRC = Plookup_by_addr.3proc +Plookup_by_name.3proc := LINKSRC = Plookup_by_addr.3proc +Pxlookup_by_name.3proc := LINKSRC = Plookup_by_addr.3proc + +Plwp_setregs.3proc := LINKSRC = Plwp_getregs.3proc +Plwp_getfpregs.3proc := LINKSRC = Plwp_getregs.3proc +Plwp_setfpregs.3proc := LINKSRC = Plwp_getregs.3proc + +Plwp_alt_stack.3proc := LINKSRC = Plwp_stack.3proc +Plwp_main_stack.3proc := LINKSRC = Plwp_stack.3proc +Lalt_stack.3proc := LINKSRC = Plwp_stack.3proc +Lmain_stack.3proc := LINKSRC = Plwp_stack.3proc +Lstack.3proc := LINKSRC = Plwp_stack.3proc + +Pobjname_resolved.3proc := LINKSRC = Pobjname.3proc + +Ppriv_free.3proc := LINKSRC = Ppriv.3proc + +Pread_string.3proc := LINKSRC = Pread.3proc + +Punsetflags.3proc := LINKSRC = Psetflags.3proc + +Psetsysexit.3proc := LINKSRC = Psetsysentry.3proc + +Psysexit.3proc := LINKSRC = Psysentry.3proc + +Pxecwapt.3proc := LINKSRC = Pxecbkpt.3proc +Lxecbkpt.3proc := LINKSRC = Pxecbkpt.3proc +Lxecwapt.3proc := LINKSRC = Pxecbkpt.3proc + +Lclearfault.3proc := LINKSRC = Pclearfault.3proc + +Lclearsig.3proc := LINKSRC = Pclearsig.3proc + +Lsetrun.3proc := LINKSRC = Psetrun.3proc + +Pzonepath.3proc := LINKSRC = Pzonename.3proc +Pzoneroot.3proc := LINKSRC = Pzonename.3proc + +pr_fstat.3proc := LINKSRC = pr_stat.3proc +pr_fstat64.3proc := LINKSRC = pr_stat.3proc +pr_lstat.3proc := LINKSRC = pr_stat.3proc +pr_lstat64.3proc := LINKSRC = pr_stat.3proc +pr_stat64.3proc := LINKSRC = pr_stat.3proc + +pr_getrlimit64.3proc := LINKSRC = pr_getrlimit.3proc + +pr_setrlimit64.3proc := LINKSRC = pr_setrlimit.3proc + +proc_arg_xgrab.3proc := LINKSRC = proc_arg_grab.3proc + +proc_arg_xpsinfo.3proc := LINKSRC = proc_arg_psinfo.3proc + +proc_str2content.3proc := LINKSRC = proc_content2str.3proc + +proc_flushstdio.3proc := LINKSRC = proc_initstdio.3proc +proc_finistdio.3proc := LINKSRC = proc_initstdio.3proc + +proc_signame.3proc := LINKSRC = proc_fltname.3proc +proc_sysname.3proc := LINKSRC = proc_fltname.3proc + +proc_sigset2str.3proc := LINKSRC = proc_fltset2str.3proc +proc_sysset2str.3proc := LINKSRC = proc_fltset2str.3proc + +proc_free_priv.3proc := LINKSRC = proc_get_priv.3proc + +proc_lwp_range_valid.3proc := LINKSRC = proc_lwp_in_set.3proc + +proc_str2sig.3proc := LINKSRC = proc_str2flt.3proc +proc_str2sys.3proc := LINKSRC = proc_str2flt.3proc + +proc_str2sigset.3proc := LINKSRC = proc_str2fltset.3proc +proc_str2sysset.3proc := LINKSRC = proc_str2fltset.3proc + +proc_get_ldt.3proc := LINKSRC = Pldt.3proc + +Plwp_setxregs.3proc := LINKSRC = Plwp_getxregs.3proc + +Plwp_setasrs.3proc := LINKSRC = Plwp_getasrs.3proc .KEEP_STATE: diff --git a/usr/src/man/man3proc/Paddr_to_ctf.3proc b/usr/src/man/man3proc/Paddr_to_ctf.3proc new file mode 100644 index 0000000000..9e46933478 --- /dev/null +++ b/usr/src/man/man3proc/Paddr_to_ctf.3proc @@ -0,0 +1,114 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PADDR_TO_CTF 3PROC +.Os +.Sh NAME +.Nm Paddr_to_ctf , +.Nm Plmid_to_ctf , +.Nm Pname_to_ctf +.Nd lookup CTF data +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "ctf_file_t *" +.Fo Paddr_to_ctf +.Fa "struct ps_prochandle *P" +.Fa "uintptr_t addr" +.Fc +.Ft "ctf_file_t *" +.Fo Plmid_to_ctf +.Fa "struct ps_prochandle *P" +.Fa "Lmid_t lmid" +.Fa "const char *name" +.Fc +.Ft "ctf_file_t *" +.Fo Pname_to_ctf +.Fa "struct ps_prochandle *P" +.Fa "const char *name" +.Fc +.Sh DESCRIPTION +The +.Fn Paddr_to_ctf , +.Fn Plmid_to_ctf , +and +.Fn Pname_to_ctf +functions lookup CTF (Compact C Type Format) data, for use with +.Sy libctf , +from the process represented by the handle +.Fa P . +In all cases, the CTF sections of both the running executable and its +shared libraries are searched. +.Pp +The CTF container returned is valid as long as the process handle +.Fa P +is valid. That is, until a call to +.Xr Prelease 3PROC +is made. Further, consumers must not close the CTF container. +.Pp +The +.Fn Paddr_to_ctf +function attempts to find the CTF section, if any, that exists for the +address +.Fa addr . +Note, not all addresses correspond to memory regions that have CTF +data. For example, if a user creates a region of anonymous memory +through the +.Xr mmap 2 +function, then it will not have any corresponding CTF information. +.Pp +The +.Fn Pname_to_ctf +function looks up the object named +.Fa name +and returns the corresponding CTF section, if any exists. Two special +values may be used for name. The macro +.Dv PR_OBJ_EXEC +refers to the executable object itself and the macro +.Dv PR_OBJ_LDSO refers to the object ld.so.1 . +.Pp +The +.Fn Plmid_to_ctf +function is similar to +.Fn Pname_to_ctf . +It allows the passing of a link-map identifier, +.Fa lmid , +which constricts the search of the object named with +.Fa name +to that link-map. The special value of +.Dv PR_LMID_EVERY +indicates that every link-map should be searched, which is equivalent +in behavior to the +.Fn Pname_to_ctf +function. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Paddr_to_ctf , +.Fn Plmid_to_ctf , +and +.Fn Pname_to_ctf +functions return a pointer to the corresponding CTF container. +Otherwise, if none exists then +.Dv NULL +is returned. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr ctf 4 diff --git a/usr/src/man/man3proc/Paddr_to_loadobj.3proc b/usr/src/man/man3proc/Paddr_to_loadobj.3proc new file mode 100644 index 0000000000..220f17e47c --- /dev/null +++ b/usr/src/man/man3proc/Paddr_to_loadobj.3proc @@ -0,0 +1,117 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PADDR_TO_LOADOBJ 3PROC +.Os +.Sh NAME +.Nm Paddr_to_loadobj , +.Nm Plmid_to_loadobj , +.Nm Pname_to_loadobj +.Nd lookup loaded object information +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "const rd_loadobj_t *" +.Fo Paddr_to_loadobj +.Fa "struct ps_prochandle *P" +.Fa "uintptr_t addr" +.Fc +.Ft "const rd_loadobj_t *" +.Fo Plmid_to_loadobj +.Fa "struct ps_prochandle *P" +.Fa "Lmid_t lmid" +.Fa "const char *name" +.Fc +.Ft "const rd_loadobj_t *" +.Fo Pname_to_loadobj +.Fa "struct ps_prochandle *P" +.Fa "const char *name" +.Fc +.Sh DESCRIPTION +The +.Fn Paddr_to_loadobj , +.Fn Plmid_to_loadobj , +and +.Fn Pname_to_loadobj +functions lookup loaded object information from the process handle +.Fa P . +This information is provided by the run-time link-editor, +.Xr ld.so.1 1 , +and provides information about the loaded object such as the link-map +identifier, the TLS module ID, and the address of various sections. +.Pp +The pointer to the data returned by the library will only be valid for +as long as the handle +.Fa P +is valid. Any calls to +.Xr Prelease 3PROC +will invalidate the data. +.Pp +The +.Fn Paddr_to_loadobj +function attempts to find the loaded object information, if any, that exists for the +address +.Fa addr . +Not all address correspond to memory regions that were loaded by the +run-time link-editor. For example, if a user creates a region of +anonymous memory through the +.Xr mmap 2 +function, then it will not have any corresponding loaded module. +.Pp +The +.Fn Pname_to_loadobj +function looks up the object named +.Fa name +and returns the corresponding loaded object information. Two special +values may be used for name. The macro +.Dv PR_OBJ_EXEC +refers to the executable object itself and the macro +.Dv PR_OBJ_LDSO refers to the object ld.so.1 . +.Pp +The +.Fn Plmid_to_loadobj +function is similar to +.Fn Pname_to_loadobj . +It allows the use of a link-map identifier, +.Fa lmid , +which constricts the search of the object named with +.Fa name +to that link-map. The special value of +.Dv PR_LMID_EVERY +may be passed to indicate that every link-map should be searched, which +is equivalent in behavior to the +.Fn Pname_to_loadobj +function. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Paddr_to_loadobj , +.Fn Plmid_to_loadobj , +and +.Fn Pname_to_loadobj +functions return a pointer to the corresponding loadable object +information. +Otherwise, if none exists then +.Dv NULL +is returned. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr librtld_db 3LIB , +.Xr Prelease 3PROC diff --git a/usr/src/man/man3proc/Paddr_to_map.3proc b/usr/src/man/man3proc/Paddr_to_map.3proc new file mode 100644 index 0000000000..eac5dc001d --- /dev/null +++ b/usr/src/man/man3proc/Paddr_to_map.3proc @@ -0,0 +1,129 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PADDR_TO_MAP 3PROC +.Os +.Sh NAME +.Nm Paddr_to_map , +.Nm Paddr_to_text_map , +.Nm Plmid_to_map , +.Nm Pname_to_map +.Nd lookup memory map information +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "const prmap_t *" +.Fo Paddr_to_map +.Fa "struct ps_prochandle *P" +.Fa "uintptr_t addr" +.Fc +.Ft "const prmap_t *" +.Fo Paddr_to_text_map +.Fa "struct ps_prochandle *P" +.Fa "uintptr_t addr" +.Fc +.Ft "const prmap_t *" +.Fo Plmid_to_map +.Fa "struct ps_prochandle *P" +.Fa "Lmid_t lmid" +.Fa "const char *name" +.Fc +.Ft "const prmap_t *" +.Fo Pname_to_map +.Fa "struct ps_prochandle *P" +.Fa "const char *name" +.Fc +.Sh DESCRIPTION +The +.Fn Paddr_to_map , +.Fn Paddr_to_text_map , +.Fn Plmid_to_map , +and +.Fn Pname_to_map +functions lookup memory map information in the process handle +.Fa P . +The +.Sy prmap_t +structure provides information such as the size, offset, and object of +the mapping and is defined in +.Xr proc 4 . +.Pp +The pointer to the data returned by the library will only be valid for +as long as the handle +.Fa P +is valid. Any calls to +.Xr Prelease 3PROC +will invalidate the data. +.Pp +The +.Fn Paddr_to_map +function attempts to find the mapping information corresponding to the +address +.Fa addr . +.Pp +The +.Fn Paddr_to_text_map +function is similar to the +.Fn Paddr_to_map +function; however, it only returns successfully if the specified address +corresponds to a text mapping as identified by the run-time link-editor. +One use of this is to ensure that a mapping is actually a text-mapping +before inserting a breakpoint in it. +.Pp +The +.Fn Pname_to_map +function looks up the object named +.Fa name +and returns the corresponding mapping information. Two special +values may be used for name. The macro +.Dv PR_OBJ_EXEC +refers to the executable object itself and the macro +.Dv PR_OBJ_LDSO refers to the object ld.so.1 . +.Pp +The +.Fn Plmid_to_map +function is similar to +.Fn Pname_to_map . +It allows passing a link-map identifier, +.Fa lmid , +which constricts the search of the object named with +.Fa name +to that link-map. The special value of +.Dv PR_LMID_EVERY +may be passed to indicate that every link-map should be searched, which +is equivalent in behavior to the +.Fn Pname_to_map +function. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Paddr_to_map , +.Fn Paddr_to_text_map , +.Fn Plmid_to_map , +and +.Fn Pname_to_map +functions return a pointer to the corresponding mapping information. +If none exists then +.Dv NULL +is returned. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Prelease 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pasfd.3proc b/usr/src/man/man3proc/Pasfd.3proc new file mode 100644 index 0000000000..90c8865b66 --- /dev/null +++ b/usr/src/man/man3proc/Pasfd.3proc @@ -0,0 +1,74 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PASFD 3PROC +.Os +.Sh NAME +.Nm Pasfd +.Nd obtain the process address space file descriptor +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pasfd +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Pasfd +funtion returns a file descriptor that allows direct access to the +address space of the process handle +.Fa P . +A defined file descriptor is provided when using the +.Xr Pcreate , +.Xr Pgrab 3PROC , +.Xr Pgrab_file 3PROC , +and +.Xr Pgrab_core 3PROC +functions. Note that the address space may be different in each of these +cases and doesn't necessarily correspond to the /proc +.Sy as +file, except for live processes. Other means of obtaining a +.Sy libproc +process handle may not define a file descriptor that contains the +address space. +.Pp +The returned file descriptor must not be closed and is only valid for +as long as the corresponding process handle +.Fa P +is valid. After a call to +.Xr Prelease 3PROC +the file descriptor is invalidated. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pasfd +function returns a valid file descriptor. Otherwise, if none exists, +then +.Sy -1 +is returned. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pcreate 3PROC , +.Xr Pgrab 3PROC , +.Xr Pgrab_core 3PROC , +.Xr Pgrab_file 3PROC , +.Xr Prelease 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pclearfault.3proc b/usr/src/man/man3proc/Pclearfault.3proc new file mode 100644 index 0000000000..dba09993df --- /dev/null +++ b/usr/src/man/man3proc/Pclearfault.3proc @@ -0,0 +1,90 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PCLEARFAULT 3PROC +.Os +.Sh NAME +.Nm Pclearfault , +.Nm Lclearfault +.Nd clear process and thread faults +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pclearfault +.Fa "struct ps_prochandle *P" +.Fc +.Ft int +.Fo Lclearfault +.Fa "struct ps_lwphandle *L" +.Fc +.Sh DESCRIPTION +During normal operation a process may encounter a +.Sy fault , +due to a hardware exception, identifying a problem with the running +process. Hardware faults include things like executing illegal +instructions, encountering a breakpoint, and arithmetic exceptions. +Faults are discussed further in +.Xr proc 4 . +.Pp +The +.Fn Pclearfault +function instructs the system to clear any fault pending delivery to a +thread in the process represented by the process handle +.Fa P . +The pending fault will never be delivered to process represented by +.Fa P . +.Pp +The +.Fn Lclearfault +function is identical to the +.Fn Pclearfault +function, except rather than operating on the representative thread of +the process it operates on the thread handle +.Fa L . +.Pp +The +.Fn Pclearfault +and +.Fn Lclearfault +functions only have meaning for active processes. They will fail on process +handles corresponding to zombie processes, ELF objects, and cores. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pclearfault +and +.Fn Lclearfault +functions clear pending faults and return +.Sy 0 . +Otherwise, +.Sy -1 +is returned, +.Sy errno +is set to indicate the error, +and no faults are cleared. +.Sh ERRORS +For a full list of possible errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pclearsig.3proc b/usr/src/man/man3proc/Pclearsig.3proc new file mode 100644 index 0000000000..b96d78b697 --- /dev/null +++ b/usr/src/man/man3proc/Pclearsig.3proc @@ -0,0 +1,86 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PCLEARSIG 3PROC +.Os +.Sh NAME +.Nm Pclearsig , +.Nm Lclearsig +.Nd clear process signals +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pclearsig +.Fa "struct ps_prochandle *P" +.Fc +.Ft int +.Fo Lclearsig +.Fa "struct ps_lwphandle *L" +.Fc +.Sh DESCRIPTION +During normal operation a process may receive a signal. Signals may +indicate an error, for example referencing unmapped memory, an alarm +firing, requests for information, and users requesting an interruption. +For more information on the generation and usage of signals, see +.Xr signal.h 3HEAD . +.Pp +The +.Fn Pclearsig +function instructs the system to clear any signal pending delivery to +a thread in the process represented by the process handle +.Fa P . +The pending signal will never be delivered to process represented by +.Fa P . +.Pp +The +.Fn Lclearsig +function is identical to the +.Fn Pclearsig +function, except rather than operating on the process and its +representive thread, it instead operates on the thread handle +.Fa L . +.Pp +The +.Fn Pclearsig +function only has meaning for active processes. It will fail on process +handles corresponding to core files, zombie processes and ELF objects. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pclearsig +function clears pending faults and +returns +.Sy 0 . +Otherwise, +.Sy -1 +is returned, +.Sy errno +is set to indicate the error, +and no faults are cleared. +.Sh ERRORS +For a full list of possible errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr signal.h 3HEAD , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pcontent.3proc b/usr/src/man/man3proc/Pcontent.3proc new file mode 100644 index 0000000000..0f31978cef --- /dev/null +++ b/usr/src/man/man3proc/Pcontent.3proc @@ -0,0 +1,68 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PCONTENT 3PROC +.Os +.Sh NAME +.Nm Pconent +.Nd obtain process content types available +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "core_content_t" +.Fo Pcontent +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Pcontent +function describes information available from the process handle +.Fa P . +.Pp +Different types of process handles have different kinds of content +available to them. For example, handles to active and running processes +have more information available than various core files, as the core +file retains a subset of information available in the running process. +Handles that refer to ELF objects, obtained through +.Xr Pgrab_file 3PROC , +will not have information such as a stack available. The content of +core files is controlled by +.Xr coreadm 1M . +.Pp +The symbols that may be returned are listed in the +.Sy core_content_t +heading in the +.Sy TYPES +section in +.Xr libproc 3LIB . +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pcontent +function returns the bitwise-inclusive-OR of content types. Otherwise, +.Dv CC_CONTENT_INVALID +is returned to indicate an error. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pcreate 3PROC , +.Xr Pgrab 3PROC , +.Xr Pgrab_core 3PROC , +.Xr Pgrab_file 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pcreate.3proc b/usr/src/man/man3proc/Pcreate.3proc new file mode 100644 index 0000000000..d3ac9467f9 --- /dev/null +++ b/usr/src/man/man3proc/Pcreate.3proc @@ -0,0 +1,226 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PCREATE 3PROC +.Os +.Sh NAME +.Nm Pcreate , +.Nm Pxcreate , +.Nm Pcreate_callback +.Nd create and control a process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "struct ps_prochandle *" +.Fo Pcreate +.Fa "const char *file" +.Fa "char *const *argv" +.Fa "int *perr" +.Fa "char *path" +.Fa "size_t len" +.Fc +.Ft "struct ps_prochandle *" +.Fo Pxcreate +.Fa "const char *file" +.Fa "char *const *argv" +.Fa "char *const *envp" +.Fa "int *perr" +.Fa "char *path" +.Fa "size_t len" +.Fc +.Ft void +.Fo Pcreate_callback +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Pcreate +function creates a process controlled by the +.Sy libproc +library. The +.Fn Pxcreate +function does the same while also allowing the replacement of the +environment via +.Fa envp . +.Pp +Both functions cause the caller to +.Xr fork 2 . +Followed by the child calling +.Xr exec 2 +to load the new process image specified by +.Fa file . +The +.Ev PATH +is searched for +.Fa file +if it is not an absolute path, similar to +.Xr execvp 2 . +.Pp +The process image will be invoked with the arguments specified by +.Fa argv , +which should be a +.Dv NULL Ns -terminated +array of character strings. Each entry in the array is an individual +argument. The environment of the process image will be inherited from +the running process if the +.Fn Pcreate +function is called or if the +.Fn Pxcreate +function is called and the value of +.Fa envp +is +.Dv NULL . +Otherwise, +.Fa envp +should be a +.Dv NULL Ns -terminated +array of character strings whose entries are in the form of +.Em key=value . +For more on the process environment, see +.Xr environ 5 . +.Pp +The +.Fn Pcreate_callback +function allows a way for callers to inject a callback into the child +process before the call to +.Xr exec 2 . +The symbol +.Sy Pcreate_callback +is a symbol that may be interposed on by consumers. It allows the chance +for the modification of signal dispositions or any other changes that a +caller may wish to make. +.Pp +If the caller's real user or group ID is not their effective user or +group ID, then the child process's user and group IDs will all be reset +to the real user and group id. +.Pp +The +.Fa perr +argument must be a +.Pf non- Dv NULL +pointer. If the +.Fn Pcreate +or +.Fn Pxcreate +functions fail, the value pointed to will be filled in with a more +detailed error code listed in +.Sx ERRORS . +A human-readable error message is obtained with +.Xr Pcreate_error 3PROC . +.Pp +Multiple executables named +.Fa file +may exist on the +.Fa PATH . +To determine the full path of the executable pass a non-NULL +.Fa path +pointer. Upon succesful completion of +.Fn Pcreate +or +.Fn Pxcreate +the +.Fa path +pointer will contain the full path up to +.Fa len +bytes, including the NUL character. +.Pp +Upon successful completion of the +.Fn Pcreate +or +.Fn Pxcreate +function, a handle to the process is returned. This handle is usable +with other +.Sy libproc +routines and will persist until either +.Xr Pfree 3PROC +or +.Xr Prelease 3PROC +is called on the resulting handle. The process created is stopped just +after return from the +.Xr exec 2 +family of system calls. The process will not run, unless the caller sets +it running or releases its handle to the process. +.Pp +A 32-bit process cannot use this interface to launch or control a +64-bit process. However, a 64-bit process can create and control both +32-bit and 64-bit processes. +.Sh RETURN VALUES +Upon successful completion, both the +.Fn Pcreate +and +.Fn Pxcreate +functions create a new process and return a +.Sy libproc +handle to it. Otherwise, +.Sy NULL +is returned and +.Fa perr +is filled in with the corresponding error. +.Sh ERRORS +The +.Fn Pcreate +and +.Fn Pxcreate +functions will fail if: +.Bl -tag -width Er +.It Er C_FORK +The call to +.Xr fork 2 +failed. +.It Er C_INTR +The operation was interrupted by a signal. +.It Er C_LP64 +The calling process is 32-bit, but it attempted to control a 64-bit +process. +.It Er C_NOEXEC +The specified +.Fa file +or the one found by searching +.Dv PATH +cannot be executed. +.It Er C_NOENT +The specified +.Fa file +does not exist or it could not be found by searching +.Dv PATH . +.It Er C_PERM +The specified +.Fa file +or the one found by searching +.Dv PATH +is set-id or unreadable. +.It Er C_STRANGE +An unanticipated system error occurred while trying to create the +process and its handle. When this occurs, then the value of +.Sy errno +is meaningful. See +.Xr errno 3C +for more information and +.Xr Intro 2 +for the list of possible errors. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr exec 2 , +.Xr execvp 2 , +.Xr fork 2 , +.Xr Intro 2 , +.Xr errno 3C , +.Xr libproc 3LIB , +.Xr Pcreate_error 3PROC , +.Xr Pfree 3PROC , +.Xr Prelease 3PROC diff --git a/usr/src/man/man3proc/Pcreate_agent.3proc b/usr/src/man/man3proc/Pcreate_agent.3proc new file mode 100644 index 0000000000..8fcf3e35e4 --- /dev/null +++ b/usr/src/man/man3proc/Pcreate_agent.3proc @@ -0,0 +1,82 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PCREATE_AGENT 3PROC +.Os +.Sh NAME +.Nm Pcreate_agent +.Nd create the agent LWP +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pcreate_agent +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Pcreate_agent +function creates the agent LWP in the process represented by the handle +.Fa P . +The agent LWP is used as a means to force system calls to be invoked on +the controlled process. For more information on the agent LWP, see +.Xr proc 4 . +.Pp +The agent LWP cannot be created for process handles corresponding to +core files, zombie processes, processes that have yet to run, and ELF +objects. +.Pp +The +.Fn Pcreate_agent +function is reentrant. It may be entered recursively. The act of +creating the agent LWP will cause the process to be stopped. +For every call to the +.Fn Pcreate_agent +function, a corresponding call to +.Xr Pdestroy_agent 3PROC +is required. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pcreate_agent +function returns +.Sy 0 +and creates the agent LWP. Otherwise, +.Sy -1 +is returned, +.Sy errno +is set to indicate the error, and the agent LWP is not created. +.Sh ERRORS +The +.Fn Pcreate_agent +function will fail if: +.Bl -tag -width Er +.It Er ENOENT +The process referred to by +.Fa P +is a core file, zombie, ELF object, or has not begun execution. +.El +.Pp +Note, it is possible for other error numbers to be returned. If they +are, they represent unanticipated failure. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pdestroy_agent 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pcreate_error.3proc b/usr/src/man/man3proc/Pcreate_error.3proc new file mode 100644 index 0000000000..74d8331630 --- /dev/null +++ b/usr/src/man/man3proc/Pcreate_error.3proc @@ -0,0 +1,52 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PCREATE_ERROR 3PROC +.Os +.Sh NAME +.Nm Pcreate_error +.Nd get Pcreate, Pxcreate error message string +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "const char *" +.Fo Pcreate_error +.Fa "int error" +.Fc +.Sh DESCRIPTION +The +.Fn Pcreate_error +function returns a pointer to a human-readable character string +describing the error that occurred. The +.Fn Pcreate_error +function translates errors produced by the +.Xr Pcreate 3PROC +and +.Xr Pxcreate 3PROC +functions only (passed as the +.Fa perr +argument). +.Sh RETURN VALUES +The +.Fn Pcreate_error +function always returns a pointer to a character string that describes +the error that occurred, even if it is an unknown error. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pcreate 3PROC , +.Xr Pxcreate 3PROC diff --git a/usr/src/man/man3proc/Pcred.3proc b/usr/src/man/man3proc/Pcred.3proc new file mode 100644 index 0000000000..f8376d45e2 --- /dev/null +++ b/usr/src/man/man3proc/Pcred.3proc @@ -0,0 +1,80 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PCRED 3PROC +.Os +.Sh NAME +.Nm Pcred +.Nd obtain process credentials +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pcred +.Fa "struct ps_prochandle *P" +.Fa "prcred_t *pcrp" +.Fa "int ngroups" +.Fc +.Sh DESCRIPTION +The +.Fn Pcred +function obtains the credentials of the process from the handle +.Fa P . +.Pp +The credentials are read into the buffer pointed to by +.Fa pcrp . +The +.Sy prcred_t +type is defined in +.Xr proc 4 . +It contains information about the current effective, saved, and real +user and group IDs. It also allows for supplemental groups to be +obtained. The +.Fn Pcred +function will read a number of supplemental groups based on the value of +.Fa ngroups . +The +.Sy prcred_t +structure only contains the space for one supplemental group by default. +Callers should ensure that the buffer pointed to by +.Fa pcrp +contains enough space to include all of the required supplemental +groups that are desired. +.Pp +Not all process handles have credential information available to them. +For example, the handles that come from +.Xr Pgrab_file +have no processes associated with them and thus have no credentials +associated with them. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pcred +function returns +.Sy 0 +and updates the memory at +.Fa pcrp +with the credentials. Otherwise, +.Sy -1 +is returned to indicate an error. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Psetcred 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pctlfd.3proc b/usr/src/man/man3proc/Pctlfd.3proc new file mode 100644 index 0000000000..cf331879ed --- /dev/null +++ b/usr/src/man/man3proc/Pctlfd.3proc @@ -0,0 +1,72 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PCTFLD 3PROC +.Os +.Sh NAME +.Nm Pctlfd +.Nd obtain the process control file descriptor +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pctlfd +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Pctlfd +function returns a file descriptor to the underlying /proc file system +.Sy ctl +file for the process identified by the handle +.Fa P . +This may be used for injecting control operations manually; +however, many interfaces for using it are provided by +.Xr libproc 3LIB +itself. +.Pp +Only live processes have a control file descriptor. Process handles that +correspond to files and cores, created through +.Xr Prab_file 3PROC +and +.Xr Pgrab_core 3PROC , +do not have a corresponding file descriptor. +.Pp +The file descriptor is invalidated when the process handle is released +through +.Xr Prelease 3PROC +or if control is lost and the handle is reopened. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pctlfd +function returns a valid file descriptor. Otherwise, if none exists, +then +.Sy -1 +is returned. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pcreate 3PROC , +.Xr Pgrab 3PROC , +.Xr Pgrab_core 3PROC , +.Xr Pgrab_file 3PROC , +.Xr Prelease 3PROC , +.Xr Preopen 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pdelbkpt.3proc b/usr/src/man/man3proc/Pdelbkpt.3proc new file mode 100644 index 0000000000..d999c38426 --- /dev/null +++ b/usr/src/man/man3proc/Pdelbkpt.3proc @@ -0,0 +1,95 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PDELBKPT 3PROC +.Os +.Sh NAME +.Nm Pdelbkpt +.Nd clear a breakpoint in a process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pdelbkpt +.Fa "struct ps_prochandle *P" +.Fa "uintptr_t address" +.Fa "ulong_t saved" +.Fc +.Sh DESCRIPTION +The +.Fn Pdelbkpt +function removes the breakpoint installed at +.Fa address +from process +.Fa P . +Restoring the instruction present in +.Fa saved . +.Pp +If the instruction at +.Fa address +is no longer the architecture-specific breakpoint instruction, then +.Fa saved +is not restored, but the function still returns successfully. This +behavior is done due to the presence of setting breakpoints in +self-modifying code, e.g. procedure linkage tables. +.Pp +The +.Fn Pdelbkpt +function only works on running processes, such as those created through +.Xr Pgrab 3PROC +and +.Xr Pcreate 3PROC . +Attempting to remove a breakpoint from process handles to core files, +zombie processes, or ELF objects will fail. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pdelbkpt +function removes the breakpoint and +returns +.Sy 0 . +Otherwise, +.Sy -1 +is returned, and +.Sy errno +is set to indicate the error. +.Sh ERRORS +For a full list of possible errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Pdelbkpt +function will fail with: +.Bl -tag -width Er +.It Er ENOENT +The handle +.Fa P +refers to a grabbed core file, a zombie process, or an ELF object. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pcreate 3PROC , +.Xr Pgrab 3PROC , +.Xr Pgrab_core 3PROC , +.Xr Pgrab_file 3PROC , +.Xr Psetbkpt 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pdelwapt.3proc b/usr/src/man/man3proc/Pdelwapt.3proc new file mode 100644 index 0000000000..4a3d23d4e9 --- /dev/null +++ b/usr/src/man/man3proc/Pdelwapt.3proc @@ -0,0 +1,88 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PDELWAPT 3PROC +.Os +.Sh NAME +.Nm Pdelwapt +.Nd remove a watchpoint in a process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pdelwapt +.Fa "struct ps_prochandle *P" +.Fa "const prwatch_t *wp" +.Fc +.Sh DESCRIPTION +The +.Fn Pdelwapt +function removes the watchpoint specified by +.Fa wp +from the process represented by the handle +.Fa P . +The watchpoint should have been installed with either +.Xr Psetwapt 3PROC +or the underlying /proc file system +.Sy PCWATCH +operation. +.Pp +The +.Fn Pdelwapt +function only works on running processes, such as those created through +.Xr Pgrab 3PROC +and +.Xr Pcreate 3PROC . +Attempting to remove a watchpoint from process handles to core files, +zombie processes, or ELF objects will fail. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pdelwapt +function removes the watchpoint and returns +.Sy 0 . +Otherwise, +.Sy -1 +is returned, +.Sy errno +is set to indicate the error. +.Sh ERRORS +For a full list of possible errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Pdelwapt +function will fail with: +.Bl -tag -width Er +.It Er ENOENT +The handle +.Fa P +refers to a grabbed core file, a zombie process, or an ELF object. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pcreate 3PROC , +.Xr Pgrab 3PROC , +.Xr Pgrab_core 3PROC , +.Xr Pgrab_file 3PROC , +.Xr Psetwapt 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pdestroy_agent.3proc b/usr/src/man/man3proc/Pdestroy_agent.3proc new file mode 100644 index 0000000000..9b379142cc --- /dev/null +++ b/usr/src/man/man3proc/Pdestroy_agent.3proc @@ -0,0 +1,53 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PDESTROY_AGENT 3PROC +.Os +.Sh NAME +.Nm Pdestroy_agent +.Nd destroy the agent LWP +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft void +.Fo Pdestroy_agent +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Pdestroy_agent +function +removes the agent LWP in +.Fa P . +The existence of the agent LWP is reference counted by the library and +therefore if +.Xr Pcreate_agent 3PROC +has been called multiple times, the +.Fn Pdestroy_agent +function must be called an equal number of times. Upon the last time, it +will destroy the agent LWP. +.Pp +Destroying the agent LWP does not change the state of the process +represented by +.Fa P . +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pcreate_agent 3PROC diff --git a/usr/src/man/man3proc/Penv_iter.3proc b/usr/src/man/man3proc/Penv_iter.3proc new file mode 100644 index 0000000000..b555a53c5f --- /dev/null +++ b/usr/src/man/man3proc/Penv_iter.3proc @@ -0,0 +1,73 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PENV_ITER 3PROC +.Os +.Sh NAME +.Nm Penv_iter +.Nd iterate process environment +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Penv_iter +.Fa "struct ps_prochandle *P" +.Fa "proc_env_f *func" +.Fa "void *data" +.Fc +.Sh DESCRIPTION +The +.Fn Penv_iter +function iterates over the environment of the process represented by +.Fa P . +For each environment variable, +.Fa func +is passed the caller argument +.Fa data +along with the address of the environment variable and the key-value +pair. For the full signature of the +.Ft proc_env_f +callback, see +.Xr libproc 3LIB . +.Pp +The callback's return value controls whether or not iteration +proceeds. If +.Fa func +returns zero, then iteration continues. Otherwise, iteration is +terminated and the value if returned. It is recommend that callback +functions do not return +.Sy -1 +so as to distinguish between the failure of the +.Fn Penv_iter +function and the callback function. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Penv_iter +function returns +.Sy 0 . +Otherwise, if there was an internal error, for example due to a +corrupted environment, then +.Sy -1 +is returned. Otherwise, if the callback function +.Fa func +returns non-zero, then its return value will be returned instead. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB diff --git a/usr/src/man/man3proc/Perror_printf.3proc b/usr/src/man/man3proc/Perror_printf.3proc new file mode 100644 index 0000000000..4ad0b9de08 --- /dev/null +++ b/usr/src/man/man3proc/Perror_printf.3proc @@ -0,0 +1,55 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PERROR_PRINTF 3PROC +.Os +.Sh NAME +.Nm Perror_printf +.Nd interposable function for additional diagnostics +.Sh SYNOPSIS +.Ft void +.Fo Perror_printf +.Fa "struct ps_prochandle *P" +.Fa "const char *format" +.Fa "..." +.Fc +.Sh DESCRIPTION +The +.Fn Perror_printf +function allows for consumers of the +.Sy libproc +library to obtain additional diagnostic information during various +operations. Consumers must explicitly +.Em interpose +on this symbol and provide their own definition, if desired. There is no +requirement for such an interposition to be done. When called, +.Fa P +will be the process handle that the additional diagnostics are being +generated for and the diagnostics will be provided in a +.Xr printf 3C +style. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Pp +While the interposing interface is +.Sy uncommitted , +the provided diagnostics are +.Sy Not-an-Interface +and may change at any time. +.Sh LOCKING +Callers should presume that this function may be called from multiple +threads and always in a context in which taking locks is fine. Callers +should not expect to be called from a signal handler. +.Sh SEE ALSO +.Xr libproc 3LIB diff --git a/usr/src/man/man3proc/Pexecname.3proc b/usr/src/man/man3proc/Pexecname.3proc new file mode 100644 index 0000000000..d380333932 --- /dev/null +++ b/usr/src/man/man3proc/Pexecname.3proc @@ -0,0 +1,68 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PEXECNAME 3PROC +.Os +.Sh NAME +.Nm Pexecname +.Nd obtain full path to process executable +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "char *" +.Fo Pexecname +.Fa "struct ps_prochandle *P" +.Fa "char *buf" +.Fa "size_t buflen" +.Fc +.Sh DESCRIPTION +The +.Fn Pexecname +function attempts to determine the full path to the process executable +referred to by the handle +.Fa P . +.Pp +If found, +.Fa buf +will be filled in with the full path for up to +.Fa buflen +bytes, including the null terminator. +.Pp +For a handle grabbed with +.Xr Pgrab_file 3PROC , +the executable refers to the path of the file itself. For a core file, +the system attempts to determine the original path of the executable +and return that. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pexecname +function returns the value of +.Fa buf , +and up to +.Fa buflen +bytes of +.Fa buf +are filled in with a null-terminated path. +Otherwise, +.Dv NULL +is returned. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB diff --git a/usr/src/man/man3proc/Pfault.3proc b/usr/src/man/man3proc/Pfault.3proc new file mode 100644 index 0000000000..61c6454f02 --- /dev/null +++ b/usr/src/man/man3proc/Pfault.3proc @@ -0,0 +1,103 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PFAULT 3PROC +.Os +.Sh NAME +.Nm Pfault +.Nd enable and disable the tracing of faults +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "int" +.Fo Pfault +.Fa "struct ps_prochandle *P" +.Fa "int which" +.Fa "int stop" +.Fc +.Sh DESCRIPTION +The +.Fn Pfault +function controls what the process +.Fa P +should do on faults. +.Pp +A fault is a hardware event that occurs in the context of a running +process and thread. A hardware fault may occur because an illegal +instruction was executed, a breakpoint or watchpoint was encountered, or +an arithmetic exception occurred, among others. The full list of faults +is available in both +.Xr proc 4 +and +.In sys/fault.h . +.Pp +For each hardware fault, a process may be configured to stop the thread +that encountered it when it occurs. The value of the +.Fa stop +parameter controls whether or not the listed fault in +.Fa which +will cause the thread to trap. A value of 1 indicates the thread +should stop; a value of 0 indicates it should not. +.Pp +The value of +.Fa which +indicates which hardware fault the change applies to. However, if the +value of +.Fa which +is zero, then it applies to all faults. +.Pp +The +.Fn Pfault +function only applies to actively running processes. It does not +function on handles that refer to core files, zombie processes, or ELF +objects. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pfault +function returns the old disposition of the fault -- +.Sy 0 +if it was not set to stop and +.Sy 1 +if it was -- +and the fault state is updated. Otherwise, +.Sy -1 +is returned, +.Dv errno +is updated with the error that occurred, and the fault state is not +updated. +.Sh ERRORS +The +.Fn Pfault +function will fail if: +.Bl -tag -width Er +.It Er EINVAL +The value of +.Fa which +is invalid, e.g. it is less than zero or greater than the largest defined +fault. +.It Er ENOENT +The handle +.Fa P +refers to a process that is a zombie, a core file, or a file. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pfdinfo_iter.3proc b/usr/src/man/man3proc/Pfdinfo_iter.3proc new file mode 100644 index 0000000000..80408130a7 --- /dev/null +++ b/usr/src/man/man3proc/Pfdinfo_iter.3proc @@ -0,0 +1,88 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PFDINFO_ITER 3PROC +.Os +.Sh NAME +.Nm Pfdinfo_iter +.Nd iterate open files in a process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pfdinfo_iter +.Fa "struct ps_prochandle *P" +.Fa "proc_fdinfo_f *func" +.Fa "void *data" +.Fc +.Sh DESCRIPTION +The +.Fn Pfdinfo_iter +function iterates over the open files in the process represented by +.Fa P . +.Pp +For each open file, the callback function +.Fa func +will be invoked and it will be passed the +.Fa data +argument as well as a pointer to a +.Sy prfdinfo_t +structure defined in +.Xr libproc 3LIB . +For the full signature of the +.Vt proc_fdinfo_f +see +.Xr libproc 3LIB . +.Pp +The return value of +.Fa func +controls whether or not iteration continues. If +.Fa func +returns +.Sy 0 , +then iteration will continue. However, if +.Fa func +instead returns a non-zero value, then iteration will halt and that +value will be used as the return value of the +.Fn Pfdinfo_iter +function. Because the +.Fn Pfdinfo_iter +function returns +.Sy -1 +to an indicate its own errors, it is recommended that the callback +function does not return +.Sy -1 +to indicate an error so that the caller may distinguish between the +failure of the callback function and the failure of the +.Fn Pfdinfo_iter +function. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pfdinfo_iter +returns +.Sy 0 . +Otherwise, if there was an internal error then +.Sy -1 +is returned. Otherwise, if the callback function +.Fa func +returns non-zero, then its return value will be returned instead. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB diff --git a/usr/src/man/man3proc/Pgcore.3proc b/usr/src/man/man3proc/Pgcore.3proc new file mode 100644 index 0000000000..24f38c3f6d --- /dev/null +++ b/usr/src/man/man3proc/Pgcore.3proc @@ -0,0 +1,110 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PGCORE 3PROC +.Os +.Sh NAME +.Nm Pfgcore , +.Nm Pgcore +.Nd produce a core file of a process +.Sh SYNOPSIS +.Ft int +.Fo Pfgcore +.Fa "struct ps_prochandle *P" +.Fa "int fd" +.Fa "core_content_t content" +.Fc +.Ft int +.Fo Pgcore +.Fa "struct ps_prochandle *P" +.Fa "const char *fname" +.Fa "core_content_t content" +.Fc +.Sh DESCRIPTION +The +.Fn Pgcore +and +.Fn Pfgcore +functions produce core files of the handle referred to by +.Fa P . +Core files represent a snapshot of a process and may be manipulated by a +wide variety of tools and libraries including +.Xr libproc 3LIB , +.Xr mdb 1 , +.Xr pargs 1 , +.Xr pstack 1 , +and more. For details on the core file format, see +.Xr core 4 . +.Pp +.Fn Pfgcore +writes the core to the file represented by the open descriptor +.Fa fd . +The file descriptor should be open for both read and write. +.Fn Pgcore +writes the core to the file path +.Fa fname . +.Pp +The content of the core is controlled by the +.Fa content +argument. It's the inclusive-bitwise-OR of the various content types +listed under the +.Sy core_content_t +heading in the +.Sy TYPES +section in +.Xr libproc 3LIB . +Using +.Dv CC_CONTENT_INVALID +is illegal and will result in an error. +.Pp +Neither the +.Fn Pgcore +or +.Fn Pfgcore +functions stop the handle +.Fa P . +It is up to the caller to stop the process; which is recommended for +obtaining a consistent view of the process. See the +.Xr Pstop 3PROC +function for a means to stop a handle. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pfcore +and +.Fn Pgcore +functions return +.Sy 0 +and write out a core file to specified location. Otherwise, +.Sy -1 +is returned. The +.Fn Pfgcore +function will truncate +.Fa fd +and the +.Fn Pgcore +function will remove +.Fa fname . +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr coreadm 1M , +.Xr libproc 3LIB , +.Xr Pstop 3PROC , +.Xr core 4 , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pgetareg.3proc b/usr/src/man/man3proc/Pgetareg.3proc new file mode 100644 index 0000000000..1d8a67ca75 --- /dev/null +++ b/usr/src/man/man3proc/Pgetareg.3proc @@ -0,0 +1,178 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PGETAREG 3PROC +.Os +.Sh NAME +.Nm Pgetareg , +.Nm Pputareg , +.Nm Lgetareg , +.Nm Lputareg +.Nd set and get a register from a stopped process or thread +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pgetareg +.Fa "struct ps_prochandle *P" +.Fa "int regno" +.Fa "prgreg_t *preg" +.Fc +.Ft int +.Fo Pputareg +.Fa "struct ps_prochandle *P" +.Fa "int regno" +.Fa "prgreg_t preg" +.Fc +.Ft int +.Fo Lgetareg +.Fa "struct ps_lwphandle *L" +.Fa "int regno" +.Fa "prgreg_t *preg" +.Fc +.Ft int +.Fo Lputareg +.Fa "struct ps_lwphandle *L" +.Fa "int regno" +.Fa "prgreg_t preg" +.Fc +.Sh DESCRIPTION +The +.Fn Pgetareg +and +.Fn Pputareg +functions read and update the registers of the process handle referred +to by +.Fa P . +.Pp +The getting and setting of registers of the process operates on the +representative thread (LWP). For more information on how the +representative is chosen, see +.Xr proc 4 . +To change the registers of a specific thread, use the +.Xr Lgetareg 3PROC +and +.Xr Lsetareg 3PROC +functions. +.Pp +The getting and setting of registers only applies to stopped +processes. In addition, one may obtain registers from core files, but +not set them. To stop a process, see the +.Xr Pstop 3PROC +function. +.Pp +The register to get or set is indicated by the +.Fa regno +argument. For a list of registers, see +.In sys/regset.h . +The set of registers is specific to each architecture of the system. The +.Fn Pgetareg +function will fill in the value of +.Fa preg +with the value of the register +.Fa regno , +while the +.Fn Pputareg +function will update the value of the register +.Fa regno +with the value in +.Fa preg . +Updated registers will be set when the process resumes execution. +.Pp +The +.Fn Lgetareg +and +.Fn Lputareg +functions are equivalent to the +.Fn Pgetareg +and +.Fn Psetareg +functions, except rather than operating on the process and its +representative thread, they instead operate on the thread handle +.Fa L . +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pgetareg +and +.Fn Pputareg +function return +.Sy 0 . +Otherwise, +.Sy -1 +is returned, +.Sy errno +is set, and no registers will have been gotten or updated. +.Sh ERRORS +The +.Fn Pgetareg +and +.Fn Lgetareg +functions will fail if: +.Bl -tag -width Er +.It Er EINVAL +The value of +.Fa regno +is invalid. This means it is less than +.Sy 0 +and greater than +.Sy NPRGREG . +Note, +.Sy NPRGREG Ns 's +value varies based on process architecture. +.It Er EBUSY +The handle +.Fa P +is neither stopped nor a core file. +.It Er ENODATA +The handle +.Fa P +refers to a file obtained through +.Xr Pgrab_file 3PROC . +.El +.Pp +The +.Fn Pputareg +and +.Fn Lputareg +functions will fail if: +.Bl -tag -width Er +.It Er EINVAL +The value of +.Fa regno +is invalid. This means it is less than +.Sy 0 +and greater than +.Sy NPRGREG . +Note, +.Sy NPRGREG Ns 's +value varies based on process architecture. +.It Er EBUSY +The handle +.Fa P +is not stopped or refers to a non-active process. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr errno 3C , +.Xr libproc 3LIB , +.Xr Lgrab 3PROC , +.Xr Pgrab_file 3PROC , +.Xr Pstop 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pgetauxval.3proc b/usr/src/man/man3proc/Pgetauxval.3proc new file mode 100644 index 0000000000..034d68c7f3 --- /dev/null +++ b/usr/src/man/man3proc/Pgetauxval.3proc @@ -0,0 +1,60 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PGETAUXVAL 3PROC +.Os +.Sh NAME +.Nm Pgetauxval +.Nd obtain auxiliary vector value +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pgetauxval +.Fa "struct ps_prochandle *P" +.Fa "int type" +.Fc +.Sh DESCRIPTION +The +.Fn Pgetauxval +function looks up the entry +.Fa type +in the auxiliary vector of the process handle +.Fa P +and returns its value. The +.Fa type +argument should be the entry of the auxiliary vector. The list of such +types may be found in +.In sys/auxv.h . +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pgetauxval +function returns the value of the auxiliary vector entry +.Fa type . +Otherwise, +.Sy -1 +is returned to indicate that either the auxiliary vector or the +.Fa type +entry could not be found. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pgetauxvec 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pgetauxvec.3proc b/usr/src/man/man3proc/Pgetauxvec.3proc new file mode 100644 index 0000000000..a940bdfdcf --- /dev/null +++ b/usr/src/man/man3proc/Pgetauxvec.3proc @@ -0,0 +1,57 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PGETAUXVEC 3PROC +.Os +.Sh NAME +.Nm Pgetauxvec +.Nd obtain process auxiliary vector +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "const auxv_t *" +.Fo Pgetauxvec +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Pgetauxvec +function returns a pointer to a copy of the auxiliary vector for the +process handle +.Fa P . +If the process handle does not represent an actively running process or +the auxiliary vector could not be found, then it instead returns an +empty auxiliary vector. The definitions of the +.Sy auxv_t +may be found in +.In sys/auxv.h . +.Pp +The returned auxiliary vector should not be used across any subsequent +calls to +.Xr libproc 3LIB . +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pgetauxvec +function always returns a pointer to an auxiliary vector. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pgetauxval 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pgetenv.3proc b/usr/src/man/man3proc/Pgetenv.3proc new file mode 100644 index 0000000000..bb34119e6a --- /dev/null +++ b/usr/src/man/man3proc/Pgetenv.3proc @@ -0,0 +1,62 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PGETENV 3PROC +.Os +.Sh NAME +.Nm Pgetenv +.Nd get process environment variable +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "char *" +.Fo Pgetenv +.Fa "struct ps_prochandle *P" +.Fa "const char *name" +.Fa "char *buf" +.Fa "size_t buflen" +.Fc +.Sh DESCRIPTION +The +.Fa Pgetenv +function searches the environment of the process handle +.Fa P +for the environment variable named +.Fa name . +If found it copies up to +.Fa buflen +characters of the value, including the null terminator, into the buffer +.Fa buf . +Everything after the +.Sy = +sign is copied. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pgetenv +function returns the pointer +.Fa buf . +Otherwise, if the environment variable was not found, +.Dv NULL +is returned. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Penv_iter 3PROC , +.Xr environ 5 diff --git a/usr/src/man/man3proc/Pgrab.3proc b/usr/src/man/man3proc/Pgrab.3proc new file mode 100644 index 0000000000..3627d1712f --- /dev/null +++ b/usr/src/man/man3proc/Pgrab.3proc @@ -0,0 +1,220 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PGRAB 3PROC +.Os +.Sh NAME +.Nm Pgrab +.Nd grab and control a process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "struct ps_prochandle *" +.Fo Pgrab +.Fa "pid_t pid" +.Fa "int flags" +.Fa "int *perr" +.Fc +.Sh DESCRIPTION +The +.Fn Pgrab +function attempts to grab the process identified by +.Fa pid +and returns a handle to it that allows the process to be controlled, +interrogated, and manipulated. This interface only works with processes +that already exist. Use +.Xr Pgrab_core 3PROC +for core files and +.Xr Pcreate 3PROC +to create processes. +.Pp +A grabbed process undergoes the following changes unless +.Fa flags +is set to the contrary: +.Bl -bullet -offset indent +.It +The process is stopped +.It +All other tracing flags are cleared +.It +The grab is exclusive. If any existing handles to this process exist +or anyone else is using the underlying facilities of the /proc file +system to control this process, it will fail. +.It +Unless the process is already stopped, the +.Dv PR_RLC +flag is set indicating the process should run-on-last-close. Allowing +the process to resume running if its controlling process dies. +.El +.Pp +Grabbing a process is a +.Em destructive +action. Stopping a process stops execution of all its threads. The +impact of stopping a process depends on the purpose of that process. +For example, if one stops a process that's primarily doing +computation, then its computation is delayed the entire time that it +is stopped. However, if instead this is an active TCP server, then the +accept backlog may fill causing connection errors and potentially +connection time out errors. +.Pp +Special care must be taken to ensure that a stopped process continues, +even if the controlling process terminates. If the controlling process +disables the +.Dv PR_RLC +flag or the process was already stopped, then the process remains +stopped after the controlling process terminates. Exercise caution +when changing this behavior. +.Pp +Many of these default behaviors can be controlled by passing values to +the +.Fa flags +argument. Values for +.Fa flags +are constructed by a bitwise-inclusive-OR of flags from the following +list: +.Bl -tag -width Dv -offset indent +.It Dv PGRAB_RETAIN +Indicates that any existing tracing flags on +.Fa pid +should be retained. If this flag is not specified, they will be cleared +as part of creating the +.Sy libproc +handle for this process. +.Pp +Normally extant tracing flags are cleared when a process is grabbed. +.It Dv PGRAB_FORCE +Indicates that the process should not be grabbed exclusively. Care +should be taken with this option. If other consumers are manipulating +the process, then this may result in surprising behavior as the process +is being manipulated from multiple points of control at the same time. +.Pp +Normally an attempt will be made to grab the process exclusively and +fail if it is already in use. +.It Dv PGRAB_RDONLY +Indicates that the process should be grabbed in a read-only fashion. +This implies that both the +.Dv PGRAB_RETAIN +and +.Dv PGRAB_NOSTOP +flags should be set. If a process is opened read-only, then a caller can +only read information about a process and cannot manipulate it, change +its current state, or inject systems calls into it. +.Pp +Normally when a process is grabbed, it does so for both reading and +writing. +.It Dv PGRAB_NOSTOP +Do not stop a process as it is grabbed. Note, any extant tracing flags +on the process will still be cleared unless the +.Dv PGRAB_RETAIN +flag has been set. +.Pp +Normally a process is stopped as a result of grabbing the process. +.El +.Pp +The +.Fa perr +argument must be a +.Pf non- Dv NULL +pointer which will store a more detailed error in the event that the +.Fn Pgrab +function fails. A human-readable form of the error can be obtained +with +.Xr Pgrab_error 3PROC . +.Pp +Once a caller is done with the library handle it should call +.Xr Prelease 3PROC +to release the grabbed process. Failure to properly release the handle +may leave a process stopped and interfere with the ability of other +software to obtain a handle. +.Ss Permissions +Unprivileged users may grab and control their own processes only if both +the user and group IDs of the target process match those of the calling +process. In addition, the caller must have a super set of the target's +privileges. Processes with the +.Sy PRIV_PROC_OWNER +privilege may manipulate any process on the system, as long as it has an +equal privilege set. For more details on the security and programming +considerations, please see the section +.Sy PROGRAMMING NOTES +in +.Xr proc 4 . +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pgrab +function returns a control handle to the process. Otherwise, +.Dv NULL +is returned with +.Fa perr +containing the error code. +.Sh ERRORS +The +.Fn Pgrab +function will fail if: +.Bl -tag -width Er +.It Er G_BUSY +The process +.Fa pid +is already being traced and the +.Dv PGRAB_FORCE +flag was not passed in +.Fa flags . +.It Er G_LP64 +The calling process is a 32-bit process and process +.Fa pid +is 64-bit. +.It Er G_NOFD +Too many files are open. This is logically equivalent to receiving +.Er EMFILE . +.It Er G_NOPROC +The process referred to by +.Fa pid +does not exist. +.It Er G_PERM +The calling process has insufficient permissions or privileges to open +the specified process. See +.Sx Permissions +for more information. +.It Er G_SYS +The process referred to by +.Fa pid +is a system process and cannot be grabbed. +.It Er G_SELF +The process referred to by +.Fa pid +is the process ID of the caller and the +.Dv PGRAB_RDONLY +was not passed. A process may only grab itself if it's read-only. +.It Er G_STRANGE +An unanticipated system error occurred while trying to grab the process +file and create the handle. +The value of +.Sy errno +indicates the system failure. +.It Er G_ZOMB +The process referred to by +.Fa pid +is a zombie and cannot be grabbed. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr errno 3C , +.Xr libproc 3LIB , +.Xr Pfree 3PROC , +.Xr Pgrab_core 3PROC , +.Xr Pgrab_error 3PROC , +.Xr Pgrab_file 3PROC , +.Xr Prelease 3PROC diff --git a/usr/src/man/man3proc/Pgrab_core.3proc b/usr/src/man/man3proc/Pgrab_core.3proc new file mode 100644 index 0000000000..cf28387c03 --- /dev/null +++ b/usr/src/man/man3proc/Pgrab_core.3proc @@ -0,0 +1,193 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PGRAB_CORE 3PROC +.Os +.Sh NAME +.Nm Pgrab_core , +.Nm Pfgrab_core +.Nd grab a core file +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "struct ps_prochandle *" +.Fo Pgrab_core +.Fa "const char *core" +.Fa "const char *aout" +.Fa "int gflag" +.Fa "int *perr" +.Fc +.Ft "struct ps_prochandle *" +.Fo Pfgrab_core +.Fa "int core_fd" +.Fa "const char *aout" +.Fa "int *perr" +.Fc +.Sh DESCRIPTION +The +.Fn Pgrab_core +and +.Fn Pfgrab_core +functions open a core file for introspection. Unlike live processes, +core files cannot have their state modified; however, all of the +functions that iterate or query state will work. These functions work +on all illumos core files and the core files of some other operating +systems. See both +.Xr core 4 +and the +.Em Core Files +section of +.Xr libproc 3LIB +for more information. +.Pp +The +.Fn Pgrab_core +function attempts to open the core file specified by +.Fa core . +The system attempts to determine the path of the original executable. +The argument +.Fa aout +may either be the path to that file, a path to a directory to +search, or the +.Dv NULL +pointer, if neither is known. The system will search for it and will +supplement information in the core file with that. +.Pp +The +.Fa gflag +argument to the +.Fn Pgrab_core +function controls how the file is opened. If the +.Dv PGRAB_RDONLY +flag is specified, then the core file will be opened with the +.Xr open 2 +flag +.Dv O_RDONLY . +Otherwise, it will be opened +.Dv O_RDWR . +.Pp +The +.Fa perr +argument must be a +.Pf non- Dv NULL +pointer which will store a more detailed error in the event that the +.Fn Pgrab_core +function fails. A human-readable form of the error can be obtained +through the routine +.Xr Pgrab_error 3PROC . +.Pp +The +.Fn Pfgrab_core +is similar to the +.Fn Pgrab_core +function. Except, instead of operating on a path, it opens a handle to +the core file referenced by +.Fa core_fd . +The +.Fa aout +and +.Fa perr +arguments are identical to those in the +.Fn Pgrab_core +function. +.Pp +The handle returned, from either function, is valid until it is closed +with +.Xr Prelease 3PROC +or +.Xr Pfree 3PROC . +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pgrab_core +and +.Fn Pfgrab_core +functions return a +.Sy libproc +handle to the core file. Otherwise, +.Dv NULL +is returned and +.Fa perr +is filled in with a more detailed error message. +.Sh ERRORS +The +.Fn Pgrab_core +function will fail if: +.Bl -tag -width Er +.It Er G_NOCORE +The file +.Fa core +does not exist. +.It Er G_STRANGE +An unexpected system error occurred while trying to open +.Fa core . +The value of +.Sy errno +indicates the system failure. +.El +.Pp +The +.Fn Pgrab_core +and +.Fn Pfgrab_core +functions will fail if: +.Bl -tag -width Er +.It Dv G_ELF +An unexpected +.Xr libelf 3LIB +failure occurred. +.It Dv G_FORMAT +The core file referred to by either +.Fa core +or +.Fa core_fd +is not a valid ELF core file. +.It Dv G_ISAINVAL +The architecture of the core file referred to by either +.Fa core +or +.Fa core_fd +does not match the current running system. +.It Dv G_LP64 +The calling process is a 32-bit process and the core file referenced by +either +.Fa core +or +.Fa core_fd +refers to a 64-bit process. +.It Dv G_NOTE +The ELF notes present in the core file referred to by either +.Fa core +or +.Fa core_fd +are corrupt or missing required data. +.It Dv G_STRANGE +An unanticipated system error occurred while trying to open the core +file and create the handle. +The value of +.Sy errno +indicates the system failure. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr gcore 1 , +.Xr open 2 , +.Xr errno 3C , +.Xr libproc 3LIB , +.Xr Pfree 3PROC , +.Xr Pgrab_error 3PROC , +.Xr Prelease 3PROC , +.Xr core 4 diff --git a/usr/src/man/man3proc/Pgrab_error.3proc b/usr/src/man/man3proc/Pgrab_error.3proc new file mode 100644 index 0000000000..30bfa23f32 --- /dev/null +++ b/usr/src/man/man3proc/Pgrab_error.3proc @@ -0,0 +1,53 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PGRAB_ERROR 3PROC +.Os +.Sh NAME +.Nm Pgrab_error +.Nd get Pgrab error message string +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "const char *" +.Fo Pgrab_error +.Fa "int error" +.Fc +.Sh DESCRIPTION +The +.Fn Pgrab_error +function returns a pointer to a human-readable character string +describing the error that occurred. This function only knows how to +translate errors that are stored in +.Fa perr +during a failed call to +.Xr Pgrab 3PROC , +.Xr Pfgrab_core 3PROC, +.Xr Pgrab_core 3PROC , +or +.Xr Pgrab_file 3PROC . +.Sh RETURN VALUES +The +.Fn Pgrab_error +function always returns a pointer to a character string that describes +the error that occurred, even if it is an unknown error. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pgrab 3PROC , +.Xr Pgrab_core 3PROC , +.Xr Pgrab_file 3PROC diff --git a/usr/src/man/man3proc/Pgrab_file.3proc b/usr/src/man/man3proc/Pgrab_file.3proc new file mode 100644 index 0000000000..d12e052697 --- /dev/null +++ b/usr/src/man/man3proc/Pgrab_file.3proc @@ -0,0 +1,104 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PGRAB_FILE 3PROC +.Os +.Sh NAME +.Nm Pgrab_file +.Nd grab and inspect an ELF object +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft struct ps_prochandle +.Fo Pgrab_file +.Fa "const char *fname" +.Fa "int *perr" +.Fc +.Sh DESCRIPTION +The +.Fn Pgrab_file +function creates a handle to the ELF object contained in file +.Fa fname . +This handle is considered an +.Em idle +handle, it allows one to inspect aspects of the ELF contents present in +the handle, for example obtaining CTF information and looking up +symbols. +.Pp +There is no running state associated with this handle nor can +there be. If one intends to control a running process or create a +process, see +.Xr Pgrab 3PROC +and +.Xr Pcreate 3PROC +respectively. To inspect a core file use +.Xr Pgrab_core 3PROC . +.Pp +The +.Fa perr +argument must be a +.Pf non- Dv NULL +pointer which will store a more detailed error in the event that +.Fn Pgrab_file +fails. A human-readable form of the error can be obtained with +.Xr Pgrab_error 3PROC . +.Pp +When finished with the returned handle, +.Xr Prelease 3PROC +must be called to clean up resources associated with it. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pgrab_file +function returns a control handle to the process. Otherwise, +.Dv NULL +is returned and +.Fa perr +is filled in with an error code. +.Sh ERRORS +.Bl -tag -width Er -offset indent +.It Er G_ELF +An unexpected +.Xr libelf 3LIB +failure occurred while processing the file named by +.Fa fname . +.It Er G_FORMAT +The file named by +.Fa fname +is not a valid ELF file. +.It Er G_NOEXEC +The file named by +.Fa fname +does not exist. +.It Er G_STRANGE +An unanticipated system error occurred while trying to grab the +file +.Fa fname +and create the handle. +The value of +.Sy errno +indicates the system failure. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr errno 3C , +.Xr libelf 3LIB , +.Xr libproc 3LIB , +.Xr Pfree 3PROC , +.Xr Pgrab_core 3PROC , +.Xr Pgrab_error 3PROC , +.Xr Pgrab_file 3PROC , +.Xr Prelease 3PROC diff --git a/usr/src/man/man3proc/Pisprocdir.3proc b/usr/src/man/man3proc/Pisprocdir.3proc new file mode 100644 index 0000000000..daa3569c8f --- /dev/null +++ b/usr/src/man/man3proc/Pisprocdir.3proc @@ -0,0 +1,54 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PISPROCIDR 3PROC +.Os +.Sh NAME +.Nm Pisprocdir +.Nd determine if a directory is the /proc directory +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pisprocdir +.Fa "struct ps_prochandle *P" +.Fa "const char *dir" +.Fc +.Sh DESECRIPTION +The +.Fn Pisprocdir +function determines whether or not the directory +.Fa dir +is the root of the /proc file-system. This works across loopback file +system (lofs) mounts and chroots. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pisprocdir +function returns +.Sy 1 +if +.Fa dir +is the /proc directory, otherwise if not, it returns +.Sy 0 . +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 , +.Xr lofs 7FS diff --git a/usr/src/man/man3proc/Pissyscall.3proc b/usr/src/man/man3proc/Pissyscall.3proc new file mode 100644 index 0000000000..9ec1ba29d3 --- /dev/null +++ b/usr/src/man/man3proc/Pissyscall.3proc @@ -0,0 +1,91 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PISSYSCALL 3PROC +.Os +.Sh NAME +.Nm Pissyscall , +.Nm Pissyscall_prev , +.Nd determine if instructions are system call instructions +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pissyscall +.Fa "struct ps_prochandle *P" +.Fa "uintptr_t addr" +.Fc +.Ft int +.Fo Pissyscall_prev +.Fa "struct ps_prochandle *P" +.Fa "uintptr_t addr" +.Fa "uintptr_t *dst" +.Fc +.Sh DESCRIPTION +The +.Fn Pissyscall +function determines whether or not the instructions at +.Fa addr +in the process handle +.Fa P +corresponds to one of the architecture's system call instructions. +.Pp +the +.Fn Pissyscall_prev +function determines whether or not the instruction before +.Fa addr +in the process handle +.Fa P +corresponds to one of the architecture's system call instructions. If it +does, and +.Fa dst +is a +.Pf non- Dv NULL +pointer, then the address of the system call instruction will be copied +into the location pointed to by +.Fa dst . +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pissyscall +function returns +.Sy non-zero +if +.Fa addr +corresponds to a system call instruction. Otherwise, +.Sy 0 +is returned. +.Pp +Upon successful completion, the +.Fn Pissyscall_prev +function returns +.Sy non-zero +if +.Fa addr +corresponds to a system call instruction and if +.Fa dst +is +.Pf non- Dv NULL , +.Fa dst +is updated. Otherwise, +.Sy 0 +is returned. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB diff --git a/usr/src/man/man3proc/Pldt.3proc b/usr/src/man/man3proc/Pldt.3proc new file mode 100644 index 0000000000..f492497ba3 --- /dev/null +++ b/usr/src/man/man3proc/Pldt.3proc @@ -0,0 +1,132 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PLDT 3PROC +.Os +.Sh NAME +.Nm Pldt , +.Nm proc_get_ldt +.Nd obtain local descriptor table of a process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pldt +.Fa "struct ps_prochandle *P" +.Fa "struct ssd *pldt" +.Fa "int nldt" +.Fc +.Ft int +.Fo proc_get_ldt +.Fa "pid_t pid" +.Fa "struct ssd *pldt" +.Fa "int nldt" +.Fc +.Sh DESCRIPTION +The +.Fn Pldt +function reads the local descriptor table (LDT) of the process handle +.Fa P +into the buffer +.Fa pldt . +Up to +.Fa nldt +entries will be read. +.Pp +If either +.Fa pldt +is +.Dv NULL +or +.Fa nldt +is +.Fa 0 , +then rather than filling in +.Fa pldt , +only the number of entries currently in the LDT is returned. +.Pp +The buffer +.Fa pldt +should contain sufficient space for +.Fa nldt +entries. For example, callers could allocate space as: +.Pp +.Dl pldt = malloc(sizeof (struct ssd) * nldt); +.Pp +For more information on the LDT and the +.Sy struct ssd , +see +.Xr proc 4 . +.Pp +The +.Fn proc_get_ldt +function is similar to the +.Fn Pldt +function; however, rather than reading from a process handle, it reads +the +.Sy ldt +file from the /proc file system for the process +.Fa pid . +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pldt +and +.Fn proc_get_ldt +functions return the number of LDT entries written to +.Fa pldt . +If +.Fa pldt +is +.Dv NULL +or +.Fa nldt +is zero, then no data will be written. Otherwise, +.Sy -1 +is returned. The +.Fn Pldt +function sets +.Sy errno +to indicate the error that occurred. +.Sh ERRORS +For a full list of possible errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Pldt +function will fail if: +.Bl -tag -width Er +.It Er ENODATA +No LDT information is available in the process handle +.Fa P . +.El +.Sh ARCHITECTURE +The +.Fn Pldt +and +.Fn proc_get_ldt +functions are only available on +.Sy x86 +platforms. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Plmid.3proc b/usr/src/man/man3proc/Plmid.3proc new file mode 100644 index 0000000000..ecb9a9a00c --- /dev/null +++ b/usr/src/man/man3proc/Plmid.3proc @@ -0,0 +1,71 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PLMID 3PROC +.Os +.Sh NAME +.Nm Plmid +.Nd get the link-map identifier of an address +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Plmid +.Fa "struct ps_prochandle *P" +.Fa "uintptr_t addr" +.Fa "Lmid_t *lmidp" +.Fc +.Sh DESCRIPTION +The +.Fn Plmid +function attempts to determine the link-map identifier that corresponds +to the address +.Fa addr +in the process +.Fa P . +If +.Fa addr +does not correspond to an address from an object mapped in by the +run-time link editor, such as anonymous mapping created with +.Xr mmap 2 , +then there will be no corresponding link-map identifier. +.Pp +.Fa lmidp +must be a +.Pf non- Dv NULL +pointer that will be filled in with the link-map identifier when it is +successfully determined by the run-time link-editor. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Plmid +function returns +.Sy 0 +and updates +.Fa lmidp +with the link-map identifier of +.Fa addr . +Otherwise, +.Sy -1 +is returned to indicate that the link-map identifier could not be +determined. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Plookup_by_addr.3proc b/usr/src/man/man3proc/Plookup_by_addr.3proc new file mode 100644 index 0000000000..6502956de4 --- /dev/null +++ b/usr/src/man/man3proc/Plookup_by_addr.3proc @@ -0,0 +1,192 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PLOOKUP_BY_ADDR 3PROC +.Os +.Sh NAME +.Nm Plookup_by_addr , +.Nm Pxlookup_by_addr , +.Nm Pxlookup_by_addr_resolved , +.Nm Plookup_by_name , +.Nm Pxlookup_by_name +.Nd lookup symbols in a process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Plookup_by_addr +.Fa "struct ps_prochandle *P" +.Fa "uintptr_t addr" +.Fa "char *buf" +.Fa "size_t size" +.Fa "Gelf_Sym *symp" +.Fc +.Ft int +.Fo Pxlookup_by_addr +.Fa "struct ps_prochandle *P" +.Fa "uintptr_t addr" +.Fa "char *buf" +.Fa "size_t size" +.Fa "Gelf_Sym *symp" +.Fa "prsyminfo_t *sip" +.Fc +.Ft int +.Fo Pxlookup_by_addr_resolved +.Fa "struct ps_prochandle *P" +.Fa "uintptr_t addr" +.Fa "char *buf" +.Fa "size_t size" +.Fa "Gelf_Sym *symp" +.Fa "prsyminfo_t *sip" +.Fc +.Ft int +.Fo Plookup_by_name +.Fa "struct ps_prochandle *P" +.Fa "const char *object" +.Fa "const char *symbol" +.Fa "GElf_Sym *symp" +.Fc +.Ft int +.Fo Pxlookup_by_name +.Fa "struct ps_prochandle *P" +.Fa "Lmid_t lmid" +.Fa "const char *object" +.Fa "const char *symbol" +.Fa "GElf_Sym *symp" +.Fa "prsyminfo_t *sip" +.Fc +.Sh DESCRIPTION +The +.Fn Plookup_by_addr , +.Fn Pxlookup_by_addr , +.Fn Pxlookup_by_addr_resolved , +.Fn Plookup_by_name , +and +.Fn Pxlookup_by_name +functions look up symbol information in the process handle +.Fa P +and fill in the ELF symbol information in +.Fa symp +with the found symbol. Symbols may be looked up both by address and +name. +.Pp +The +.Fn Plookup_by_addr +function looks up symbol information corresponding to the address +.Fa addr . +If found, up to +.Fa size +bytes of the symbol's name, including the null terminator will be filled +in to the buffer +.Fa buf . +.Pp +The +.Fn Pxlookup_by_addr +function is identical to the +.Fn Plookup_by_addr +function, except that it also fills in the structure +.Fa sip +with additional information. The definition of the +.Sy prsyminfo_t +is found in +.Xr libproc 3PROC . +.Pp +The +.Fn Pxlookup_by_addr_resolved +function is similar to the +.Fn Pxlookup_by_addr +function; however, it attempts to resolve the paths present in the +.Sy prsyminfo_t +to an absolute path on the file system. +.Pp +The +.Fn Plookup_by_name +function attempts to look up a symbol based on its name. The +.Fa object +argument allows the caller to specify a specific object that was mapped +in by the run-time link-editor to search for +.Fa symbol +in. The system provides three special values which may be passed in for +.Fa object . +The value +.Dv PR_OBJ_EXEC +refers to the executable's object (a.out). The value +.Dv PR_OBJ_LDSO +refers to the object +.Sy ld.so.1 . +The value +.Dv PR_OBJ_EVERY +indicates that every object should be searched. +.Pp +The +.Fn Pxlookup_by_name +function is similar to the +.Fn Plookup_by_name +function; however, it allows a link-map identifier, +.Fa lmid , +to be specified and also provides additional information about the +symbol in the form of the +.Sy prsyminfo_t +.Fa sip . +The specification of +.Fa lmid +restricts the search for the object named +.Fa object +and symbol named +.Fa symbol +to the specified link-map. +.Pp +There are three special link-map identifiers +that may be passed in. The symbol +.Dv PR_LMID_EVERY +indicates that every link-map should be searched. The symbol +.Dv LM_ID_BASE +indicates that the base link-map, the one that is used for the +executable should be searched. Finally, the symbol +.Dv LM_ID_LDSO +refers to the link-map that is used by the run-time link editor, +ld.so.1. The +.Fn Plookup_by_name +function behaves like +.Fn Pxlookup_by_name +when the +.Dv PR_LMID_EVERY +argument is passed to +.Fa lmid , +indicating that every link-map should be searched. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Plookup_by_addr , +.Fn Pxlookup_by_addr , +.Fn Pxlookup_by_addr_resolved , +.Fn Plookup_by_name , +and +.Fn Pxlookup_by_name +functions return +.Sy 0 +and fill in the symbol information. Otherwise, +.Sy -1 +is returned to indicate that the symbol could not be found. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr elf 3ELF , +.Xr gelf 3ELF , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Plwp_getasrs.3proc b/usr/src/man/man3proc/Plwp_getasrs.3proc new file mode 100644 index 0000000000..7630857461 --- /dev/null +++ b/usr/src/man/man3proc/Plwp_getasrs.3proc @@ -0,0 +1,142 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PLWP_GETASRS 3PROC +.Os +.Sh NAME +.Nm Plwp_getasrs , +.Nm Plwp_setasrs +.Nd get and set SPARCv9 ancillary state registers +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Plwp_getasrs +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "asrset_t asrs" +.Fc +.Ft int +.Fo Plwp_setasrs +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "const asrset_t asrs" +.Fc +.Sh DESCRIPTION +The +.Fn Plwp_getasrs +and +.Fn Plwp_setasrs +functions get and set the ancillary thread-specific register set of the +thread +.Fa lwpid +in the process handle +.Fa P . +.Pp +The ancillary state registers are only present on 64-bit +.Sy SPARCv9 +processes. They contain information that is specific to the platform and +are not included in the information obtained through functions such as +.Xr Plwp_getregs 3PROC , +.Xr Plwp_getfpregs 3PROC , +and +.Xr Plwp_getxregs 3PROC . +.Pp +The Plwp_getasrs +function reads the ancillary registers into +.Fa asrs , +while the +.Fn Plwp_setasrs +sets the thread's ancillary registers to the values provided by +.Fa asrs . +.Pp +Processes should be stopped prior to obtaining the register state of +individual threads. Processes may be stopped with +.Xr Pstop 3PROC . +.Pp +The +.Sy asrset_t +structure is described in +.Xr proc 4 . +.Pp +One may not set the register values of a process that is not an active +process, e.g. a process handle that refers to a file or a core file. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Plwp_getasrs +and +.Fn Plwp_setasrs +functions return +.Sy 0 +and get or set the register state. Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to indicate the error. +.Sh ERRORS +For a full list of possible errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Plwp_getasrs +and +.Fn Plwp_setasrs +function will fail if: +.Bl -tag -width Er +.It Er ENODATA +The process handle +.Fa P +does not have any ancillary register state information. +.It Er EBUSY +The process handle +.Fa P +refers to a live process and it is not stopped. +.It Er ENOENT +The process handle +.Fa P +refers to a live process and there is no thread with id +.Fa lwpid +or it is not a 64-bit SPARCv9 process. +.It Er EINVAL +The process handle +.Fa P +refers to a core file and there is no thread with id +.Fa lwpid . +.El +.Sh ARCHITECTURE +The +.Fn Plwp_getasrs +and +.Fn Plwp_setasrs +functions are only available on +64-bit +.Sy SPARCv9 +platforms. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Plwp_getfpregs 3PROC , +.Xr Plwp_getregs 3PROC , +.Xr Plwp_setregs 3PROC , +.Xr Plwp_setregs 3PROC , +.Xr Pstop 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Plwp_getgwindows.3proc b/usr/src/man/man3proc/Plwp_getgwindows.3proc new file mode 100644 index 0000000000..f6a4234d84 --- /dev/null +++ b/usr/src/man/man3proc/Plwp_getgwindows.3proc @@ -0,0 +1,96 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PLWP_GETGWINDOWS 3PROC +.Os +.Sh NAME +.Nm Plwp_getgwindows +.Nd get thread unspilled register windows +.Sh SYNOPSIS +.Ft int +.Fo Plwp_getgwindows +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "gwindows_t *gwins" +.Fc +.Sh DESCRIPTION +The +.Fn Plwp_getgwindows +function returns information about register windows that were not +spilled to the stack for the thread identified by +.Fa lwpid +in the process handle +.Fa P . +The argument +.Fa gwins +will be filled in with information about the register windows. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Plwp_getgwindows +function returns +.Sy 0 +and +.Fa gwins +is filled in with information about the windows. Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to indicate the error. +.Sh ERRORS +For a full list of possible errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Plwp_getgwindows +function will fail if: +.Bl -tag -width Er +.It Er ENODATA +The process handle +.Fa P +does not have any +.Sy gwindows +information. +.It Er EBUSY +The process handle +.Fa P +refers to a live process and it is not stopped. +.It Er ENOENT +The process handle +.Fa P +refers to a live process and there is no thread with id +.Fa lwpid . +.It Er EINVAL +The process handle +.Fa P +refers to a core file and there is no thread with id +.Fa lwpid . +.El +.Sh ARCHITECTURE +The +.Fn Plwp_getgwindows +function is only available on +.Sy SPARC +platforms. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Plwp_getpsinfo.3proc b/usr/src/man/man3proc/Plwp_getpsinfo.3proc new file mode 100644 index 0000000000..c798a1dd91 --- /dev/null +++ b/usr/src/man/man3proc/Plwp_getpsinfo.3proc @@ -0,0 +1,101 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PLWP_GETPSINFO 3PROC +.Os +.Sh NAME +.Nm Plwp_getpsinfo +.Nd get thread specific ps information +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Plwp_getpsinfo +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "lwpsinfo_t *lps" +.Fc +.Sh DESCRIPTION +The +.Fn Plwp_getpsinfo +function +looks up the thread-specific +.Xr ps 1 +information for the thread specified by +.Fa lwpid +in the process handle +.Fa P . +The caller should provide a pointer to an +.Sy lwpsinfo_t , +.Fa lps , +whose definition can be found in +.Xr proc 4 . +.Fa lps +will be filled in with information such as the thread's id, its current +state, priority, and run-time. +.Pp +The +.Fn Plwp_getpsinfo +function only works on process handles that refer to active processes +and core files, it does not work on process handles that refer to +individual files. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Plwp_getpsinfo +function returns +.Sy 0 +and +.Fa lps +is filled in with the +thread-specific +.Xr ps 1 +information. Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to indicate the error. +.Sh ERRORS +For a full list of possible errors also see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Plwp_getpsinfo +function will fail if: +.Bl -tag -width Er +.It Er ENODATA +.Fa P +refers to a file handle obtained through +.Xr Pgrab_file 3PROC . +.It Er EINVAL +The process handle +.Fa P +refers to a core file and the specified thread does not exist. +.It Er ENOENT +The process handle +.Fa P +refers to an active process and the specified thread does not exist. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr ps 1 , +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Plwp_getregs.3proc b/usr/src/man/man3proc/Plwp_getregs.3proc new file mode 100644 index 0000000000..70115f4b4b --- /dev/null +++ b/usr/src/man/man3proc/Plwp_getregs.3proc @@ -0,0 +1,154 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PLWP_GETREGS 3PROC +.Os +.Sh NAME +.Nm Plwp_getfpregs , +.Nm Plwp_setfpregs , +.Nm Plwp_getregs , +.Nm Plwp_setregs +.Nd get and set thread registers +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Plwp_getfpregs +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "prfpregset_t *fpregs" +.Fc +.Ft int +.Fo Plwp_setfpregs +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "const prfpregset_t fpregs" +.Fc +.Ft int +.Fo Plwp_getregs +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "prpregset_t *gregs" +.Fc +.Ft int +.Fo Plwp_setregs +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "const prpregset_t gregs" +.Fc +.Sh DESCRIPTION +The +.Fn Plwp_getregs , +.Fn Plwp_setregs , +.Fn Plwp_getfpregs , +and +.Fn Plwp_setfpregs +functions allow one to get and set the general purpose and floating +point registers from the thread +.Fa lwpid +in the process handle +.Fa P . +.Pp +The +.Fn Plwp_getfpregs +function updates the structure pointed to by +.Fa fpregs +with the state and values of the floating point registers of the thread +specified by +.Fa lwpid . +.Pp +The +.Fn Plwp_setfpregs +function updates the floating point registers of the thread specified by +.Fa lwpid +to the register state contained in +.Fa fpregs . +.Pp +The +.Fn Plwp_getregs +function updates the structure pointed to by +.Fa gregs +with the state and values of the general purpose registers of the thread +specified by +.Fa lwpid. +.Pp +The +.Fn Plwp_setregs +function updates the general purpose registers of the thread specified +by +.Fa lwpid +to the register state contained in +.Fa gregs . +.Pp +Processes must be stopped before obtaining the register state of +individual threads. Processes may be stopped with +.Xr Pstop 3PROC . +The structures used for registers are described in +.Xr proc 4 +and their defintions may be found in +.In sys/regset.h . +The definitions of these structures varies based on the architecture of +the system and the running process. +.Pp +One may not set the register values of a process that is not an active +process, e.g. a process handle that refers to a file or a core file. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Plwp_getregs , +.Fn Plwp_setregs , +.Fn Plwp_getfpregs , +and +.Fn Plwp_setfpregs +functions return +.Sy 0 +and obtain or set the register state. Otherwise, +.Sy -1 +is returned, +.Sy errno +is set to indicate the error, and the register state is not updated nor +are the data pointers changed. +.Sh ERRORS +For a full list of possible errors also see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Plwp_getregs , +.Fn Plwp_setregs , +.Fn Plwp_getfpregs , +and +.Fn Plwp_setfpregs +will fail if: +.Bl -tag -width Er +.It Er EBUSY +The process handle +.Fa P +is not currently stopped. +.It Er ENOENT +There is no thread in +.Fa P +with id +.Fa lwpid . +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Plwp_getspymaster.3proc b/usr/src/man/man3proc/Plwp_getspymaster.3proc new file mode 100644 index 0000000000..67244077d1 --- /dev/null +++ b/usr/src/man/man3proc/Plwp_getspymaster.3proc @@ -0,0 +1,116 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PLWP_GETSPYMASTER 3PROC +.Os +.Sh NAME +.Nm Plwp_getspymaster +.Nd get agent LWP spy master information +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Plwp_getspymaster +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "psinfo_t *ps" +.Fc +.Sh DESCRIPTION +The +.Fn Plwp_getspymaster +function returns information about the spy master that corresponds to +the agent LWP for the thread +.Fa lwpid +in the process handle +.Fa P . +.Pp +The agent LWP allows another process to inject actions into the target +process. When an agent LWP is created, it leverages an existing thread +in the process and it also creates a record of whom created the agent, +which is called the spy master. For more information on the agent LWP +and the spy master, see +.Xr proc 4 . +.Pp +If the thread identified +.Fa lwpid +has an agent LWP, the corresponding ps information (see +.Xr proc 4 +for the definition of the +.Sy psinfo_t Ns ) +will be filled into +.Fa ps . +.Pp +Note, process handles that correspond to a file, created by +.Xr Pgrab_file 3PROC , +cannot have an agent LWP created for them and thus cannot have any spy +master information. In addition, core files from older releases may not +have any data on the spy master. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Plwp_getspymaster +returns +.Sy 0 +and updates +.Fa ps . +Otherwise, it returns +.Sy -1 , +sets +.Sy errno , +and +.Fa ps +is not modified. +.Sh ERRORS +For a full list of possible errors also see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Plwp_getpsinfo +function will fail if: +.Bl -tag -width Er +.It Er ENODATA +.Fa P +refers to a file handle obtained through +.Xr Pgrab_file 3PROC +or +.Fa P +does not have any information about the spy master. +.It Er EINVAL +The process handle +.Fa P +refers to a core file and the specified thread does not exist. +.Pp +The thread, +.Fa lwpid +does not have an active agent, +.Dv PR_AGENT +is not set in the +.Sy pr_flags +member of the thread's status information. +.It Er ENOENT +The process handle +.Fa P +refers to an active process and the specified thread does not exist. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Plwp_getxregs.3proc b/usr/src/man/man3proc/Plwp_getxregs.3proc new file mode 100644 index 0000000000..0445251578 --- /dev/null +++ b/usr/src/man/man3proc/Plwp_getxregs.3proc @@ -0,0 +1,141 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PLWP_GETXREGS 3PROC +.Os +.Sh NAME +.Nm Plwp_getxregs , +.Nm Plwp_setxregs +.Nd get and set extended register state +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Plwp_getxregs +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "prxregset_t *xregs" +.Fc +.Ft int +.Fo Plwp_setxregs +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "const prxregset_t *xregs" +.Fc +.Sh DESCRIPTION +The +.Fn Plwp_getxregs +and +.Fn Plwp_setxregs +functions get and set the extended register state of the thread +.Fa lwpid +in the process handle +.Fa P . +.Pp +The extended register state is defined by the architecture. These +registers may refer to optional registers that have become common on the +platform, but are not part of the standard ABI and thus not covered by +functions such as +.Xr Plwp_getregs 3PROC +and +.Xr Plwp_getfpregs 3PROC . +.Pp +The +.Fn Plwp_getxregs +function gets the extended register state information and places it into +.Fa xregs . +Where as the +.Fn Plwp_setxregs +function sets the extended register state information in +.Fa xregs +for the process handle +.Fa P . +.Pp +Processes must be stopped prior to obtaining the register state of +individual threads. Processes may be stopped with +.Xr Pstop 3PROC . +.Pp +The +.Sy prxregset_t +structure is described in +.Xr proc 4 . +.Pp +One may not set the register values of a process that is not an active +process, e.g. a process handle that refers to a file or a core file. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Plwp_getxregs +and +.Fn Plwp_setxregs +functions return +.Sy 0 +and get or set the register state. Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to indicate the error. +.Sh ERRORS +For a full list of possible errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Plwp_getxregs +and +.Fn Plwp_setxregs +function will fail if: +.Bl -tag -width Er +.It Er ENODATA +The process handle +.Fa P +does not have any extended register state information. +.It Er EBUSY +The process handle +.Fa P +refers to a live process and it is not stopped. +.It Er ENOENT +The process handle +.Fa P +refers to a live process and there is no thread with id +.Fa lwpid . +.It Er EINVAL +The process handle +.Fa P +refers to a core file and there is no thread with id +.Fa lwpid . +.El +.Sh ARCHITECTURE +The +.Fn Plwp_getxregs +and +.Fn Plwp_setxregs +functions are only available on +.Sy SPARC +platforms. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Plwp_getfpregs 3PROC , +.Xr Plwp_getregs 3PROC , +.Xr Plwp_setfpregs 3PROC , +.Xr Plwp_setregs 3PROC , +.Xr Pstop 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Plwp_iter.3proc b/usr/src/man/man3proc/Plwp_iter.3proc new file mode 100644 index 0000000000..3ad0f1219b --- /dev/null +++ b/usr/src/man/man3proc/Plwp_iter.3proc @@ -0,0 +1,106 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PLWP_ITER 3PROC +.Os +.Sh NAME +.Nm Plwp_iter , +.Nm Plwp_iter_all +.Nd iterate over threads +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Plwp_iter +.Fa "struct ps_prochandle *P" +.Fa "proc_lwp_f *func", +.Fa "void *data" +.Fc +.Ft int +.Fo Plwp_iter_all +.Fa "struct ps_prochandle *P" +.Fa "proc_lwp_all_f *func" +.Fa "void *data" +.Fc +.Sh DESCRIPTION +The +.Fn Plwp_iter +and +.Fn Plwp_iter_all +functions iterates over threads in the given process handle +.Fa P . +The +.Fn Plwp_iter +function iterates over all active threads, where as the +.Fn Plwp_iter_all +function iterates over both active threads and zombie threads -- threads +waiting to be reaped. +.Pp +For each thread, the callback function +.Fa func +is called with the pointer to the private data argument, +.Fa data , +and the thread's +.Sy lwpstatus_t +structure. In the case of the +.Fn Plwp_iter_all +function, the thread's +.Sy lwpsinfo_t +is also included. +.Pp +The return value of +.Fa func +controls whether or not iteration continues. If +.Fa func +returns +.Sy 0 , +then both functions will continue iteration. However, if +.Fa func +returns non-zero, then iteration will halt and that value will be used +as the return value of the +.Fn Plwp_iter +and +.Fn Plwp_iter_all +functions. Because both functions return +.Sy -1 +on internal failure, it is recommended that the callback function does +not return +.Sy -1 +to indicate an error so that the caller may distinguish between the +failure of the callback function and the failure of the +.Fn Plwp_iter +and +.Fn Plwp_iter_all +functions. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Plwp_iter +and +.Fn Plwp_iter_all +functions return +.Sy 0 . +Otherwise, if there was an internal error or there is no thread data, then +.Sy -1 +is returned. Otherwise, if the callback function +.Fa func +returns non-zero, then its return value will be returned instead. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB diff --git a/usr/src/man/man3proc/Plwp_stack.3proc b/usr/src/man/man3proc/Plwp_stack.3proc new file mode 100644 index 0000000000..1e8c189a9f --- /dev/null +++ b/usr/src/man/man3proc/Plwp_stack.3proc @@ -0,0 +1,193 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PLWP_STACK 3PROC +.Os +.Sh NAME +.Nm Plwp_stack , +.Nm Plwp_alt_stack , +.Nm Plwp_main_stack , +.Nm Lstack , +.Nm Lalt_stack , +.Nm Lmain_stack +.Nd get thread stack information +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Plwp_stack +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "stack_t *stkp" +.Fc +.Ft int +.Fo Plwp_alt_stack +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "stack_t *stkp" +.Fc +.Ft int +.Fo Plwp_main_stack +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "stack_t *stkp" +.Fc +.Ft int +.Fo Lalt_stack +.Fa "struct ps_lwphandle *L" +.Fa "stack_t *stkp" +.Fc +.Ft int +.Fo Lmain_stack +.Fa "struct ps_lwphandle *L" +.Fa "stack_t *stkp" +.Fc +.Ft int +.Fo Lstack +.Fa "struct ps_lwphandle *L" +.Fa "stack_t *stkp" +.Fc +.Sh DESCRIPTION +The +.Fn Plwp_stack , +.Fn Plwp_alt_stack , +and +.Fn Plwp_main_stack +functions obtain information about the size and address of the stacks +for the thread identified by +.Fa lwpid +in the process handle +.Fa P . +.Pp +Each thread in a process has its own stack which is used both for +maintaining function call sequences and the storing of local variables. +A thread may also configure a different stack to handle specific +signals. This stack is often called the +.Em alternate stack . +Whether or not the alternate stack is used may be controlled through the +.Xr sigaction 2 +and +.Xr sigaltstack 2 +functions . +.Pp +The +.Fn Plwp_stack +function fills in +.Fa stkp +with the information about the thread's currently executing stack, +whether the alternate or main one. +.Pp +The +.Fn Plwp_alt_stack +function fills in +.Fa stkp +with the information about the thread's alternate stack, if it's +configured. +.Pp +The +.Fn Plwp_main_stack +function fills in +.Fa stkp +with the information about the thread's main stack, regardless of if there +is an alternate stack or it is executing one. +.Pp +Process handles that refer to files, obtained through +.Xr Pgrab_file 3PROC , +do not have any stack information and these functions will always fail +on them. +.Pp +The +.Fn Lalt_stack , +.Fn Lmain_stack , +and +.Fn Lstack +functions are identical to the +.Fn Plwp_alt_stack , +.Fn Plwp_main_stack , +and +.Fn Plwp_main_stack +functions, except rather than specifying a thread to operate on, they +operate on the thread handle +.Fa L , +which specifies the thread to operate on. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Plwp_stack , +.Fn Plwp_alt_stack , +.Fn Plwp_main_stack , +.Fn Lalt_stack , +.Fn Lmain_stack , +and +.Fn Lstack +functions return +.Sy 0 +and fills in +.Fa stkp +with information about the appropriate stack. Otherwise, +.Sy -1 +is returned, +.Sy errno +is updated with the error, and +.Fa stkp +is not modified. +.Sh ERRORS +For a full list of possible errors also see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Plwp_stack , +.Fn Plwp_alt_stack , +and +.Fn Plwp_main_stack +function will fail if: +.Bl -tag -width Er +.It Er ENODATA +The process handle +.Fa P +refers to a grabbed file, not an active process or core. +.It Er EINVAL +The process handle +.Fa P +refers to a core file and the specified thread does not exist. +.It Er ENOENT +The process handle +.Fa P +refers to an active process and the specified thread does not exist. +.El +.Pp +The +.Fn Plwp_alt_stack +and +.Fn Lalt_stack +functions will fail if: +.Bl -tag -width Er +.It Er ENODATA +The thread identified by +.Fa lwpid +did not have an alternate stack enabled. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr sigaction 2 , +.Xr sigaltstack 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pmapping_iter.3proc b/usr/src/man/man3proc/Pmapping_iter.3proc new file mode 100644 index 0000000000..b60d06ad50 --- /dev/null +++ b/usr/src/man/man3proc/Pmapping_iter.3proc @@ -0,0 +1,158 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PMAPPING_ITER 3PROC +.Os +.Sh NAME +.Nm Pmapping_iter , +.Nm Pmapping_iter_resolved , +.Nm Pobject_iter , +.Nm Pobject_iter_resolved +.Nd iterate over process mappings and objects +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pmapping_iter +.Fa "struct ps_prochandle *P" +.Fa "proc_map_f *func" +.Fa "void *data" +.Fc +.Ft int +.Fo Pmapping_iter_resolved +.Fa "struct ps_prochandle *P" +.Fa "proc_map_f *func" +.Fa "void *data" +.Fc +.Ft int +.Fo Pobject_iter +.Fa "struct ps_prochandle *P" +.Fa "proc_map_f *func" +.Fa "void *data" +.Fc +.Ft int +.Fo Pobject_iter_resolved +.Fa "struct ps_prochandle *P" +.Fa "proc_map_f *func" +.Fa "void *data" +.Fc +.Sh DESCRIPTION +The +.Fn Pmapping_iter +and +.Fn Pmapping_iter_resolved +functions iterate over the memory mappings in the process represented by +.Fa P. +.Pp +For each memory mapping, the callback function +.Fa func +will be invoked and it will be passed the +.Fa data +argument, +the +.Sy prmap_t +structure defined from +.Xr proc 4 , +and a name of the mapping. The way that the name is obtained varies +based on whether one calls +.Fn Pmapping_iter +or +.Fn Pmapping_iter_resolved . +In both cases, the dynamic linker is consulted to determine the file +name for the mapping, if it's known. If the name is unknown, for example +an anonymous mapping, then the +.Dv NULL +pointer is passed in for the name. In the case of the +.Fn Pmapping_iter_resolved +function the system tries to resolve it to a complete file system path. +If that fails, it falls back to the information from the dynamic linker, +before returning +.Dv NULL +in the case of not being able to find any name. +For more information on the +signature of the +.Ft proc_map_f , +see +.Xr libproc 3LIB . +.Pp +The return value of +.Fa func +controls whether or not iteration continues. If +.Fa func +returns +.Sy 0 +then iteration continues. If +.Fa func +returns non-zero then iteration will halt and the value will be +returned to the caller. Because +.Sy -1 +indicates internal failure, it is recommended that the callback +function not return +.Sy -1 +to indicate an error itself. This allows the caller to distinguish +between failure of the callback function versus failure of the +.Fn Pmapping_iter +and +.Fn Pmapping_iter_resolved +functions. +.Pp +The +.Fn Pobject_iter +and +.Fn Pobject_iter_resolved +functions are similar to the +.Fn Pmapping_iter +and +.Fn Pmapping_iter_resolved +functions. Except, rather than iterating over every mapping, they +iterate over the objects that the process has loaded by the dynamic +linker. For example, an anonymous mapping will show up when iterating +mappings, but will not show up when iterating objects. Further, while +most dynamic shared objects have multiple mappings for the text and +data sections, there will only be a single object that is iterated +over. +.Pp +The distinction between the +.Fn Pobject_iter +and +.Fn Pobject_iter_resolved +functions is identical to the difference in name resolution between the +.Fn Pmapping_iter +and +.Fn Pmapping_iter_resolved +functions. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pmapping_iter , +.Fn Pmapping_iter_resolved +.Fn Pobject_iter , +and +.Fn Pobject_iter_resolved +functions return +.Sy 0. +Otherwise, if there was an internal error then +.Sy -1 +is returned. Otherwise, if the callback function +.Fa func +returns non-zero, then its return value will be returned instead. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pobjname.3proc b/usr/src/man/man3proc/Pobjname.3proc new file mode 100644 index 0000000000..cd97e41ce7 --- /dev/null +++ b/usr/src/man/man3proc/Pobjname.3proc @@ -0,0 +1,91 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt POBJNAME 3PROC +.Os +.Sh NAME +.Nm Pobjname , +.Nm Pobjname_resolved , +.Nd turn a virtual address into its mapped object +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "char *" +.Fo Pobjname +.Fa "struct ps_prochandle *P" +.Fa "uintptr_t addr" +.Fa "char *buffer" +.Fa "size_t bufsize" +.Fc +.Ft char * +.Fo Pobjname_resolved +.Fa "struct ps_prochandle *P" +.Fa "uintptr_t addr" +.Fa "char *buffer" +.Fa "size_t bufsize" +.Fc +.Sh DESCRIPTION +The +.Fn Pobjname +and +.Fn Pobjname_resolved +functions attempt to determine the underlying mapped object that +contains the virtual address +.Fa addr +in the process handle +.Fa P . +.Pp +A program consists of multiple memory mappings. Some are provided by the +system, such as the stack and the heap. While others are created through +explicit calls to +.Xr mmap 2 +or brought in by the run-time link-editor due to dependencies +specified in binaries and libraries. +.Pp +If +.Fa addr +is contained in a mapping, then up to +.Fa bufsize +characters, including the null terminator, +of the name of the corresponding object will be written into +.Fa buffer . +The +.Fn Pobjname_resolved +function attempts to resolve the object to a full file system path. If +the full file-system path cannot be determined, then it will fall back +to the name that the run-time link-editor has for that mapping, which is +the behavior of +.Fn Pobjname . +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pobjname +and +.Fn Pobjname_resolved +functions return +.Fa buffer . +Otherwise, +.Dv NULL +is returned to indicate the object name could not be found. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr mmap 2 , +.Xr libproc 3LIB , +.Xr Pobject_iter 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pplatform.3proc b/usr/src/man/man3proc/Pplatform.3proc new file mode 100644 index 0000000000..c17f9aabe9 --- /dev/null +++ b/usr/src/man/man3proc/Pplatform.3proc @@ -0,0 +1,90 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PPLATFORM 3PROC +.Os +.Sh NAME +.Nm Pplatform +.Nd get platform string +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "char *" +.Fo Pplatform +.Fa "struct ps_prochandle *P" +.Fa "char *buffer" +.Fa "size_t bufsize" +.Fc +.Sh DESCRIPTION +The +.Fn Pplatform +function determines the name of the platform for the process handle +.Fa P . +Up to +.Fa bufsize +characters, including the null terminator, will be copied into +.Fa buffer . +.Pp +The platform is the value reported by the +.Sy -s +option to +.Xr uname 1 . +For example, on x86 systems, the value will be +.Sy i86pc . +.Pp +Note, process handles that correspond to a file, created by +.Xr Pgrab_file 3PROC , +will not report a platform and the +.Fn Pplatform +function will fail. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pplatform +function returns +.Fa buffer . +Otherwise, +.Dv NULL +is returned, +.Sy errno +is set, and +.Fa buffer +is not updated. +.Sh ERRORS +The +.Fn Pplatform +function will fail if: +.Bl -tag -width Er +.It Er ENODATA +.Fa P +refers to a core file and there is no +.Sy NT_PLATFORM +ELF note available. +.It Er EFAULT +.Fa P +refers to a live process and +.Fa buffer +is an invalid address. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr uname 1 , +.Xr sysinfo 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Ppltdest.3proc b/usr/src/man/man3proc/Ppltdest.3proc new file mode 100644 index 0000000000..efdca692dc --- /dev/null +++ b/usr/src/man/man3proc/Ppltdest.3proc @@ -0,0 +1,62 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PPLTDEST 3PROC +.Os +.Sh NAME +.Nm Ppltdest +.Nd determine PLT destination symbol +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "const char *" +.Fo Ppltdest +.Fa "struct ps_prochandle *P" +.Fa "uintptr_t addr" +.Fc +.Sh DESCRIPTION +The +.Fn Ppltdest +function determines if the address at +.Fa addr +in the process handle +.Fa P +corresponds to an entry in the procedure linkage table (PLT) and if so, +returns a pointer to a null-terminated character string that contains +the symbol's name. The returned pointer is not valid after any other +calls to function in +.Xr libproc 3LIB . +The +.Fn Ppltdest +is also a useful way to determine if +.Fa addr +corresponds to an address in the PLT. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Ppltdest +returns a pointer to a character string with the name. Otherwise, +.Dv NULL +is returned. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB +.Rs +.%T Linkers and Libraries Guide +.Re diff --git a/usr/src/man/man3proc/Ppriv.3proc b/usr/src/man/man3proc/Ppriv.3proc new file mode 100644 index 0000000000..ae238eae67 --- /dev/null +++ b/usr/src/man/man3proc/Ppriv.3proc @@ -0,0 +1,77 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PPRIV 3PROC +.Os +.Sh NAME +.Nm Ppriv , +.Nm Ppriv_free +.Nd get and free process privilege sets +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Ppriv +.Fa "struct ps_prochandle *P" +.Fa "prpriv_t **pprv" +.Fc +.Ft void +.Fo Ppriv_free +.Fa "struct ps_prochandle *P" +.Fa "prpriv_t *prv" +.Fc +.Sh DESCRIPTION +The +.Fn Ppriv +function obtains the privilege set of the process handle +.Fa P . +The privilege set, if it exists, will be dynamically allocated and a +pointer to it will be placed in +.Fa pprv . +It must be released with a call to +.Fn Ppriv_free . +The definition of the +.Sy prpriv_t +structure is documented in +.Xr proc 4 . +.Pp +The +.Fn Ppriv_free +function releases the storage in +.Fa prv +that was allocated as a result of calling +.Fn Ppriv . +.Sh RETURN VALUES +Upon successful completion, the +.Fn Ppriv +function returns +.Sy 0 +and +.Fa pprv +is updated with a pointer to the allocated privilege set. Otherwise, +.Sy -1 +is returned and +.Fa pprv +is not updated. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 , +.Xr privileges 5 diff --git a/usr/src/man/man3proc/Ppsinfo.3proc b/usr/src/man/man3proc/Ppsinfo.3proc new file mode 100644 index 0000000000..f86572f9f6 --- /dev/null +++ b/usr/src/man/man3proc/Ppsinfo.3proc @@ -0,0 +1,56 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PPSINFO 3PROC +.Os +.Sh NAME +.Nm Ppsinfo +.Nd get process ps information +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "const psinfo_t *" +.Fo Ppsinfo +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Ppsinfo +function returns the process handle +.Fa P Ns 's +.Xr ps 1 +information. The +.Sy psinfo_t +structure that is returned is defined in +.Xr proc 4 +and is valid until a subsequent call to +.Xr Prelease 3PROC . +.Sh RETURN VALUES +Upon successful completion, the +.Fn Ppsinfo +function returns a pointer to the process ps information. Otherwise, +.Dv NULL +is returned to indicate that it could not be found. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr ps 1 , +.Xr libproc 3LIB , +.Xr Prelease 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Prd_agent.3proc b/usr/src/man/man3proc/Prd_agent.3proc new file mode 100644 index 0000000000..78438621c5 --- /dev/null +++ b/usr/src/man/man3proc/Prd_agent.3proc @@ -0,0 +1,61 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PRD_AGENT 3PROC +.Os +.Sh NAME +.Nm Prd_agent +.Nd get librtld_db agent +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "rd_agent_t *" +.Fo Prd_agent +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Prd_agent +function returns a pointer to an agent suitable for use with the +run-time link editing database library, +.Xr librtld_db 3PROC , +corresponding to the process handle +.Fa P . +.Pp +The returned agent is valid until either the process handle executes a +new process image through the +.Xr exec 2 +family of calls or the process handle +.Fa P +is released through a call to +.Xr Prelease 3PROC . +.Sh RETURN VALUES +Upon successful completion, the +.Fn Prd_agent +function returns a pointer to the librtld_db agent. Otherwise, it +returns +.Dv NULL +to indicate failure. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr exec 2 , +.Xr libproc 3LIB , +.Xr librtld_db 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pread.3proc b/usr/src/man/man3proc/Pread.3proc new file mode 100644 index 0000000000..8b4eb52da8 --- /dev/null +++ b/usr/src/man/man3proc/Pread.3proc @@ -0,0 +1,113 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PREAD 3PROC +.Os +.Sh NAME +.Nm Pread , +.Nm Pread_string +.Nd read data from a process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft ssize_t +.Fo Pread +.Fa "struct ps_prochandle *P" +.Fa "void *buf" +.Fa "size_t nbytes" +.Fa "uintptr_t address" +.Fc +.Ft ssize_t +.Fo Pread_string +.Fa "struct ps_prochandle *P" +.Fa "char *buf" +.Fa "size_t nbytes" +.Fa "uintptr_t address" +.Fc +.Sh DESCRIPTION +The +.Fn Pread +function reads data from the process handle +.Fa P +starting at +.Fa address +in the address space of the process and reads at most +.Fa nbytes +of data into +.Fa buf +and is logically analogous to the +.Xr pread 2 +function. +.Pp +For live processes, this function is equivalent to reading from the +/proc file system +.Sy as +file for the process. For core files and file handles, it reads and +writes from the logical address space and not the corresponding offset +of the file itself. For example, a core file contains a sparse +representation of the address space of a crashed process and unmapped +regions are not present in the file. However, +.Fa address +still refers to the virtual addresses that were present at run-time and +not those in the core file. +.Pp +The +.Fn Pread_string +function is similar to the +.Fn Pread +function, except that it attempts to interpret +.Fa address +as a null terminated character string and will stop reading characters +into +.Fa buf +if either +.Fa nbytes +has been read or a null terminator is encountered. The resulting data in +.Fa buf +will always be null terminated, even if no null terminator was found in +the first +.Fa nbytes +of data. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pread +and +.Fn Pread_string +functions return a non-negative integer indicating the number of bytes +actually read. Otherwise, the functions return +.Sy -1 +and set +.Sy errno +to indicate the error. +.Sh ERRORS +For a full list of possible errors also see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 +and +the +.Sy ERRORS +section in +.Xr pread 2 . +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr pread 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Prelease.3proc b/usr/src/man/man3proc/Prelease.3proc new file mode 100644 index 0000000000..d201d198ac --- /dev/null +++ b/usr/src/man/man3proc/Prelease.3proc @@ -0,0 +1,114 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PRELEASE 3PROC +.Os +.Sh NAME +.Nm Prelease , +.Nm Pfree +.Nd release a process control handle +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft void +.Fo Prelease +.Fa "struct ps_prochandle *P" +.Fa "int flags" +.Fc +.Ft void +.Fo Pfree +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Prelease +function is used to release all of the resources associated with a +.Nm libproc +handle. It is suitable for handles to core files, created processes, and +grabbed processes from the +.Xr Pgrab_core 3PROC , +.Xr Pcreate 3PROC , +.Xr Pgrab 3PROC , +and +.Xr Pgrab_file 3PROC +functions. +.Pp +After calling the +.Fn Prelease +function, all data that was returned via the handle will no longer be +valid. For example, the data from calls to +.Xr Pctlfd 3PROC , +.Xr Pgetauxvec 3PROC , +.Xr Pstatus 3PROC , +and others. +.Pp +The behavior of the released process is controlled by the +.Fa flags +argument. By default, if no flags are passed, then the process +represented by +.Fa P +will be set running if it was created by +.Xr Pcreate +or if it was not originally stopped or set to stop in /proc. The +following values may be passed in to the +.Fa flags +argument. Multiple flags should be be combined with a +bitwise-inclusive-OR. +.Bl -tag -width Er -offset indent +.It Dv PRELEASE_CLEAR +When releasing the process, clear all tracing flags that are set on the +process. +.It Dv PRELEASE_RETAIN +When releasing the process, retain all tracing flags that are currently +active on the process. +.It Dv PRELEASE_HANG +Leave the process stopped. It will not resume execution unless it is +explicitly enabled with +.Xr prun 1 +or another process explicitly enables it. +.It Dv PRELEASE_KILL +Release the process and terminate it with +.Dv SIGKILL . This option takes precedence over all other values that may +be passed in to +.Fa flags . +.El +.Pp +The +.Fn Pfree +function is similar to the +.Fn Prelease +function in that it frees the resources associated with the process +handle +.Fa P ; +however, unlike the +.Fn Prelease +function, it does not handle any logic to change or set the grabbed processes +state. In general, prefer +.Fn Prelease +to +.Fn Pfree . +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr prun 1 , +.Xr libproc 3LIB , +.Xr Pcreate 3PROC , +.Xr Pgrab 3PROC , +.Xr Pgrab_core 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Preopen.3proc b/usr/src/man/man3proc/Preopen.3proc new file mode 100644 index 0000000000..6343a56f12 --- /dev/null +++ b/usr/src/man/man3proc/Preopen.3proc @@ -0,0 +1,72 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PREOPEN 3PROC +.Os +.Sh NAME +.Nm Preopen +.Nd reopen a process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Preopen +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Preopen +function is used to regain control of the process represented by the +handle +.Fa P . +A loss of control is indicated by the +.Xr Pstatus 3PROC +function returning the value +.Dv PS_LOST . +This may occur when the controlled process performs an +.Xr exec 2 +of a setuid or setgid binary or one where the controlling process cannot +read the object file. For more information on this, see the +.Sy PROGRAMMING NOTES +section of +.Xr proc 4 . +.Pp +If successful, the controlling process will obtain control of the +process specified by +.Fa P . +If it fails, the controlling process should release the handle with +.Xr Prelease 3PROC . +Note there are occasions where due to permissions it may not be possible +to obtain control again. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Preopen +function returns +.Sy 0. +Otherwise, +.Sy -1 +is returned. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr exec 2 , +.Xr libproc 3LIB , +.Xr Prelease 3PROC , +.Xr Pstatus 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Preset_maps.3proc b/usr/src/man/man3proc/Preset_maps.3proc new file mode 100644 index 0000000000..c842757319 --- /dev/null +++ b/usr/src/man/man3proc/Preset_maps.3proc @@ -0,0 +1,55 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PRESET_MAPS 3PROC +.Os +.Sh NAME +.Nm Preset_maps +.Nd reset memory mapping data after exec +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft void +.Fo Preset_maps +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Preset_maps +function resets all of the mapping data, cached symbol tables, debug +information, CTF, and more in the process handle +.Fa P . +The map information will rebuild itself on the execution of another +.Xr libproc 3LIB +function that requires the information. +This function should be called any time after a process handle performs +an +.Xr exec 2 . +As such, this interface is only relevant to the manipulation of live +processes and not core files or ELF files. +For more information, see the +.Sy PROGRAMMING NOTES +section in +.Xr libproc 3LIB . +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr exec 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Psetbkpt.3proc b/usr/src/man/man3proc/Psetbkpt.3proc new file mode 100644 index 0000000000..1d0992d298 --- /dev/null +++ b/usr/src/man/man3proc/Psetbkpt.3proc @@ -0,0 +1,93 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSETBKPT 3PROC +.Os +.Sh NAME +.Nm Psetbkpt +.Nd set a breakpoint trap in a process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Psetbkpt +.Fa "struct ps_prochandle *P" +.Fa "uintptr_t address" +.Fa "ulong_t *saved" +.Fc +.Sh DESCRIPTION +The +.Fn Psetbkpt +function sets a breakpoint instruction at the address +.Fa address +in the process handle +.Fa P . +The instruction that used to be set will be set in +.Fa saved +and should be retained. +.Pp +A breakpoint will remain in place until a subsequent call to +.Xr Pdelbkpt 3PROC . +The value stored in +.Fa saved +should be passed as the third argument to +.Xr Pdelbkpt 3PROC . +.Pp +When a process executes an instruction that has been replaced with a +breakpoint it generates a +.Sy FLTBPT +trap +causing the thread to stop. +.Pp +Note, breakpoints may only be set in active processes. They may not be +set in process handles that refer to core files, zombie processes, or +files. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Psetbkpt +function sets the breakpoint and +returns +.Sy 0 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to indicate the error. +.Sh ERRORS +For a full list of possible errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Psetbkpt +function will fail if: +.Bl -tag -width Er +.It Er ENOENT +.Fa P +does not refer to an active process. +.It Er EBUSY +A breakpoint instruction was already written by another debugger. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pdelbkpt 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Psetcred.3proc b/usr/src/man/man3proc/Psetcred.3proc new file mode 100644 index 0000000000..4cd9e214b5 --- /dev/null +++ b/usr/src/man/man3proc/Psetcred.3proc @@ -0,0 +1,65 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSETCRED 3PROC +.Os +.Sh NAME +.Nm Psetcred +.Nd set process credentials +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Psetcred +.Fa "struct ps_prochandle *P" +.Fa "const prcred_t *credp" +.Fc +.Sh DESCRIPTION +The +.Fn Psetcred +function updates the credentials of the process handle +.Fa P +to the values set in +.Fa credp . +.Fa credp +must be fully initialized. The definition of the +.Sy prcred_t +structure may be found in +.Xr proc 4 . +.Pp +Note, the credentials may only be updated for an active process. If the +process handle refers to a zombie process, core file, or a file, then +.Fn Psetcred +will fail. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Psetcred +function returns +.Sy 0 +and updates the credentials of the process +.Fa P . +Otherwise, +.Sy -1 +is returned. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pcred 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Psetfault.3proc b/usr/src/man/man3proc/Psetfault.3proc new file mode 100644 index 0000000000..4a3200762b --- /dev/null +++ b/usr/src/man/man3proc/Psetfault.3proc @@ -0,0 +1,61 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSETFAULT 3PROC +.Os +.Sh NAME +.Nm Psetfault +.Nd set fault tracing flags +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft void +.Fo Psetfault +.Fa "struct ps_prochandle *P" +.Fa "const fltset_t *set" +.Fc +.Sh DESCRIPTION +The +.Fn Psetfault +function sets the fault tracing flags on the process handle +.Fa P +to +.Fa set . +It replaces any existing fault tracing flags on the process. These +flags indicate which faults cause execution of the thread to stop. +Allowing another tool, such as a debugger, to act upon the process. +For more information on faults and the +.Sy fltset_t +structure see the +.Sy PCSFAULT +section in +.Xr proc 4 . +The current fault set for the process may be obtained through the +.Xr Pfault 3PROC +function. +.Pp +Note, only active processes may have their fault set updated. Process +handles that refer to core files, zombie processes, and files do not +have fault tracing flags and this function is a no-op on them. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pfault 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Psetflags.3proc b/usr/src/man/man3proc/Psetflags.3proc new file mode 100644 index 0000000000..8a1783b738 --- /dev/null +++ b/usr/src/man/man3proc/Psetflags.3proc @@ -0,0 +1,105 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSETFLAGS 3PROC +.Os +.Sh NAME +.Nm Psetflags +.Nm Punsetflags +.Nd set and unset process flags +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Psetflags +.Fa "struct ps_prochandle *P" +.Fa "long flags" +.Fc +.Ft int +.Fo Punsetflags +.Fa "struct ps_prochandle *P" +.Fa "long flags" +.Fc +.Sh DESCRIPTION +The +.Fn Psetflags +and +.Fn Punsetflags +functions manipulate the process flags for the process handle +.Fa P . +The process flags determine how the process behaves in the face of +various actions. For example, setting the +.Sy PR_FORK +flag indicates that the tracing flags of the process and the +inherit-on-fork mode should be set on children. A full list of the +process flags is available in the +.Sy PCSET +section in +.Xr proc 4 . +.Pp +The +.Fn Psetflags +function sets the flags specified in +.Fa flags +by doing a bitwise-inclusive-OR with the previously set flags. +.Pp +The +.Fn Punsetflags +function removes the flags specified in +.Fa flags +from the tracing flags of the process. Items not listed in +.Fa flags +will remain. +.Pp +To see the current set of flags active on the process, check the +.Sy pr_flags +member of the +.Sy pstatus_t +for the process. It can be obtained through the +.Xr Pstatus 3PROC +function. +.Pp +Note, attempting to modify the process flags only works on active +processes. Attempting to call these functions of process handles +corresponding to core files, zombie processes, or files, will result in +an error. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Psetflags +and +.Fn Punsetflags +functions return +.Sy 0 . +Otherwise, +.Sy -1 +is returned +and +.Sy errno +is set to indicate the error. +.Sh ERRORS +For a full list of possible errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pstatus 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Psetpriv.3proc b/usr/src/man/man3proc/Psetpriv.3proc new file mode 100644 index 0000000000..d2a0dbc08c --- /dev/null +++ b/usr/src/man/man3proc/Psetpriv.3proc @@ -0,0 +1,87 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSETPRIV 3PROC +.Os +.Sh NAME +.Nm Psetpriv +.Nd set process privileges +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Psetpriv +.Fa "struct ps_prochandle *P" +.Fa "prpriv_t *pprv" +.Fc +.Sh DESCRIPTION +The +.Fn Psetpriv +function updates the privileges of the process handle +.Fa P +to the set described by +.Fa pprv . +The updated privilege set has restrictions on what it may change for a +process which are documented in the +.Sy PCSPRIV +section of +.Xr proc 4 . +In addition, the definition of the +.Sy prpriv_t +structure is described in +.Xr proc 4 . +.Pp +The current privilege set for the process may be obtained through a call +to +.Xr Ppriv 3PROC . +.Pp +Note, the privilege set may only be updated for active processes. +Process handles which correspond to core files, zombie processes, and +files, may not have their privilege sets updated. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Psetpriv +function returns +.Sy 0 +and updates the privilege sets of the process. Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to indicate the error. +.Sh ERRORS +For a full list of possible errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Psetpriv +function will fail if: +.Bl -tag -width Er +.It Er EBADF +.Fa P +doesn't refer to an active process, but a core file, zombie, or a file. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Ppriv 3PROC , +.Xr proc 4 , +.Xr privileges 5 diff --git a/usr/src/man/man3proc/Psetrun.3proc b/usr/src/man/man3proc/Psetrun.3proc new file mode 100644 index 0000000000..6a063d6dd9 --- /dev/null +++ b/usr/src/man/man3proc/Psetrun.3proc @@ -0,0 +1,152 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSETRUN 3PROC +.Os +.Sh NAME +.Nm Psetrun , +.Nm Lsetrun +.Nd run a stopped process or thread +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Psetrun +.Fa "struct ps_prochandle *P" +.Fa "int sig" +.Fa "int flags" +.Fc +.Ft int +.Fo Lsetrun +.Fa "struct ps_lwphandle *L" +.Fa "int sig" +.Fa "int flags" +.Fc +.Sh DESCRIPTION +The +.Fn Psetrun +function resumes the stopped process handle +.Fa P +and transitions the process to running. +If +.Fa sig +is non-zero, then the +.Fn Psetrun +function causes the signal to be delivered. See +.Xr signal.h 3HEAD +for a list of valid signal identifiers. +.Pp +The +.Fa flags +member modifies the behavior of the resumed handle. The following values +may be combined by a bitwise-inclusive-OR: +.Bl -tag -width Dv -offset indent +.It Dv PRCSIG +Clears the current signal, if any. +.It Dv PRCFAULT +Clears the current fault, if any. +.It Dv PRSTEP +Indicates that the thread should single-step over the next machine +instruction and upon completion, inject a trap. For the specific +mechanics of single-stepping and what traps or signals will be injected, +see the +.Sy PRSTEP +section of +.Xr proc 4 . +.It Dv PRSABORT +Indicates that the thread should abort the system call that it is +currently executing. This is only valid if the thread is stopped because +it is asleep or right before a system call. This will cause the system +call to return +.Er EINTR . +.El +.Pp +If +both +.Dv PRCSIG +is specified and +.Fa sig +is non-zero, then the +.Dv PRCSIG +request takes priority, and it will be treated as though +.Fa sig +was passed the argument +.Sy 0 . +.Pp +When the process is resumed all extent tracing flags and register +changes will be synchronized with the process. For more information on +resuming a thread see the +.Sy PCRUN +section in +.Xr proc 4 . +.Pp +Note, the +.Fn Psetrun +function is only valid for active processes. It will fail on process +handles that refer to core files, zombie processes, and ELF objects. +.Pp +The +.Fn Lsetrun +function is equivalent to the +.Fn Psetrun +function, except rather than operating on a process it operates on a +thread. +.Fn Lsetrun +causes the specified thread, +.Fa L , +to resume execution. Whereas +.Fn Psetrun +causes all threads in the process to resume. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Psetrun +and +.Fn Lsetrun +functions return +.Sy 0 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to indicate the error. +.Sh ERRORS +For a full list of possible errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Psetrun +and +.Fn Lsetrun +functions will fail if: +.Bl -tag -width Er +.It Er EBUSY +The process handle +.Fa P +is not currently stopped or it is not stopped due to an event of +interest, a directed stop, or it is asleep in a system call. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr signal.h 3HEAD , +.Xr libproc 3LIB , +.Xr Pstatus 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Psetsignal.3proc b/usr/src/man/man3proc/Psetsignal.3proc new file mode 100644 index 0000000000..c861788570 --- /dev/null +++ b/usr/src/man/man3proc/Psetsignal.3proc @@ -0,0 +1,71 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSETSIGNAL 3PROC +.Os +.Sh NAME +.Nm Psetsignal +.Nd set signal tracing flags +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft void +.Fo Psetsignal +.Fa "struct ps_prochandle *P" +.Fa "const sigset_t *set" +.Fc +.Sh DESCRIPTION +The +.Fn Psetsignal +function sets the signal tracing flags for the process handle +.Fa P +to +.Fa set . +The call to +.Fn Psetsignal +replaces any existing signal tracing flags entirely with +.Fa set . +The signal tracing flags determine which signals, when received by a +thread in the process, will cause that thread to stop. For more +information on the behavior of the signal tracing flags, including which +signals may be traced this way, see the +.Sy PCSTRACE +section in +.Xr proc 4 . +.Pp +The +.Fa set +argument may be manipulated with the standard signal set manipulation +functions such as +.Xr sigaddset 3C , +.Xr sigdelset 3C , +and others which may all be found in +.Xr sigsetops 3C . +.Pp +Note, only active processes may have their signal tracing flags updated. +Process handles that refer to core files, zombie processes, and files do +not have fault tracing flags and this function is a no-op on them. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr sigsetops 3C , +.Xr signal.h 3HEAD , +.Xr libproc 3LIB , +.Xr Psignal 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Psetsysentry.3proc b/usr/src/man/man3proc/Psetsysentry.3proc new file mode 100644 index 0000000000..f8759937d3 --- /dev/null +++ b/usr/src/man/man3proc/Psetsysentry.3proc @@ -0,0 +1,72 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSETSYSENTRY 3PROC +.Os +.Sh NAME +.Nm Psetsysentry , +.Nm Psetsysexit +.Nd set system call tracing flags +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft void +.Fo Psetsysentry +.Fa "struct ps_prochandle *P" +.Fa "const sysset_t *set" +.Fc +.Ft void +.Fo Psetsysexit +.Fa "struct ps_prochandle *P" +.Fa "const sysset_t *set" +.Fc +.Sh DESCRIPTION +The +.Fn Psetsysentry +and +.Fn Psetsysexit +set the system call entry and exit tracing flags respectively in the +process handle +.Fa P +to +.Fa set . +The call to +.Fn Psetsysentry +or +.Fn Psetsysexit +replaces the corresponding set of system call tracing flags entirely +with the new set. The system call entry tracing flags cause a thread to +stop on entry to the system call and the exit tracing flags cause a +thread to stop on return from the system call, before control returns +back to the user land process. For more information on the state of the +thread and for information on manipulating the +.Sy sysset_t , +see +.Xr proc 4 . +.Pp +Note that only active processes may have their system call tracing flags +updated. Process handles that refer to core files, zombie processes, +and files do not have fault tracing flags and this function is a no-op +on them. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr Intro 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Psetwapt.3proc b/usr/src/man/man3proc/Psetwapt.3proc new file mode 100644 index 0000000000..1751f04fb9 --- /dev/null +++ b/usr/src/man/man3proc/Psetwapt.3proc @@ -0,0 +1,84 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSETWAPT 3PROC +.Os +.Sh NAME +.Nm Psetwapt +.Nd set a watchpoint in a process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Psetwapt +.Fa "struct ps_prochandle *P" +.Fa "const prwatch_t *wp" +.Fc +.Sh DESCRIPTION +The +.Fn Psetwapt +function adds a watchpoint to the process handle +.Fa P . +Allowing the hardware to generate a trap when the specified area is +accessed. The watchpoint's parameters are described in +.Fa wp . +For more information on watchpoints and the +.Sy prwatch_t +structure, see the +.Sy PCWATCH +section in +.Xr proc 4 . +The watched area will persist until a subsequent call to +.Xr Pdelwapt 3PROC . +.Pp +Note, only active processes support watchpoints. It is an error to call +this function on process handles that correspond to core files, zombie +processes, or files. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Psetwapt +function returns +.Sy 0 +and installs the watchpoint in +.Fa P . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set. +.Sh ERRORS +For a full list of possible errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Psetwapt +function will fail if: +.Bl -tag -width Er +.It Er ENOENT +.Fa P +does not refer to an active process. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pdelwapt 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Psetzoneid.3proc b/usr/src/man/man3proc/Psetzoneid.3proc new file mode 100644 index 0000000000..4d163c8b17 --- /dev/null +++ b/usr/src/man/man3proc/Psetzoneid.3proc @@ -0,0 +1,103 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSETZONEID 3PROC +.Os +.Sh NAME +.Nm Psetzoneid +.Nd change processes zone id +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Psetzoneid +.Fa "struct ps_prochandle *P" +.Fa "zoneid_t zoneid" +.Fc +.Sh DESCRIPTION +The +.Fn Psetzoneid +function moves the process handle +.Fa P +into the zone specified by +.Fa zoneid . +A process that is in the non-global zone may only move between the +global zone and its original zone. A process that is in the global zone +may not use this interface to enter a non-global zone. This function +will fail if called from a non-global zone. This function only +manipulates the processes credentials. +.Pp +Care should be taken when moving a process around temporarily, such that +if the process that is manipulating +.Fa P +dies, it does not cause +.Fa P +to resume running while still in the global zone. It is suggested that +the +.Sy PR_KLC +flag is set with +.Xr Psetflags 3PROC +which will cause the process to terminate if the process that holds +.Fa P +unexpectedly terminates. See +.Xr proc 4 +for more information on the +.Sy PR_KLC +flag. +.Pp +Note, only active processes may change their zone. It is an error to +call this function on process handles that correspond to core files, +zombie processes, or files. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Psetzoneid +function returns +.Sy 0 +and changes the zone for +.Fa P . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set. +.Sh ERRORS +For a full list of possible errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Psetzoneid +function will fail if: +.Bl -tag -width Er +.It Er EINVAL +.Fa zoneid +does not correspond to an existing zone or the zone id is not the global +zone or the original zone of +.Fa P . +.It Er EPERM +The caller does not hold the required privileges for zone configuration. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 , +.Xr privileges 5 , +.Xr zones 5 diff --git a/usr/src/man/man3proc/Psignal.3proc b/usr/src/man/man3proc/Psignal.3proc new file mode 100644 index 0000000000..1930c1583e --- /dev/null +++ b/usr/src/man/man3proc/Psignal.3proc @@ -0,0 +1,102 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSIGNAL 3PROC +.Os +.Sh NAME +.Nm Psignal +.Nd set signal tracing action +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Psignal +.Fa "struct ps_prochandle *P" +.Fa "int which" +.Fa "int stop" +.Fc +.Sh DESCRIPTION +The +.Fn Psignal +function sets the signal tracing flag for the process handle +.Fa P . +If +.Fa stop +is +.Sy non-zero +it causes the process handle to stop threads that encounter the signal +.Fa which . +If +.Fa stop +is +.Sy zero , +then it disables tracing for the signal +.Fa which . +.Pp +The signal constants, representing valid values for +.Fa which , +can be found in +.Xr signal.h 3HEAD. +The signal +.Dv SIGKILL +may not be stopped. +.Pp +Note, only active processes may have their signal tracing flags updated. +Process handles that refer to core files, zombie processes, and files do +not have signal tracing flags. Calling this function on them is an error. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Psignal +function returns the previous disposition of the signal +.Fa which . +It returns +.Sy 1 +if it was set and +.Sy 0 +if not. Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to indicate the error. +.Sh ERRORS +The +.Fn Psignal +function will fail if: +.Bl -tag -width Er +.It Er EINVAL +.Fa which +is +.Dv SIGKILL +and +.Fa stop +is non-zero . +.Pp +.Fa which +is not a valid signal. +.It Er ENOENT +.Fa P +does not correspond to an active process. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr signal.h 3HEAD , +.Xr libproc 3LIB , +.Xr Psetsignal 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pstack_iter.3proc b/usr/src/man/man3proc/Pstack_iter.3proc new file mode 100644 index 0000000000..75ffdba1f3 --- /dev/null +++ b/usr/src/man/man3proc/Pstack_iter.3proc @@ -0,0 +1,124 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSTACK_ITER 3PROC +.Os +.Sh NAME +.Nm Pstack_iter +.Nd iterate process stack frames +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pstack_iter +.Fa "struct ps_prochandle *P" +.Fa "const prgregset_t regs" +.Fa "proc_stack_f *func" +.Fa "void *data" +.Fc +.Sh DESCRIPTION +The +.Fn Pstack_iter +function iterates over the stack frames in the process +.Fa P +starting at the point defined by +.Fa regs . +.Pp +For each valid stack frame encountered, the callback function +.Fa func +is invoked with +.Fa data +passed as argument. The full signature of +.Ft proc_stack_f +is defined in +.Xr libproc 3LIB . +With each callback, a register set, argument set, and argument count +will be provided. In that register set, only a subset of the registers +will be valid, which include the frame pointer, program counter, and on +SPARC systems, the next program counter. These registers can be accessed +with the constants +.Sy R_FP , +.Sy R_PC , +and +.Sy R_nPC +respectively. These correspond to the registers +.Em %ebp +and +.Em %eip +on i386, +.Em %rbp +and +.Em %rip +on amd64, +.Em %fp , +.Em %pc , +and +.Em %npc +on both SPARC and SPARCv9. +.Pp +Callers will receive a callback for the first stack frame indicated by +.Fa regs +and then will receive a subsequent callback for each caller of that +frame until no such frame can be found. Stack frames that logically come +after the frame indicated by +.Fa regs +will not receive callbacks. +.Pp +The compiler can either facilitate or stymie the iteration of the +stack. Programs that have been compiled in such a way as to omit the +frame pointer will result in truncated stacks. Similarly, if the initial +set of registers passed in via +.Fa regs +is invalid, then the ability to iterate the stack will be limited. +The return value of +.Fa func +controls whether or not iteration continues. If +.Fa func +returns +.Sy 0 +then iteration continues. However, if +.Fa func +returns non-zero, then iteration will halt and that value will be used +as the return value of the +.Fn Pstack_iter +function. Because +.Fn Pstack_iter +returns +.Sy -1 +on internal failure it is recommended the callback function not return +.Sy -1 +to indicate an error. Thus the caller may distinguish between the +failure of the callback function and the failure of the +.Fn Pstack_iter +function. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pstack_iter +function returns +.Sy 0. +If there was an internal error then +.Sy -1 +is returned. Otherwise, if the callback function +.Fa func +returns non-zero, then its return value will be returned instead. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pstate.3proc b/usr/src/man/man3proc/Pstate.3proc new file mode 100644 index 0000000000..9ec03c0c83 --- /dev/null +++ b/usr/src/man/man3proc/Pstate.3proc @@ -0,0 +1,46 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSTATE 3PROC +.Os +.Sh NAME +.Nm Pstate +.Nd obtain process handle state +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pstate +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Pstate +function returns the state of the process handle +.Fa P . +The list of states is available in the +.Sy PROCESS STATES +section in +.Xr libproc 3LIB . +.Sh RETURN VALUES +Upon successful completion, the current state is returned. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB diff --git a/usr/src/man/man3proc/Pstatus.3proc b/usr/src/man/man3proc/Pstatus.3proc new file mode 100644 index 0000000000..6079c01b05 --- /dev/null +++ b/usr/src/man/man3proc/Pstatus.3proc @@ -0,0 +1,58 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSTATUS 3PROC +.Os +.Sh NAME +.Nm Pstatus +.Nd obtain process status structure +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "const pstatus_t *" +.Fo Pstatus +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Pstatus +function returns the status information about the process handle +.Fa P . +The +.Sy pstatus_t +structure is defined in +.Xr proc 4 +and contains information about the process including its flags, the +number of threads, the size of the stack, and more. +.Pp +The returned pointer is only valid as long as the process handle +.Fa P +is valid. After a call to +.Xr Prelease 3PROC , +the returned data pointer is invalid. +.Sh RETURN VALUES +The +.Fn Pstatus +function always returns a pointer to the process's status. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Prelease 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pstopstatus.3proc b/usr/src/man/man3proc/Pstopstatus.3proc new file mode 100644 index 0000000000..12eeb3366f --- /dev/null +++ b/usr/src/man/man3proc/Pstopstatus.3proc @@ -0,0 +1,235 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSTOPSTATUS 3PROC +.Os +.Sh NAME +.Nm Pdstop , +.Nm Pstopstatus , +.Nm Pstop , +.Nm Pwait , +.Nm Ldstop +.Nm Lstop , +.Nm Lwait +.Nd process and thread stop operations +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Pdstop +.Fa "struct ps_prochandle *P" +.Fc +.Ft int +.Fo Pstopstatus +.Fa "struct ps_prochandle *P" +.Fa "long request" +.Fa "uint_t msec" +.Fc +.Ft int +.Fo Pstop +.Fa "struct ps_prochandle *P" +.Fc +.Ft int +.Fo Pwait +.Fa "struct ps_prochandle *P" +.Fc +.Ft int +.Fo Ldstop +.Fa "struct ps_lwphandle *L" +.Fc +.Ft int +.Fo Lstop +.Fa "struct ps_lwphandle *L" +.Fc +.Ft int +.Fo Lwait +.Fa "struct ps_lwphandle *L" +.Fc +.Sh DESCRIPTION +The +.Fn Pstopstatus +function allows the caller to stop and optionally wait for the process +handle referred to by +.Fa P +to be stopped. Stopping a process causes all of its threads to stop +execution. Where in their execution the threads will halt is not +defined. Threads may be resumed with +.Xr Psetrun 3PROC +and +.Xr prun 1 . +.Pp +The +.Fa request +argument should be one of the following symbols: +.Bl -tag -width Dv -offset indent +.It Dv PCSTOP +Stop the process; wait for completion before returning. +.It Dv PCDSTOP +Stop the process; do not wait for completion before returning. That +is, the stopping of the process is performed asynchronously in +relation to the caller. +.It Dv PCWSTOP +Do not direct the process to stop; simply wait for it to stop. +.It Dv PCNULL +Do not direct the process to stop; simply refreshes the state of the +process. +.El +.Pp +Both the +.Dv PCSTOP +and +.Dv PCWSTOP +requests allow an upper bound on the amount of time to wait for the +process to stop. The +.Fa msec +argument indicates the number of milliseconds to wait for the stop to +complete. If the value of +.Fa msec +is +.Sy 0 , +then it will wait forever. Callers should pass +.Sy 0 +for +.Fa msec +when the request is +.Dv PCDSTOP +or +.Dv PCNULL . +.Pp +When a non-zero timeout is specified, the process may or may not be +stopped upon return. The return value does not reflect the current +state of the process. For example, if the timeout expires during a +.Fa PCWSTOP +request, the return value will be +.Sy 0 +regardless of the actual state of the process. +.Pp +Only active processes may be stopped. Handles that refer to core +files, zombie processes, or files cannot be used; unless the value of +.Fa request +is set to +.Dv PCNULL . +.Pp +The +.Fn Pstop +function is is equivalent to calling the +.Fn Pstopstatus +function with the request set to +.Dv PCSTOP +and an infinite timeout. +.Pp +The +.Fn Pwait +function is is equivalent to calling the +.Fn Pstopstatus +function with the request set to +.Dv PCWSTOP +and an infinite timeout. +.Pp +The +.Fn Pdstop +function is is equivalent to calling the +.Fn Pstopstatus +function with the request set to +.Dv PCDSTOP . +.Pp +The +.Fn Ldstop , +.Fn Lstop , +and +.Fn Lwait +functions are equivalent to the +.Fn Pdstop , +.Fn Pstop , +and +.Fn Pwait +functions, respectively. Except, rather than operating on a process, +they operate on the thread handle +.Fa L . +A call to +.Fn Lstop +stops only a single thread; whereas +.Fn Pstop +stops every thread in the process. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pdstop , +.Fn Pstopstatus , +.Fn Pstop , +.Fn Pwait , +.Fn Ldstop , +.Fn Lstop , +and +.Fn Lwait +functions return +.Sy 0 . +Otherwise, +.Sy -1 +is returned and +.Dv errno +is set to indicate the error that occurred. +.Sh ERRORS +For a full list of possible errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Pdstop , +.Fn Pstopstatus , +.Fn Pstop , +.Fn Pwait , +.Fn Ldstop , +.Fn Lstop , +and +.Fn Lwait +functions will fail if: +.Bl -tag -width Er +.It Er EAGAIN +Control over the handle +.Fa P +was lost. Callers should call +.Xr Preopen 3PROC . +For more information on losing control, see +.Sy PROGRAMMING NOTES +in +.Xr proc 4 . +.It Er ENOENT +The request was not +.Dv PCNULL +and the process handle +.Fa P +does not refer to an active process, but refers to a core file, a zombie +process, or a file. +.It Er EINVAL +.Fa request +is not valid or the process is in an unknown state. +.It Er EPROTO +A fatal protocol error occurred and the process could not be stopped. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Lgrab 3PROC , +.Xr Pcreate 3PROC , +.Xr Pgrab 3PROC , +.Xr Pgrab_core 3PROC , +.Xr Pgrab_file 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Psymbol_iter.3proc b/usr/src/man/man3proc/Psymbol_iter.3proc new file mode 100644 index 0000000000..37b14ce822 --- /dev/null +++ b/usr/src/man/man3proc/Psymbol_iter.3proc @@ -0,0 +1,270 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSYMBOL_ITER 3PROC +.Os +.Sh NAME +.Nm Psymbol_iter , +.Nm Psymbol_iter_by_addr , +.Nm Psymbol_iter_by_lmid , +.Nm Psymbol_iter_by_name , +.Nm Pxsymbol_iter +.Nd iterate symbols in a process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Psymbol_iter +.Fa "struct ps_prochandle *P" +.Fa "const char *object_name" +.Fa "int which" +.Fa "int mask" +.Fa "proc_sym_f *func" +.Fa "void *data" +.Fc +.Ft int +.Fo Psymbol_iter_by_addr +.Fa "struct ps_prochandle *P" +.Fa "const char *object_name" +.Fa "int which" +.Fa "int mask" +.Fa "proc_sym_f *func" +.Fa "void *data" +.Fc +.Ft int +.Fo Psymbol_iter_by_lmid +.Fa "struct ps_prochandle *P" +.Fa "Lmid_t lmid" +.Fa "const char *object_name" +.Fa "int which" +.Fa "int mask" +.Fa "proc_sym_f *func" +.Fa "void *data" +.Fc +.Ft int +.Fo Psymbol_iter_by_name +.Fa "struct ps_prochandle *P" +.Fa "const char *object_name" +.Fa "int which" +.Fa "int mask" +.Fa "proc_sym_f *func" +.Fa "void *data" +.Fc +.Ft int +.Fo Pxsymbol_iter +.Fa "struct ps_prochandle *P" +.Fa "Lmid_t lmid" +.Fa "const char *object_name" +.Fa "int which" +.Fa "int mask" +.Fa "proc_xsym_f *func" +.Fa "void *data" +.Fc +.Sh DESCRIPTION +The +.Fn Psymbol_iter , +.Fn Psymbol_iter_by_addr , +.Fn Psymbol_iter_by_lmid , +.Fn Psymbol_iter_by_name , +and +.Fn Pxsymbol_iter +functions are used to iterate over the symbols present in the process +referred to by the handle +.Fa P . +For each symbol found, the callback function +.Fa func +will be called once and the argument +.Fa data +will be passed to it along with an ELF symbol entry in the form of the +.Sy GElf_Sym +along with the name of the symbol, if known. +In the case of the +.Fn Pxsymbol_iter +function an additional +.Sy prsyminfo_t +argument will be provided to the callback. The definitions of +.Sy proc_sym_f , +.Sy proc_xsym_f , +and +.Sy prsyminfo_t +are found in +.Xr libproc 3LIB . +.Pp +The +.Fa object_name +argument names the object that is a part of the controlled process which +will be searched for symbols. Only one object may be searched at any +given time. Valid object names may be obtained through the +.Xr Pobjname 3PROC +and +.Xr Pobject_iter 3PROC +functions, among others. The system also has two special object names +that may be passed in to refer to the objects of the executable file and +for ld.so.1. The symbol +.Dv PR_OBJ_EXEC +refers to the executables object and the symbol +.Dv PR_OBJ_LDSO +refers to the object ld.so.1. +.Pp +The +.Fa which +argument controls which of two possible symbol tables will be searched. +If the argument is +.Dv PR_SYMTAB +then the ELF symbol table will be searched. Otherwise, if it is +.Dv PR_DYNSYM +then the symbol table associated with the dynamic section will be +searched instead. If any other value is specified for +.Fa which , +then an error will be returned. +.Pp +The +.Fa mask +argument controls which symbols will be included. The +.Fa mask +argument allows for control over both the symbol's binding and the +symbol's type. These flags logically correspond to the various ELF +symbol bindings and types. The following values may be passed as a +bitwise-inclusive-OR into the +.Fa flags +argument: +.Bl -tag -width Dv -offset indent +.It Dv BIND_LOCAL +The symbol is a local symbol. Local symbols are not visible outside of +their object file. +.It Dv BIND_GLOBAL +The symbol is a global symbol. Global symbols are visible outside of +their object file and may be referred to by other ELF objects. +.It Dv BIND_WEAK +The symbol is a weak symbol. Weak symbols are visible outside of their +object file, but another definition of the symbol may be used instead. +.It Dv BIND_ANY +This is a combination of +.Dv BIND_LOCAL , +.Dv BIND_GLOBAL , +and +.Dv BIND_WEAK . +Every symbol's binding will match this value. +.It Dv TYPE_NOTYPE +The symbol's type is not specified. +.It Dv TYPE_OBJECT +The symbol refers to a data object. For example, variables. +.It Dv TYPE_FUNC +The symbol refers to a function. +.It Dv TYPE_SECTION +The symbol refers to an ELF section. +.It Dv TYPE_FILE +The symbol refers to the name of a source file associated with an object +file. +.It Dv TYPE_ANY +This is a combination of +.Dv TYPE_NOTYPE , +.Dv TYPE_OBJECT , +.Dv TYPE_FUNC , +.Dv TYPE_SECTION , +and +.Dv TYPE_FILE . +Every symbol's type will match this value. +.El +.Pp +To obtain all of the symbols in an object, the caller would pass the +expression +.Dv BIND_ANY | +.Dv TYPE_ANY +in as the value of +.Fa mask. +.Pp +The +.Fn Psymbol_iter_by_lmid +and +.Fn Pxsymbol_iter +functions allow for a link-map identifier to be specified in the +.Fa lmid +argument. This will restrict the search for the object specified in +.Fa object_name +to the specified link-map. There are three special link-map identifiers +that may be passed in. The symbol +.Dv PR_LMID_EVERY +indicates that every link-map should be searched. The symbol +.Dv LM_ID_BASE +indicates that the base link-map, the one that is used for the +executable should be searched. Finally, the symbol +.Dv LM_ID_LDSO +refers to the link-map that is used by the run-time link editor, +ld.so.1. The functions which do not allow a link-map identifier to be +specified always search every link-map. +.Pp +By default, symbols are iterated based on the order of the symbol +table being searched. However, it is also possible to iterate based on +the name of the symbol and based on the address of the symbol. To +iterate by name use the +.Fn Psymbol_iter_by_name +function. To iterate by address use the +.Fn Psymbol_iter_by_addr +function. The +.Fn Psymbol_iter , +.Fn Psymbol_iter_by_lmid , +and +.Fn Pxsymbol_iter +functions all sort based on the order of the symbol table. +.Pp +The return value of the callback function +.Fa func +determines whether or not iteration continues. If +.Fa func +returns +.Sy 0, +then iteration will continue. However, if +.Fa func +returns non-zero, then iteration will halt and that value will be used +as the return value of the +.Fn Psymbol_iter , +.Fn Psymbol_iter_by_addr , +.Fn Psymbol_iter_by_lmid , +.Fn Psymbol_iter_by_name , +and +.Fn Pxsymbol_iter +functions. Because these functions return +.Sy -1 +on internal failure, it is recommended that the callback function not return +.Sy -1 +to indicate an error so that the caller may distinguish between the +failure of the callback function and the failure of these functions. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Psymbol_iter , +.Fn Psymbol_iter_by_addr , +.Fn Psymbol_iter_by_lmid , +.Fn Psymbol_iter_by_name , +and +.Fn Pxsymbol_iter +functions return +.Sy 0 . +If there was an internal error then +.Sy -1 +is returned. Otherwise, if the callback function +.Fa func +returns non-zero, then its return value will be returned instead. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr elf 3ELF , +.Xr gelf 3ELF , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Psync.3proc b/usr/src/man/man3proc/Psync.3proc new file mode 100644 index 0000000000..48c7ad5f96 --- /dev/null +++ b/usr/src/man/man3proc/Psync.3proc @@ -0,0 +1,79 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSYNC 3PROC +.Os +.Sh NAME +.Nm Psync , +.Nm Lsync +.Nd synchronize cached tracing flags and modifications +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft void +.Fo Psync +.Fa "struct ps_prochandle *P" +.Fc +.Ft void +.Fo Lsync +.Fa "struct ps_lwphandle *L" +.Fc +.Sh DESCRIPTION +The +.Fn Psync +function synchronizes modifications to the process handle +.Fa P +back to the underlying active process. The +.Fn Psync +function ensures that any outstanding process holds, register +modifications, signal injections, and modifications to the various fault +and system call tracing flags are taken care of. +.Pp +Normally this function is not required as other library routines take +care of synchronizing this state out to the process when it is required. +If the underlying /proc file system routines are used outside of the +library, calling this function may be required. +.Pp +The +.Fn Psync +function is only meaningful for active processes. It will do nothing on +process handles that refer to core files, zombie processes, and ELF +objects. +.Pp +The +.Fn Lsync +function is equivalent to the +.Fn Psync +function, except rather than operating on the entire process and its +representative thread, it instead operates on the thread handle +.Fa L . +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pfault 3PROC , +.Xr Pputareg 3PROC , +.Xr Psetfault 3PROC , +.Xr Psetsignal 3PROC , +.Xr Psetsysentry 3PROC , +.Xr Psetsysexit 3PROC , +.Xr Psignal 3PROC , +.Xr Psysentry 3PROC , +.Xr Psysexit 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Psysentry.3proc b/usr/src/man/man3proc/Psysentry.3proc new file mode 100644 index 0000000000..1647b00a83 --- /dev/null +++ b/usr/src/man/man3proc/Psysentry.3proc @@ -0,0 +1,124 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PSYSENTRY 3PROC +.Os +.Sh NAME +.Nm Psysentry , +.Nm Psysexit +.Nd set system call entry and exit actions +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Psysentry +.Fa "struct ps_prochandle *P" +.Fa "int which" +.Fa "int stop" +.Fc +.Ft int +.Fo Psysexit +.Fa "struct ps_prochandle *P" +.Fa "int which" +.Fa "int stop" +.Fc +.Sh DESCRIPTION +The +.Fn Psetentry +and +.Fn Psetexit +functions controls what actions the process handle +.Fa P +should take upon executing a system call. +.Pp +The system allows a process to be stopped on both entry and exit of a +system call. For information on the state of the process when it is +stopped due to system call tracing, see the +.Sy PCSENTRY +and +.Sy PCSEXIT +sections of +.Xr proc 4 . +.Pp +The value of the +.Fa stop +parameter controls whether or not the system call listed in +.Fa which +causes the process to stop. A value of non-zero indicates the process +should stop; a value of 0 indicates it should not. +.Pp +The value of +.Fa which +indicates which system call the change applies to. A value of 0 +applies to all system calls. Note, the system does not supply a stable +mapping from system call names to identifiers. +.Pp +These functions only apply to actively running processes. They do not +function on handles that refer to core files, zombie processes, or ELF +objects. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Psetentry +and +.Fn Psetexit +functions return the previous disposition of the system call -- +.Sy 0 +if it was not set to stop and +.Sy 1 +if it was -- +and the system call state is updated. Otherwise, +.Sy -1 +is returned, +.Dv errno +is updated with the error that occurred, and the system call state is +not updated. +.Sh ERRORS +The +.Fn Psysentry +and +.Fn Psysexit +functions will fail if: +.Bl -tag -width Er +.It Er EINVAL +The value of +.Fa which +is invalid, e.g. it is less than zero or greater than the largest defined +system call. +.It Er ENOENT +The handle +.Fa P +refers to a process that is a zombie, a core file, or an ELF object. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Pp +Note, while the +.Fn Psysentry +and +.Fn Psysexit +functions are uncommitted, the mapping of system calls to system call +numbers is +.Sy Not-an-Interface +and may change at any time. +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Psysentry 3PROC , +.Xr Psysexit 3PROC , +.Xr proc 4 , +.Xr attributes 5 diff --git a/usr/src/man/man3proc/Puname.3proc b/usr/src/man/man3proc/Puname.3proc new file mode 100644 index 0000000000..ba0779fdd4 --- /dev/null +++ b/usr/src/man/man3proc/Puname.3proc @@ -0,0 +1,84 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PUNAME 3PROC +.Os +.Sh NAME +.Nm Puname +.Nd get uname information from a process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Puname +.Fa "struct ps_prochandle *P" +.Fa "struct utsname *u" +.Fc +.Sh DESCRIPTION +The +.Fn Puname +function copies the operating system information from the process +handle +.Fa P +into +.Fa u . +.Pp +For an active process or zombie process, this is the same information +obtained from +.Xr uname 2 . +For core files, if available, it is the system information at the time +the core was dumped. +.Pp +Handles that correspond to ELF objects do not contain uname +information. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Puname +function returns +.Sy 0 +and updates the information at +.Fa u . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to indicate the error. +.Sh ERRORS +The +.Fn Puname +function will fail if: +.Bl -tag -width Er +.It Er ENODATA +.Fa P +is a handle that corresponds to an ELF object or +.Fa P +is a handle that corresponds to a core file and that information is not +available in the core file. +.It Er EFAULT +.Fa P +is a handle that corresponds to an active process and +.Fa u +is a bad address. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr uname 1 , +.Xr uname 2 , +.Xr libproc 3LIB diff --git a/usr/src/man/man3proc/Pupdate_maps.3proc b/usr/src/man/man3proc/Pupdate_maps.3proc new file mode 100644 index 0000000000..bb5dedfb30 --- /dev/null +++ b/usr/src/man/man3proc/Pupdate_maps.3proc @@ -0,0 +1,54 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PUPDATE_MAPS 3PROC +.Os +.Sh NAME +.Nm Pupdate_maps +.Nd update address space mappings +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft void +.Fo Pupdate_maps +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Pupdate_maps +function is used to verify that all of the cached mappings in the +process +.Fa P +are still valid and update the cached data with any new information. +This is generally called in response to activity by the run-time +link-editor. In general, the +.Sy libproc +library takes care of managing the need to call this function; however, +debuggers, introspection tools, and others that are interposing on rtld +activity or other actions, may need to call this function. +Note that the +.Fn Pupdate_maps +function is only meaningful for active processes. It will do nothing on +process handles that refer to core files, zombie processes, and ELF +objects. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pupdate_syms 3PROC diff --git a/usr/src/man/man3proc/Pupdate_syms.3proc b/usr/src/man/man3proc/Pupdate_syms.3proc new file mode 100644 index 0000000000..f2305cebd1 --- /dev/null +++ b/usr/src/man/man3proc/Pupdate_syms.3proc @@ -0,0 +1,56 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PUPDATE_SYMS 3PROC +.Os +.Sh NAME +.Nm Pupdate_syms +.Nd update cached symbol tables +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft void +.Fo Pupdate_syms +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn Pupdate_syms +function is used to update all of the cached symbol tables in the +process handle +.Fa P : +updating, invalidating, and caching new symbol tables as appropriate for +functions such as +.Xr Psymbol_iter 3PROC . +This is generally called in response to activity by the run-time +link-editor. In general, the +.Sy libproc +library takes care of managing the need to call this function; +however, debuggers, introspection tools, and others that are +interposing on rtld activity may need to call this function. Note that +the +.Fn Pupdate_syms +function is only meaningful for active processes. It will do nothing on +process handles that refer to core files, zombie processes, and ELF +objects. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pupdate_maps 3PROC diff --git a/usr/src/man/man3proc/Pwrite.3proc b/usr/src/man/man3proc/Pwrite.3proc new file mode 100644 index 0000000000..32ac66b57c --- /dev/null +++ b/usr/src/man/man3proc/Pwrite.3proc @@ -0,0 +1,101 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PWRITE 3PROC +.Os +.Sh NAME +.Nm Pwrite +.Nd write data to the address space of a process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft ssize_t +.Fo Pwrite +.Fa "struct ps_prochandle *P" +.Fa "const void *buf" +.Fa "size_t nbyte" +.Fa "uintptr_t address" +.Fc +.Sh DESCRIPTION +The +.Fn Pwrite +function writes data from +.Fa buf +to the the process handle +.Fa P +starting at the address +.Fa address . +It writes at most +.Fa nbyte +of data. The +.Fn Pwrite +function is logically analogous to the +.Xr pwrite 2 +function. +.Pp +For live processes, this function is equivalent to writing to the +/proc file system +.Sy as +file for the process. For core files, it writes to the logical address +space of what was once the process and not the corresponding offset in +the on-disk file. ELF objects grabbed through +.Xr Pgrab_file 3PROC +do not support being written to. +.Pp +The +.Fn Pwrite +function cannot be used to +.Em extend +the size of a mapping; writing to an unmapped region generates an +error. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pwrite +function returns the number of bytes successfully written to +.Fa P . +This number is never greater than +.Fa nbyte . +Otherwise, it returns +.Sy -1 +and +.Sy errno +is set to indicate an error. For the full list of errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 +and +the +.Sy ERRORS +section in +.Xr pwrite 2 . +.Pp +In addition, the +.Fn Pwrite +function will fail if: +.Bl -tag -width Er +.It Er EIO +.Fa P +refers to an ELF object and not a core file or active process. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr pwrite 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pxecbkpt.3proc b/usr/src/man/man3proc/Pxecbkpt.3proc new file mode 100644 index 0000000000..87640ff20d --- /dev/null +++ b/usr/src/man/man3proc/Pxecbkpt.3proc @@ -0,0 +1,126 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PXECBKPT 3PROC +.Os +.Sh NAME +.Nm Pxecbkpt , +.Nm Pxecwapt , +.Nm Lxecbkpt , +.Nm Lxecwapt +.Nd step over a breakpoint or watchpoint +.Sh SYNOPSIS +.Ft int +.Fo Pxecbkpt +.Fa "struct ps_prochandle *P" +.Fa "ulong_t saved" +.Fc +.Ft int +.Fo Pxecwapt +.Fa "struct ps_prochandle *P" +.Fa "ulong_t saved" +.Fc +.Ft int +.Fo Lxecbkpt +.Fa "struct ps_lwphandle *L" +.Fa "ulong_t saved" +.Fc +.Ft int +.Fo Lxecwapt +.Fa "struct ps_lwphandle *L" +.Fa "ulong_t saved" +.Fc +.Sh DESCRIPTION +The +.Fn Pxecbkpt +and +.Fn Pxecwapt +functions step over a breakpoint or watchpoint respectively in the +corresponding process handle +.Fa P . +The functions execute the original instruction that was at the current +program counter, provided by +.Fa saved , +and then leave the process stopped at the next instruction. +.Pp +The process must be stopped at the time that the +.Fn Pxecbkpt +or +.Fn Pxecwapt +functions are called. +.Pp +The +.Fn Lxecbkpt +and +.Fn Lxecwapt +functions are identical to +.Fn Pxecbkpt +and +.Fn Pxecwapt , +respectively; except rather than operating on the process as a +whole, they operate on the thread handle +.Fa L . +These functions only require that the thread represented by +.Fa L +be stopped and not the entire process. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pxecbkpt , +.Fn Pxecwapt , +.Fn Lxecbkpt , +and +.Fn Lxecwapt +functions return +.Sy 0 +having executed the original instruction at +.Fa saved . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to indicate the error. +.Sh ERRORS +For a full list of errors see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +The +.Fn Pxecbkpt , +.Fn Pxecwapt , +.Fn Lxecbkpt , +and +.Fn Lxecwapt +functions will fail if: +.Bl -tag -width Er +.It Er EBUSY +Either +.Fa P +or +.Fa L +is not stopped. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pdelbkpt 3PROC , +.Xr Pdelwapt 3PROC , +.Xr Psetbkpt 3PROC , +.Xr Psetwapt 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/Pzonename.3proc b/usr/src/man/man3proc/Pzonename.3proc new file mode 100644 index 0000000000..3b2cb8e64e --- /dev/null +++ b/usr/src/man/man3proc/Pzonename.3proc @@ -0,0 +1,136 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PZONENAME 3PROC +.Os +.Sh NAME +.Nm Pzonename , +.Nm Pzoneroot , +.Nm Pzonepath +.Nd get zone name, root, and full object path +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft char * +.Fo Pzonename +.Fa "struct ps_prochandle *P" +.Fa "char *buf" +.Fa "size_t nbyte" +.Fc +.Ft char * +.Fo Pzoneroot +.Fa "struct ps_prochandle *P" +.Fa "char *buf" +.Fa "size_t nbyte" +.Fc +.Ft char * +.Fo Pzonepath +.Fa "struct ps_prochandle *P" +.Fa "const char *path" +.Fa "char *buf" +.Fa "size_t nbyte" +.Fc +.Sh DESCRIPTION +The +.Fn Pzonename +function attempts to determine the name of the zone for the process +handle +.Fa P . +If found, up to +.Fa nbytes , +including a null terminator, will be written into +.Fa buf . +.Pp +The +.Fn Pzoneroot +function attempts to determine the root of the zone corresponding to the +process handle +.Fa P . +If found, up to +.Fa nbytes , +including a null terminator, will be written into +.Fa buf . +If the root cannot be found, for example a core file that did not +originate on the current system, then the empty string will be written +into +.Fa buf . +.Pp +The +.Fn Pzonepath +function attempts to derive the full path of the object +.Fa path +in a zone relative to the root associated with the current process +handle +.Fa P . +If found, up to +.Fa nbytes , +including a null terminator, will be written into +.Fa buf . +It is legal to use the same buffer for both +.Fa path +and +.Fa buf ; +it will not be updated unless the function completes successfully. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Pzonename , +.Fn Pzoneroot , +and +.Fn Pzonepath +functions return +.Sy buf . +Otherwise, if an error occurred, +.Dv NULL +is returned and +.Sy errno +is set. +.Sh ERRORS +The +.Fn Pzonename +and +.Fn Pzoneroot +functions will fail if: +.Bl -tag -width Er +.It Er ENODATA +.Fa P +refers to a core file and zone information was not available in the core +dump or +.Fa P +refers to an ELF object grabbed through +.Xr Pgrab_file . +.It Er EFAULT +.Fa P +refers to an active process and +.Fa buf +is invalid. +.El +.Pp +The +.Fn Pzoneroot +function will fail if: +.Bl -tag -width Er +.It Er ENOMEM +Insufficient memory was available on the system. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr getzoneidbyname 3C , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_access.3proc b/usr/src/man/man3proc/pr_access.3proc new file mode 100644 index 0000000000..cc949a7e01 --- /dev/null +++ b/usr/src/man/man3proc/pr_access.3proc @@ -0,0 +1,101 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_ACCESS 3PROC +.Os +.Sh NAME +.Nm pr_access +.Nd inject access system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_access +.Fa "struct ps_prochandle *P" +.Fa "const char *path" +.Fa "int amode" +.Fc +.Sh DESCRIPTION +The +.Fn pr_access +function injects the +.Xr access 2 +system call into the target process +.Fa P +by means of the agent lwp. If the process handle +.Fa P +is +.Dv NULL +then this is equivalent to calling +.Xr access 2 +on the currently running process. +.Pp +The arguments +.Fa path +and +.Fa amode +have the same meaning as in +.Xr access 2 . +See +.Xr access 2 +for the full description and purpose of the +.Sy access +system call and its arguments. +.Pp +The +.Fn pr_access +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_access +function's return value is that described in +.Xr access 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr access 2 . +.Pp +The +.Fn pr_access +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr access 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_close.3proc b/usr/src/man/man3proc/pr_close.3proc new file mode 100644 index 0000000000..af4185fb8d --- /dev/null +++ b/usr/src/man/man3proc/pr_close.3proc @@ -0,0 +1,99 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_CLOSE 3PROC +.Os +.Sh NAME +.Nm pr_close +.Nd inject close system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_close +.Fa "struct ps_prochandle *P" +.Fa "int fd" +.Fc +.Sh DESCRIPTION +The +.Fn pr_close +function injects the +.Xr close 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is +.Dv NULL +then this is equivalent to calling +.Xr close 2 +on the currently running process. +.Pp +The argument +.Fa fd +has the same meaning as in +.Xr close 2 . +See +.Xr close 2 +for the full description and purpose of the +.Sy close +system call and its arguments. +.Pp +The +.Fn pr_close +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_close +function's return value is that described in +.Xr close 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr close 2 . +.Pp +The +.Fn pr_close +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr close 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_creat.3proc b/usr/src/man/man3proc/pr_creat.3proc new file mode 100644 index 0000000000..9434508002 --- /dev/null +++ b/usr/src/man/man3proc/pr_creat.3proc @@ -0,0 +1,102 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_CREAT 3PROC +.Os +.Sh NAME +.Nm pr_creat +.Nd inject creat system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_creat +.Fa "struct ps_prochandle *P" +.Fa "const char *filename" +.Fa "mode_t mode" +.Fc +.Sh DESCRIPTION +The +.Fn pr_creat +function injects the +.Xr creat 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is +.Dv NULL +then this is equivalent to calling +.Xr creat 2 +on the currently running process. +.Pp +The arguments +.Fa filename +and +.Fa mode +have the same meaning as in +.Xr creat 2 . +See +.Xr creat 2 +for the full description and purpose of the +.Sy creat +system call and its arguments. +.Pp +The +.Fn pr_creat +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_creat +function's return value is that described in +.Xr creat 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr creat 2 . +.Pp +The +.Fn pr_creat +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr creat 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_door_info.3proc b/usr/src/man/man3proc/pr_door_info.3proc new file mode 100644 index 0000000000..d1de2ea0c2 --- /dev/null +++ b/usr/src/man/man3proc/pr_door_info.3proc @@ -0,0 +1,102 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_DOOR_INFO 3PROC +.Os +.Sh NAME +.Nm pr_door_info +.Nd inject door_info library call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_door_info +.Fa "struct ps_prochandle *P" +.Fa "int did" +.Fa "struct door_info *info" +.Fc +.Sh DESCRIPTION +The +.Fn pr_door_info +function injects the +.Xr door_info 3C +library call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is +.Dv NULL +then this is equivalent to calling +.Xr door_info 3C +on the currently running process. +.Pp +The arguments +.Fa did +and +.Fa info +have the same meaning as in +.Xr door_info 3C . +See +.Xr door_info 3C +for the full description and purpose of the +.Sy door_info +library call and its arguments. +.Pp +The +.Fn pr_door_info +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support library +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_door_info +function's return value is that described in +.Xr door_info 3C . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the library call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr door_info 3C . +.Pp +The +.Fn pr_door_info +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +library call in the process handle +.Fa P +or the process handle +.Fa P +does not support library call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr door_info 3C , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_exit.3proc b/usr/src/man/man3proc/pr_exit.3proc new file mode 100644 index 0000000000..1d156fef5d --- /dev/null +++ b/usr/src/man/man3proc/pr_exit.3proc @@ -0,0 +1,107 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_CREAT 3PROC +.Os +.Sh NAME +.Nm pr_exit +.Nd inject exit system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_exit +.Fa "struct ps_prochandle *P" +.Fa "int status" +.Fc +.Sh DESCRIPTION +The +.Fn pr_exit +function injects the +.Xr exit 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is +.Dv NULL +then this is equivalent to calling +.Xr exit 2 +on the currently running process. +.Pp +The argument +.Fa status +has the same meaning as in +.Xr exit 2 . +See +.Xr exit 2 +for the full description and purpose of the +.Sy exit +system call and its arguments. +.Pp +The +.Fn pr_exit +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_exit +function's return value is that described in +.Xr exit 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Pp +If the +.Fn pr_exit +function is called with the value of +.Fa P +set to +.Dv NULL , +then the function will not return. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr exit 2 . +.Pp +The +.Fn pr_exit +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr exit 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_fcntl.3proc b/usr/src/man/man3proc/pr_fcntl.3proc new file mode 100644 index 0000000000..e6bd11db46 --- /dev/null +++ b/usr/src/man/man3proc/pr_fcntl.3proc @@ -0,0 +1,104 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_FCNTL 3PROC +.Os +.Sh NAME +.Nm pr_fcntl +.Nd inject fcntl system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_fcntl +.Fa "struct ps_prochandle *P" +.Fa "int fd" +.Fa "int cmd" +.Fa "void *argp" +.Fc +.Sh DESCRIPTION +The +.Fn pr_fcntl +function injects the +.Xr fcntl 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is +.Dv NULL +then this is equivalent to calling +.Xr fcntl 2 +on the currently running process. +.Pp +The arguments +.Fa fd , +.Fa cmd , +and +.Fa argp +have the same meaning as in +.Xr fcntl 2 . +See +.Xr fcntl 2 +for the full description and purpose of the +.Sy fcntl +system call and its arguments. +.Pp +The +.Fn pr_fcntl +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_fcntl +function's return value is that described in +.Xr fcntl 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr fcntl 2 . +.Pp +The +.Fn pr_fcntl +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr fcntl 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_fstatvfs.3proc b/usr/src/man/man3proc/pr_fstatvfs.3proc new file mode 100644 index 0000000000..b08d834c6c --- /dev/null +++ b/usr/src/man/man3proc/pr_fstatvfs.3proc @@ -0,0 +1,102 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_FSTATVFS 3PROC +.Os +.Sh NAME +.Nm pr_fstatvfs +.Nd inject fstatvfs system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_fstatvfs +.Fa "struct ps_prochandle *P" +.Fa "int fd" +.Fa "statvfs_t *buf" +.Fc +.Sh DESCRIPTION +The +.Fn pr_fstatvfs +function injects the +.Xr fstatvfs 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is +.Dv NULL +then this is equivalent to calling +.Xr fstatvfs 2 +on the currently running process. +.Pp +The arguments +.Fa fd +and +.Fa buf +have the same meaning as in +.Xr fstatvfs 2 . +See +.Xr fstatvfs 2 +for the full description and purpose of the +.Sy fstatvfs +system call and its arguments. +.Pp +The +.Fn pr_fstatvfs +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_fstatvfs +function's return value is that described in +.Xr fstatvfs 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr fstatvfs 2 . +.Pp +The +.Fn pr_fstatvfs +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr fstatvfs 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_getitimer.3proc b/usr/src/man/man3proc/pr_getitimer.3proc new file mode 100644 index 0000000000..0f3c5d32d0 --- /dev/null +++ b/usr/src/man/man3proc/pr_getitimer.3proc @@ -0,0 +1,102 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_GETITIMER 3PROC +.Os +.Sh NAME +.Nm pr_getitimer +.Nd inject getitimer system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_getitimer +.Fa "struct ps_prochandle *P" +.Fa "int which" +.Fa "struct itimerval *itv" +.Fc +.Sh DESCRIPTION +The +.Fn pr_getitimer +function injects the +.Xr getitimer 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is +.Dv NULL +then this will be equivalent to calling +.Xr getitimer 2 +on the currently running process. +.Pp +The arguments +.Fa which +and +.Fa itv +have the same meaning as in +.Xr getitimer 2 . +See +.Xr getitimer 2 +for the full description and purpose of the +.Sy getitimer +system call and its arguments. +.Pp +The +.Fn pr_getitimer +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_getitimer +function's return value is that described in +.Xr getitimer 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr getitimer 2 . +.Pp +The +.Fn pr_getitimer +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr getitimer 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_getpeername.3proc b/usr/src/man/man3proc/pr_getpeername.3proc new file mode 100644 index 0000000000..bf0306c068 --- /dev/null +++ b/usr/src/man/man3proc/pr_getpeername.3proc @@ -0,0 +1,104 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_GETPEERNAME 3PROC +.Os +.Sh NAME +.Nm pr_getpeername +.Nd inject getpeername library call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_getpeername +.Fa "struct ps_prochandle *P" +.Fa "int sock" +.Fa "struct sockaddr *name" +.Fa "socklen_t *namelen" +.Fc +.Sh DESCRIPTION +The +.Fn pr_getpeername +function injects the +.Xr getpeername 3SOCKET +library call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is +.Dv NULL +then this is equivalent to calling +.Xr getpeername 3SOCKET +on the currently running process. +.Pp +The arguments +.Fa sock , +.Fa name , +and +.Fa namelen +have the same meaning as in +.Xr getpeername 3SOCKET . +See +.Xr getpeername 3SOCKET +for the full description and purpose of the +.Sy getpeername +library call and its arguments. +.Pp +The +.Fn pr_getpeername +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support library +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_getpeername +function's return value is that described in +.Xr getpeername 3SOCKET . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the library call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr getpeername 3SOCKET . +.Pp +The +.Fn pr_getpeername +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +library call in the process handle +.Fa P +or the process handle +.Fa P +does not support library call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr getpeername 3SOCKET , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_getpeerucred.3proc b/usr/src/man/man3proc/pr_getpeerucred.3proc new file mode 100644 index 0000000000..03d8023287 --- /dev/null +++ b/usr/src/man/man3proc/pr_getpeerucred.3proc @@ -0,0 +1,102 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_GETPEERUCRED 3PROC +.Os +.Sh NAME +.Nm pr_getpeerucred +.Nd inject getpeerucred library call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_getpeerucred +.Fa "struct ps_prochandle *P" +.Fa "int fd" +.Fa "ucred_t **ucp" +.Fc +.Sh DESCRIPTION +The +.Fn pr_getpeerucred +function injects the +.Xr getpeerucred 3C +library call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is +.Dv NULL +then this is equivalent to calling +.Xr getpeerucred 3C +on the currently running process. +.Pp +The arguments +.Fa fd +and +.Fa *ucp +have the same meaning as in +.Xr getpeerucred 3C . +See +.Xr getpeerucred 3C +for the full description and purpose of the +.Sy getpeerucred +library call and its arguments. +.Pp +The +.Fn pr_getpeerucred +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support library +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_getpeerucred +function's return value is that described in +.Xr getpeerucred 3C . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the library call could not be injected. +.Sh ERRORS +For a full list of possible errors see the +.Sy ERRORS +section in +.Xr getpeerucred 3C . +.Pp +The +.Fn pr_getpeerucred +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +library call in the process handle +.Fa P +or the process handle +.Fa P +does not support library call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr getpeerucred 3C , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_getprojid.3proc b/usr/src/man/man3proc/pr_getprojid.3proc new file mode 100644 index 0000000000..bc209e4eb2 --- /dev/null +++ b/usr/src/man/man3proc/pr_getprojid.3proc @@ -0,0 +1,88 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_GETPROJID 3PROC +.Os +.Sh NAME +.Nm pr_getprojid +.Nd inject getprojid system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft projid_t +.Fo pr_getprojid +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn pr_getprojid +function injects the +.Xr getprojid 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is +.Dv NULL +then this is equivalent to calling +.Xr getprojid 2 +on the currently running process. +.Pp +The +.Fn pr_getprojid +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_getprojid +function's return value is that described in +.Xr getprojid 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr getprojid 2 . +.Pp +The +.Fn pr_getprojid +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr getprojid 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_getrctl.3proc b/usr/src/man/man3proc/pr_getrctl.3proc new file mode 100644 index 0000000000..7f46a0ad48 --- /dev/null +++ b/usr/src/man/man3proc/pr_getrctl.3proc @@ -0,0 +1,106 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_GETRCTL 3PROC +.Os +.Sh NAME +.Nm pr_getrctl +.Nd inject getrctl system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_getrctl +.Fa "struct ps_prochandle *P" +.Fa "const char *rname" +.Fa "rctlblk_t *old_blk" +.Fa "rctlblk_t *new_blk" +.Fa "int rflag" +.Fc +.Sh DESCRIPTION +The +.Fn pr_getrctl +function injects the +.Xr getrctl 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is +.Dv NULL +then this is equivalent to calling +.Xr getrctl 2 +on the currently running process. +.Pp +The arguments +.Fa rname , +.Fa old_blk , +.Fa new_blk , +and +.Fa rflag +have the same meaning as in +.Xr getrctl 2 . +See +.Xr getrctl 2 +for the full description and purpose of the +.Sy getrctl +system call and its arguments. +.Pp +The +.Fn pr_getrctl +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_getrctl +function's return value is that described in +.Xr getrctl 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr getrctl 2 . +.Pp +The +.Fn pr_getrctl +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr getrctl 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_getrlimit.3proc b/usr/src/man/man3proc/pr_getrlimit.3proc new file mode 100644 index 0000000000..c1f17bfa8a --- /dev/null +++ b/usr/src/man/man3proc/pr_getrlimit.3proc @@ -0,0 +1,120 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_GETRLIMIT 3PROC +.Os +.Sh NAME +.Nm pr_getrlimit , +.Nm pr_getrlimit64 +.Nd inject getrlimit system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_getrlimit +.Fa "struct ps_prochandle *P" +.Fa "int resource" +.Fa "struct rlimit *rlp" +.Fc +.Ft int +.Fo pr_getrlimit64 +.Fa "struct ps_prochandle *P" +.Fa "int resource" +.Fa "struct rlimit64 *rlp" +.Fc +.Sh DESCRIPTION +The +.Fn pr_getrlimit +function injects the +.Xr getrlimit 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr getrlimit 2 +on the currently running process. +.Pp +The arguments +.Fa resource +and +.Fa rlp +have the same meaning as in +.Xr getrlimit 2 . +See +.Xr getrlimit 2 +for the full description and purpose of the +.Sy getrlimit +system call and its arguments. +.Pp +The +.Fn pr_getrlimit +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Pp +The +.Fn pr_getrlimit64 +function is equivalent to +.Fn pr_getrlimit ; +however, rather than having the rlimit information be subject to the +data model of the target process, they always provide 64-bit rlimit +information. See +.Xr lf64 5 +for more information. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_getrlimit +function's return value is that described in +.Xr getrlimit 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr getrlimit 2 . +.Pp +The +.Fn pr_getrlimit +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr getrlimit 2 , +.Xr libproc 3LIB , +.Xr proc 4 , +.Xr lf64 5 diff --git a/usr/src/man/man3proc/pr_getsockname.3proc b/usr/src/man/man3proc/pr_getsockname.3proc new file mode 100644 index 0000000000..125378d2ab --- /dev/null +++ b/usr/src/man/man3proc/pr_getsockname.3proc @@ -0,0 +1,104 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_GETSOCKNAME 3PROC +.Os +.Sh NAME +.Nm pr_getsockname +.Nd inject getsockname library call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_getsockname +.Fa "struct ps_prochandle *P" +.Fa "int sock" +.Fa "struct sockaddr *name" +.Fa "socklen_t *namelen" +.Fc +.Sh DESCRIPTION +The +.Fn pr_getsockname +function injects the +.Xr getsockname 3SOCKET +library call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr getsockname 3SOCKET +on the currently running process. +.Pp +The arguments +.Fa sock , +.Fa name , +and +.Fa namelen +have the same meaning as in +.Xr getsockname 3SOCKET . +See +.Xr getsockname 3SOCKET +for the full description and purpose of the +.Sy getsockname +library call and its arguments. +.Pp +The +.Fn pr_getsockname +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support library +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_getsockname +function's return value is that described in +.Xr getsockname 3SOCKET . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the library call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr getsockname 3SOCKET . +.Pp +The +.Fn pr_getsockname +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +library call in the process handle +.Fa P +or the process handle +.Fa P +does not support library call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr getsockname 3SOCKET , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_getsockopt.3proc b/usr/src/man/man3proc/pr_getsockopt.3proc new file mode 100644 index 0000000000..6edb92fe08 --- /dev/null +++ b/usr/src/man/man3proc/pr_getsockopt.3proc @@ -0,0 +1,108 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_GETSOCKOPT 3PROC +.Os +.Sh NAME +.Nm pr_getsockopt +.Nd inject getsockopt library call call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_getsockopt +.Fa "struct ps_prochandle *P" +.Fa "int sock" +.Fa "int level" +.Fa "int optname" +.Fa "void *optval" +.Fa "int *optlen" +.Fc +.Sh DESCRIPTION +The +.Fn pr_getsockopt +function injects the +.Xr getsockopt 3SOCKET +library call call into the target process +.Fa P +by means of the agent lwp. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr getsockopt 3SOCKET +on the currently running process. +.Pp +The arguments +.Fa sock , +.Fa level , +.Fa optname , +.Fa optval , +and +.Fa optlen +have the same meaning as in +.Xr getsockopt 3SOCKET , +see +.Xr getsockopt 3SOCKET +for the full description and purpose of the +.Sy getsockopt +system call and its arguments. +.Pp +The +.Fn pr_getsockopt +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_getsockopt +function's return value is that described in +.Xr getsockopt 3SOCKET . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr getsockopt 3SOCKET . +.Pp +The +.Fn pr_getsockopt +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent lwp and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr getsockopt 3SOCKET , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_gettaskid.3proc b/usr/src/man/man3proc/pr_gettaskid.3proc new file mode 100644 index 0000000000..0c52d800d4 --- /dev/null +++ b/usr/src/man/man3proc/pr_gettaskid.3proc @@ -0,0 +1,88 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_GETTASKID 3PROC +.Os +.Sh NAME +.Nm pr_gettaskid +.Nd inject gettaskid system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft taskid_t +.Fo pr_gettaskid +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn pr_gettaskid +function injects the +.Xr gettaskid 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr gettaskid 2 +on the currently running process. +.Pp +The +.Fn pr_gettaskid +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_gettaskid +function's return value is that described in +.Xr gettaskid 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr gettaskid 2 . +.Pp +The +.Fn pr_gettaskid +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr gettaskid 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_getzoneid.3proc b/usr/src/man/man3proc/pr_getzoneid.3proc new file mode 100644 index 0000000000..8cd2e29c5c --- /dev/null +++ b/usr/src/man/man3proc/pr_getzoneid.3proc @@ -0,0 +1,88 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_GETZONEID 3PROC +.Os +.Sh NAME +.Nm pr_getzoneid +.Nd inject getzoneid system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft zoneid_t +.Fo pr_getzoneid +.Fa "struct ps_prochandle *P" +.Fc +.Sh DESCRIPTION +The +.Fn pr_getzoneid +function injects the +.Xr getzoneid 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr getzoneid 2 +on the currently running process. +.Pp +The +.Fn pr_getzoneid +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_getzoneid +function's return value is that described in +.Xr getzoneid 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr getzoneid 2 . +.Pp +The +.Fn pr_getzoneid +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr getzoneid 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_ioctl.3proc b/usr/src/man/man3proc/pr_ioctl.3proc new file mode 100644 index 0000000000..24b47be548 --- /dev/null +++ b/usr/src/man/man3proc/pr_ioctl.3proc @@ -0,0 +1,114 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_IOCTL 3PROC +.Os +.Sh NAME +.Nm pr_ioctl +.Nd inject ioctl system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_ioctl +.Fa "struct ps_prochandle *P" +.Fa "int fd" +.Fa "int code" +.Fa "void *buf" +.Fa "size_t size" +.Fc +.Sh DESCRIPTION +The +.Fn pr_ioctl +function injects the +.Xr ioctl 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr ioctl 2 +on the currently running process. +.Pp +The arguments +.Fa fd , +.Fa code , +and +.Fa buf +have the same meaning as in +.Xr ioctl 2 . +See +.Xr ioctl 2 +for the full description and purpose of the +.Sy ioctl +system call and its arguments. +.Pp +Unlike the traditional +.Xr ioctl 2 +system call, the +.Fn pr_ioctl +function needs to know the maximum size of the buffer +.Fa buf +such that it can be properly injected into the address space of the +target process. +.Pp +The +.Fn pr_ioctl +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_ioctl +function's return value is that described in +.Xr ioctl 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr ioctl 2 . +.Pp +The +.Fn pr_ioctl +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr ioctl 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_link.3proc b/usr/src/man/man3proc/pr_link.3proc new file mode 100644 index 0000000000..a80012df77 --- /dev/null +++ b/usr/src/man/man3proc/pr_link.3proc @@ -0,0 +1,102 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_LINK 3PROC +.Os +.Sh NAME +.Nm pr_link +.Nd inject link system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_link +.Fa "struct ps_prochandle *P" +.Fa "const char *existing" +.Fa "const char *new" +.Fc +.Sh DESCRIPTION +The +.Fn pr_link +function injects the +.Xr link 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr link 2 +on the currently running process. +.Pp +The arguments +.Fa existing +and +.Fa new +have the same meaning as in +.Xr link 2 . +See +.Xr link 2 +for the full description and purpose of the +.Sy link +system call and its arguments. +.Pp +The +.Fn pr_link +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_link +function's return value is that described in +.Xr link 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr link 2 . +.Pp +The +.Fn pr_link +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr link 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_llseek.3proc b/usr/src/man/man3proc/pr_llseek.3proc new file mode 100644 index 0000000000..28fa432dba --- /dev/null +++ b/usr/src/man/man3proc/pr_llseek.3proc @@ -0,0 +1,104 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_LLSEEK 3PROC +.Os +.Sh NAME +.Nm pr_llseek +.Nd inject llseek system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_llseek +.Fa "struct ps_prochandle *P" +.Fa "int filedes" +.Fa "offset_t offset" +.Fa "int whence" +.Fc +.Sh DESCRIPTION +The +.Fn pr_llseek +function injects the +.Xr llseek 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr llseek 2 +on the currently running process. +.Pp +The arguments +.Fa filedes , +.Fa offset , +and +.Fa whence +have the same meaning as in +.Xr llseek 2 . +See +.Xr llseek 2 +for the full description and purpose of the +.Sy llseek +system call and its arguments. +.Pp +The +.Fn pr_llseek +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_llseek +function's return value is that described in +.Xr llseek 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr llseek 2 . +.Pp +The +.Fn pr_llseek +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr llseek 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_lseek.3proc b/usr/src/man/man3proc/pr_lseek.3proc new file mode 100644 index 0000000000..8e96274898 --- /dev/null +++ b/usr/src/man/man3proc/pr_lseek.3proc @@ -0,0 +1,104 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_LSEEK 3PROC +.Os +.Sh NAME +.Nm pr_lseek +.Nd inject lseek system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_lseek +.Fa "struct ps_prochandle *P" +.Fa "int filedes" +.Fa "off_t offset" +.Fa "int whence" +.Fc +.Sh DESCRIPTION +The +.Fn pr_lseek +function injects the +.Xr lseek 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr lseek 2 +on the currently running process. +.Pp +The arguments +.Fa filedes , +.Fa offset , +and +.Fa whence +have the same meaning as in +.Xr lseek 2 . +See +.Xr lseek 2 +for the full description and purpose of the +.Sy lseek +system call and its arguments. +.Pp +The +.Fn pr_lseek +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_lseek +function's return value is that described in +.Xr lseek 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr lseek 2 . +.Pp +The +.Fn pr_lseek +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr lseek 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_memcntl.3proc b/usr/src/man/man3proc/pr_memcntl.3proc new file mode 100644 index 0000000000..dba3f05a12 --- /dev/null +++ b/usr/src/man/man3proc/pr_memcntl.3proc @@ -0,0 +1,110 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_MEMCNTL 3PROC +.Os +.Sh NAME +.Nm pr_memcntl +.Nd inject memcntl system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_memcntl +.Fa "struct ps_prochandle *P" +.Fa "caddr_t addr" +.Fa "size_t len" +.Fa "int cmd" +.Fa "caddr_t arg" +.Fa "int attr" +.Fa "int mask" +.Fc +.Sh DESCRIPTION +The +.Fn pr_memcntl +function injects the +.Xr memcntl 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr memcntl 2 +on the currently running process. +.Pp +The arguments +.Fa addr , +.Fa len , +.Fa cmd , +.Fa arg , +.Fa attr , +and +.Fa mask +have the same meaning as in +.Xr memcntl 2 . +See +.Xr memcntl 2 +for the full description and purpose of the +.Sy memcntl +system call and its arguments. +.Pp +The +.Fn pr_memcntl +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_memcntl +function's return value is that described in +.Xr memcntl 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr memcntl 2 . +.Pp +The +.Fn pr_memcntl +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr memcntl 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_meminfo.3proc b/usr/src/man/man3proc/pr_meminfo.3proc new file mode 100644 index 0000000000..3da4983f91 --- /dev/null +++ b/usr/src/man/man3proc/pr_meminfo.3proc @@ -0,0 +1,110 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_MEMINFO 3PROC +.Os +.Sh NAME +.Nm pr_meminfo +.Nd inject meminfo system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_meminfo +.Fa "struct ps_prochandle *P" +.Fa "const uint64_t *addrs" +.Fa "int addr_count" +.Fa "const uint_t *info" +.Fa "int info_count" +.Fa "uint64_t *outdata" +.Fa "uint_t *validity" +.Fc +.Sh DESCRIPTION +The +.Fn pr_meminfo +function injects the +.Xr meminfo 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr meminfo 2 +on the currently running process. +.Pp +The arguments +.Fa addrs , +.Fa addr_count , +.Fa info , +.Fa info_count , +.Fa outdata , +and +.Fa validity +have the same meaning as in +.Xr meminfo 2 . +See +.Xr meminfo 2 +for the full description and purpose of the +.Sy meminfo +system call and its arguments. +.Pp +The +.Fn pr_meminfo +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_meminfo +function's return value is that described in +.Xr meminfo 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr meminfo 2 . +.Pp +The +.Fn pr_meminfo +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr meminfo 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_mmap.3proc b/usr/src/man/man3proc/pr_mmap.3proc new file mode 100644 index 0000000000..966979337f --- /dev/null +++ b/usr/src/man/man3proc/pr_mmap.3proc @@ -0,0 +1,110 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_MMAP 3PROC +.Os +.Sh NAME +.Nm pr_mmap +.Nd inject mmap system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_mmap +.Fa "struct ps_prochandle *P" +.Fa "void *addr" +.Fa "size_t len" +.Fa "int prot" +.Fa "int flags" +.Fa "int fd" +.Fa "off_t off" +.Fc +.Sh DESCRIPTION +The +.Fn pr_mmap +function injects the +.Xr mmap 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr mmap 2 +on the currently running process. +.Pp +The arguments +.Fa addr , +.Fa len , +.Fa prot , +.Fa flags , +.Fa fd , +and +.Fa off +have the same meaning as in +.Xr mmap 2 . +See +.Xr mmap 2 +for the full description and purpose of the +.Sy mmap +system call and its arguments. +.Pp +The +.Fn pr_mmap +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_mmap +function's return value is that described in +.Xr mmap 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr mmap 2 . +.Pp +The +.Fn pr_mmap +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr mmap 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_munmap.3proc b/usr/src/man/man3proc/pr_munmap.3proc new file mode 100644 index 0000000000..ede8fcd12c --- /dev/null +++ b/usr/src/man/man3proc/pr_munmap.3proc @@ -0,0 +1,102 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_MUNMAP 3PROC +.Os +.Sh NAME +.Nm pr_munmap +.Nd inject munmap system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_munmap +.Fa "struct ps_prochandle *P" +.Fa "void *addr" +.Fa "size_t len" +.Fc +.Sh DESCRIPTION +The +.Fn pr_munmap +function injects the +.Xr munmap 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr munmap 2 +on the currently running process. +.Pp +The arguments +.Fa addr +and +.Fa len +have the same meaning as in +.Xr munmap 2 . +See +.Xr munmap 2 +for the full description and purpose of the +.Sy munmap +system call and its arguments. +.Pp +The +.Fn pr_munmap +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_munmap +function's return value is that described in +.Xr munmap 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr munmap 2 . +.Pp +The +.Fn pr_munmap +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr munmap 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_open.3proc b/usr/src/man/man3proc/pr_open.3proc new file mode 100644 index 0000000000..d462520976 --- /dev/null +++ b/usr/src/man/man3proc/pr_open.3proc @@ -0,0 +1,104 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_OPEN 3PROC +.Os +.Sh NAME +.Nm pr_open +.Nd inject open system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_open +.Fa "struct ps_prochandle *P" +.Fa "const char *filename" +.Fa "int flags" +.Fa "mode_t mode" +.Fc +.Sh DESCRIPTION +The +.Fn pr_open +function injects the +.Xr open 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr open 2 +on the currently running process. +.Pp +The arguments +.Fa filename , +.Fa flags , +and +.Fa mode +have the same meaning as in +.Xr open 2 . +See +.Xr open 2 +for the full description and purpose of the +.Sy open +system call and its arguments. +.Pp +The +.Fn pr_open +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_open +function's return value is that described in +.Xr open 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr open 2 . +.Pp +The +.Fn pr_open +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr open 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_processor_bind.3proc b/usr/src/man/man3proc/pr_processor_bind.3proc new file mode 100644 index 0000000000..4890b051e7 --- /dev/null +++ b/usr/src/man/man3proc/pr_processor_bind.3proc @@ -0,0 +1,106 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_PROCESSOR_BIND 3PROC +.Os +.Sh NAME +.Nm pr_processor_bind +.Nd inject processor_bind system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_processor_bind +.Fa "struct ps_prochandle *P" +.Fa "idtype_t idtype" +.Fa "id_t id" +.Fa "int processorid" +.Fa "int *obind" +.Fc +.Sh DESCRIPTION +The +.Fn pr_processor_bind +function injects the +.Xr processor_bind 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr processor_bind 2 +on the currently running process. +.Pp +The arguments +.Fa idtype , +.Fa id , +.Fa processorid , +and +.Fa obind +have the same meaning as in +.Xr processor_bind 2 . +See +.Xr processor_bind 2 +for the full description and purpose of the +.Sy processor_bind +system call and its arguments. +.Pp +The +.Fn pr_processor_bind +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_processor_bind +function's return value is that described in +.Xr processor_bind 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr processor_bind 2 . +.Pp +The +.Fn pr_processor_bind +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr processor_bind 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_rename.3proc b/usr/src/man/man3proc/pr_rename.3proc new file mode 100644 index 0000000000..f7306778c5 --- /dev/null +++ b/usr/src/man/man3proc/pr_rename.3proc @@ -0,0 +1,102 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_RENAME 3PROC +.Os +.Sh NAME +.Nm pr_rename +.Nd inject rename system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_rename +.Fa "struct ps_prochandle *P" +.Fa "const char *old" +.Fa "const char *new" +.Fc +.Sh DESCRIPTION +The +.Fn pr_rename +function injects the +.Xr rename 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr rename 2 +on the currently running process. +.Pp +The arguments +.Fa old +and +.Fa new +have the same meaning as in +.Xr rename 2 . +See +.Xr rename 2 +for the full description and purpose of the +.Sy rename +system call and its arguments. +.Pp +The +.Fn pr_rename +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_rename +function's return value is that described in +.Xr rename 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr rename 2 . +.Pp +The +.Fn pr_rename +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr rename 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_setitimer.3proc b/usr/src/man/man3proc/pr_setitimer.3proc new file mode 100644 index 0000000000..8226390331 --- /dev/null +++ b/usr/src/man/man3proc/pr_setitimer.3proc @@ -0,0 +1,104 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_SETITIMER 3PROC +.Os +.Sh NAME +.Nm pr_setitimer +.Nd inject setitimer system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_setitimer +.Fa "struct ps_prochandle *P" +.Fa "int which" +.Fa "const struct itimerval *itv" +.Fa "struct interval *oitv" +.Fc +.Sh DESCRIPTION +The +.Fn pr_setitimer +function injects the +.Xr setitimer 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr setitimer 2 +on the currently running process. +.Pp +The arguments +.Fa which , +.Fa itv , +and +.Fa oitv +have the same meaning as in +.Xr setitimer 2 . +See +.Xr setitimer 2 +for the full description and purpose of the +.Sy setitimer +system call and its arguments. +.Pp +The +.Fn pr_setitimer +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_setitimer +function's return value is that described in +.Xr setitimer 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr setitimer 2 . +.Pp +The +.Fn pr_setitimer +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr setitimer 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_setrctl.3proc b/usr/src/man/man3proc/pr_setrctl.3proc new file mode 100644 index 0000000000..186b1843cc --- /dev/null +++ b/usr/src/man/man3proc/pr_setrctl.3proc @@ -0,0 +1,106 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_SETRCTL 3PROC +.Os +.Sh NAME +.Nm pr_setrctl +.Nd inject setrctl system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_setrctl +.Fa "struct ps_prochandle *P" +.Fa "const char *rname" +.Fa "rctlblk_t *old_blk" +.Fa "rctlblk_t *new_blk" +.Fa "int rflag" +.Fc +.Sh DESCRIPTION +The +.Fn pr_setrctl +function injects the +.Xr setrctl 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr setrctl 2 +on the currently running process. +.Pp +The arguments +.Fa rname , +.Fa old_blk , +.Fa new_blk , +and +.Fa rflag +have the same meaning as in +.Xr setrctl 2 . +See +.Xr setrctl 2 +for the full description and purpose of the +.Sy setrctl +system call and its arguments. +.Pp +The +.Fn pr_setrctl +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_setrctl +function's return value is that described in +.Xr setrctl 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr setrctl 2 . +.Pp +The +.Fn pr_setrctl +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr setrctl 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_setrlimit.3proc b/usr/src/man/man3proc/pr_setrlimit.3proc new file mode 100644 index 0000000000..1282c86f1b --- /dev/null +++ b/usr/src/man/man3proc/pr_setrlimit.3proc @@ -0,0 +1,120 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_SETRLIMIT 3PROC +.Os +.Sh NAME +.Nm pr_setrlimit , +.Nm pr_setrlimit64 +.Nd inject setrlimit system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_setrlimit +.Fa "struct ps_prochandle *P" +.Fa "int resource" +.Fa "const struct rlimit *rlp" +.Fc +.Ft int +.Fo pr_setrlimit64 +.Fa "struct ps_prochandle *P" +.Fa "int resource" +.Fa "struct rlimit64 *rlp" +.Fc +.Sh DESCRIPTION +The +.Fn pr_setrlimit +function injects the +.Xr setrlimit 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr setrlimit 2 +on the currently running process. +.Pp +The arguments +.Fa resource +and +.Fa rlp +have the same meaning as in +.Xr setrlimit 2 . +See +.Xr setrlimit 2 +for the full description and purpose of the +.Sy setrlimit +system call and its arguments. +.Pp +The +.Fn pr_setrlimit +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Pp +The +.Fn pr_setrlimit64 +function is equivalent to +.Fn pr_setrlimit ; +however, rather than having the rlimit information be subject to the +data model of the target process, they always provide 64-bit rlimit +information. See +.Xr lf64 5 +for more information. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_setrlimit +function's return value is that described in +.Xr setrlimit 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr setrlimit 2 . +.Pp +The +.Fn pr_setrlimit +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr setrlimit 2 , +.Xr libproc 3LIB , +.Xr proc 4 , +.Xr lf64 5 diff --git a/usr/src/man/man3proc/pr_settaskid.3proc b/usr/src/man/man3proc/pr_settaskid.3proc new file mode 100644 index 0000000000..663bb6ed83 --- /dev/null +++ b/usr/src/man/man3proc/pr_settaskid.3proc @@ -0,0 +1,102 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_SETTASKID 3PROC +.Os +.Sh NAME +.Nm pr_settaskid +.Nd inject settaskid system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft taskid_t +.Fo pr_settaskid +.Fa "struct ps_prochandle *P" +.Fa "projid_t project" +.Fa "int flags" +.Fc +.Sh DESCRIPTION +The +.Fn pr_settaskid +function injects the +.Xr settaskid 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr settaskid 2 +on the currently running process. +.Pp +The arguments +.Fa project +and +.Fa flags +have the same meaning as in +.Xr settaskid 2 . +See +.Xr settaskid 2 +for the full description and purpose of the +.Sy settaskid +system call and its arguments. +.Pp +The +.Fn pr_settaskid +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_settaskid +function's return value is that described in +.Xr settaskid 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr settaskid 2 . +.Pp +The +.Fn pr_settaskid +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr settaskid 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_sigaction.3proc b/usr/src/man/man3proc/pr_sigaction.3proc new file mode 100644 index 0000000000..937f2c1f18 --- /dev/null +++ b/usr/src/man/man3proc/pr_sigaction.3proc @@ -0,0 +1,104 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_SIGACTION 3PROC +.Os +.Sh NAME +.Nm pr_sigaction +.Nd inject sigaction system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_sigaction +.Fa "struct ps_prochandle *P" +.Fa "int sig" +.Fa "const struct sigaction *act" +.Fa "struct sigaction *oact" +.Fc +.Sh DESCRIPTION +The +.Fn pr_sigaction +function injects the +.Xr sigaction 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr sigaction 2 +on the currently running process. +.Pp +The arguments +.Fa sig , +.Fa act , +and +.Fa oact +have the same meaning as in +.Xr sigaction 2 . +See +.Xr sigaction 2 +for the full description and purpose of the +.Sy sigaction +system call and its arguments. +.Pp +The +.Fn pr_sigaction +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_sigaction +function's return value is that described in +.Xr sigaction 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr sigaction 2 . +.Pp +The +.Fn pr_sigaction +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr sigaction 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_stat.3proc b/usr/src/man/man3proc/pr_stat.3proc new file mode 100644 index 0000000000..7c6f26ff4a --- /dev/null +++ b/usr/src/man/man3proc/pr_stat.3proc @@ -0,0 +1,196 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_STAT 3PROC +.Os +.Sh NAME +.Nm pr_fstat , +.Nm pr_fstat64 +.Nm pr_lstat , +.Nm pr_lstat64 , +.Nm pr_stat , +.Nm pr_stat64 +.Nd inject stat system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_fstat +.Fa "struct ps_prochandle *P" +.Fa "int fd" +.Fa "struct stat *buf" +.Fc +.Ft int +.Fo pr_fstat64 +.Fa "struct ps_prochandle *P" +.Fa "int fd" +.Fa "struct stat64 *buf" +.Fc +.Ft int +.Fo pr_lstat +.Fa "struct ps_prochandle *P" +.Fa "const char *path" +.Fa "struct stat *buf" +.Fc +.Ft int +.Fo pr_lstat64 +.Fa "struct ps_prochandle *P" +.Fa "const char *path" +.Fa "struct stat64 *buf" +.Fc +.Ft int +.Fo pr_stat +.Fa "struct ps_prochandle *P" +.Fa "const char *path" +.Fa "struct stat *buf" +.Fc +.Ft int +.Fo pr_stat64 +.Fa "struct ps_prochandle *P" +.Fa "const char *path" +.Fa "struct stat64 *buf" +.Fc +.Sh DESCRIPTION +The +.Fn pr_stat , +.Fn pr_lstat , +and +.Fn pr_fast +functions inject the +.Xr stat 2 , +.Xr lstat 2 , +and +.Xr fstat 2 +system calls respectively into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr stat 2 , +.Xr lstat 2 , +or +.Xr fstat 2 +on the currently running process. +.Pp +The arguments +.Fa path , +and +.Fa buf +to the +.Fn pr_stat +function have the same meaning as in +.Xr stat 2 . +See +.Xr stat 2 +for the full description and purpose of the +.Sy stat +system call and its arguments. +.Pp +The arguments +.Fa fd , +and +.Fa buf +to the +.Fn pr_fstat +function have the same meaning as in +.Xr fstat 2 , +see +.Xr fstat 2 +for the full description and purpose of the +.Sy fstat +system call and its arguments. +.Pp +The arguments +.Fa path , +and +.Fa buf +to the +.Fn pr_lstat +function have the same meaning as in +.Xr lstat 2 , +see +.Xr lstat 2 +for the full description and purpose of the +.Sy lstat +system call and its arguments. +.Pp +The +.Fn pr_stat , +.Fn pr_lstat , +and +.Fn 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. +.Pp +The +.Fn pr_stat64 , +.Fn pr_fstat64 , +and +.Fn pr_lstat64 +functions are equivalent to +.Fn pr_stat , +.Fn pr_fstat , +and +.Fn 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 +.Xr lf64 5 +for more information. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_stat +function's return value is that described in +.Xr stat 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr stat 2 . +.Pp +The +.Fn pr_stat +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr stat 2 , +.Xr libproc 3LIB , +.Xr proc 4 , +.Xr lf64 5 diff --git a/usr/src/man/man3proc/pr_statvfs.3proc b/usr/src/man/man3proc/pr_statvfs.3proc new file mode 100644 index 0000000000..05dc23cf00 --- /dev/null +++ b/usr/src/man/man3proc/pr_statvfs.3proc @@ -0,0 +1,102 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_STATVFS 3PROC +.Os +.Sh NAME +.Nm pr_statvfs +.Nd inject statvfs system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_statvfs +.Fa "struct ps_prochandle *P" +.Fa "const char *path" +.Fa "statvfs_t *buf" +.Fc +.Sh DESCRIPTION +The +.Fn pr_statvfs +function injects the +.Xr statvfs 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr statvfs 2 +on the currently running process. +.Pp +The arguments +.Fa path +and +.Fa buf +have the same meaning as in +.Xr statvfs 2 . +See +.Xr statvfs 2 +for the full description and purpose of the +.Sy statvfs +system call and its arguments. +.Pp +The +.Fn pr_statvfs +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_statvfs +function's return value is that described in +.Xr statvfs 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr statvfs 2 . +.Pp +The +.Fn pr_statvfs +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr statvfs 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_unlink.3proc b/usr/src/man/man3proc/pr_unlink.3proc new file mode 100644 index 0000000000..b1f96a2384 --- /dev/null +++ b/usr/src/man/man3proc/pr_unlink.3proc @@ -0,0 +1,99 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_UNLINK 3PROC +.Os +.Sh NAME +.Nm pr_unlink +.Nd inject unlink system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_unlink +.Fa "struct ps_prochandle *P" +.Fa "const char *path" +.Fc +.Sh DESCRIPTION +The +.Fn pr_unlink +function injects the +.Xr unlink 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr unlink 2 +on the currently running process. +.Pp +The argument +.Fa path +has the same meaning as in +.Xr unlink 2 . +See +.Xr unlink 2 +for the full description and purpose of the +.Sy unlink +system call and its arguments. +.Pp +The +.Fn pr_unlink +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_unlink +function's return value is that described in +.Xr unlink 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr unlink 2 . +.Pp +The +.Fn pr_unlink +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr unlink 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/pr_waitid.3proc b/usr/src/man/man3proc/pr_waitid.3proc new file mode 100644 index 0000000000..0efd563722 --- /dev/null +++ b/usr/src/man/man3proc/pr_waitid.3proc @@ -0,0 +1,106 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PR_WAITID 3PROC +.Os +.Sh NAME +.Nm pr_waitid +.Nd inject waitid system call into victim process +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo pr_waitid +.Fa "struct ps_prochandle *P" +.Fa "idtype_t idtype" +.Fa "id_t id" +.Fa "siginfo_t *infop" +.Fa "int options" +.Fc +.Sh DESCRIPTION +The +.Fn pr_waitid +function injects the +.Xr waitid 2 +system call into the target process +.Fa P +by means of the agent LWP. +If the process handle +.Fa P +is the value +.Dv NULL +then this will be equivalent to calling +.Xr waitid 2 +on the currently running process. +.Pp +The arguments +.Fa idtype , +.Fa id , +.Fa infop , +and +.Fa options +have the same meaning as in +.Xr waitid 2 . +See +.Xr waitid 2 +for the full description and purpose of the +.Sy waitid +system call and its arguments. +.Pp +The +.Fn pr_waitid +function only works on active processes. Process handles that correspond +to core files, zombie processes, or ELF objects do not support system +call injection. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pr_waitid +function's return value is that described in +.Xr waitid 2 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is set to +.Er ENOSYS +to indicate that the system call could not be injected. +.Sh ERRORS +For the full list of errors see the +.Sy ERRORS +section in +.Xr waitid 2 . +.Pp +The +.Fn pr_waitid +function will fail if: +.Bl -tag -width Er +.It Er ENOSYS +An error occurred while trying to invoke the agent LWP and inject a +system call in the process handle +.Fa P +or the process handle +.Fa P +does not support system call injection. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr waitid 2 , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/proc_arg_grab.3proc b/usr/src/man/man3proc/proc_arg_grab.3proc new file mode 100644 index 0000000000..be9c7c1b02 --- /dev/null +++ b/usr/src/man/man3proc/proc_arg_grab.3proc @@ -0,0 +1,161 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROC_ARG_GRAB 3PROC +.Os +.Sh NAME +.Nm proc_arg_grab , +.Nm proc_arg_xrgab +.Nd process grabbing utility function +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "struct ps_prochandle" +.Fo proc_arg_grag +.Fa "const char *arg" +.Fa "int oflag" +.Fa "int gflag" +.Fa "int *perr" +.Fc +.Ft "struct ps_prochandle" +.Fo proc_arg_xgrab +.Fa "const char *arg" +.Fa "const char *path" +.Fa "int oflag" +.Fa "int gflag" +.Fa "int *perr" +.Fa "const char **lwps" +.Fc +.Sh DESCRIPTION +The +.Fn proc_arg_grab +and +.Fn proc_arg_xgrab +functions are utility functions which process arguments pointing to a +currently active process or a core file and returns a process handle to +it. +.Pp +The string +.Fa arg +contains the name of something to try and open. How it is interpreted +depends on the value of +.Fa oflag . +The following values may be passed in as a bitwise-exclusive-OR for +.Fa oflag : +.Bl -tag -width Dv -offset indent +.It Dv PR_ARG_PIDS +Allows +.Fa arg +to specify process IDs and /proc arguments. +.It Dv PR_ARG_CORES +Allows +.Fa arg +to specify core files. +.It PR_ARG_ANY +Encompasses all of the previous opens. +.El +.Pp +The argument +.Fa gflag +controls the behavior when the corresponding process grabbing function +is called by the underlying system. For a list of flags that may be +passed in here, see +.Xr Pgrab 3PROC +and +.Xr Pgrab_core 3PROC . +.Pp +The argument +.Fa perr +must be a +.Pf non- Dv NULL +pointer and in the event that the +.Fn proc_arg_grab +or +.Fn proc_arg_xgrab +functions fail, then +.Fa perr +will be updated with a more detailed error number. +.Pp +The +.Fa path +argument allows a search path for its binaries to be specified in case a +core file is found and opened. +.Pp +If the +.Fa lwps +argument is +.Pf non- Dv NULL , +then if there is a thread specification present in +.Fa arg , +it will be validated to see if it is a valid range and then a pointer to +the start of the thread specification will be stored in +.Fa lwps . +For more information on determining process range validity, see +.Xr proc_lwp_range_valid 3PROC +for more information on valid and invalid tread specifications. +.Sh RETURN VALUES +Upon successful completion, the +.Fn proc_arg_grab +and +.Fn proc_arg_xgrab +functions return a pointer to the process handle is returned. +Otherwise, +.Dv NULL +is returned and +.Fa perr +is set to include a more specific error. +.Sh ERRORS +For a full list of additional errors, see the +.Sy ERRORS +section in +.Xr Pgrab 3PROC +and +.Xr Pgrab_core 3PROC . +.Pp +The +.Fn proc_arg_grab +and +.Fn proc_arg_xgrab +function will fail if: +.Bl -tag -width Er +.It Er G_BADLWPS +.Fa arg +contains an invalid thread specification. +.It Er G_NOCORE +.Dv PR_ARG_CORES +was set and no core file could be found corresponding to +.Fa arg . +.It Er G_NOPROC +.Dv PR_ARG_PIDS +was set and no process could be found corresponding to +.Fa arg . +.It Er G_NOPROCORCORE +Both +.Dv PR_ARG_CORES +and +.Dv PR_ARG_NOPROC +were set and no process or core file could be found corresponding to +.Fa arg . +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pgrab 3PROC , +.Xr Pgrab_core 3PROC , +.Xr Prelease 3PROC , +.Xr proc_lwp_range_valid 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/proc_arg_psinfo.3proc b/usr/src/man/man3proc/proc_arg_psinfo.3proc new file mode 100644 index 0000000000..40af3572a3 --- /dev/null +++ b/usr/src/man/man3proc/proc_arg_psinfo.3proc @@ -0,0 +1,142 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROC_ARG_PSINFO 3PROC +.Os +.Sh NAME +.Nm proc_arg_psinfo , +.Nm proc_arg_xpsinfo +.Nd process ps information utility function +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft pid_t +.Fo proc_arg_psinfo +.Fa "const char *arg" +.Fa "int oflag" +.Fa "psinfo_t *psp" +.Fa "int *perr" +.Fc +.Ft pid_t +.Fo proc_arg_xpsinfo +.Fa "const char *arg" +.Fa "int oflag" +.Fa "psinfo_t *psp" +.Fa "int *perr" +.Fa "const char **lwps" +.Fc +.Sh DESCRIPTION +The +.Fn proc_arg_psinfo +and +.Fn proc_arg_xpsinfo +functions are utility functions which process an argument that may +refer to a currently active process or core file and attempts to obtain the +.Xr ps 1 +information from the process or core and fills it into +.Fa psp . +.Pp +The string +.Fa arg +contains the name of something to try and open. How it is interpreted +depends on the value of +.Fa oflag . +The following values may be passed in as a bitwise-exclusive-OR for +.Fa oflag : +.Bl -tag -width Dv -offset indent +.It Dv PR_ARG_PIDS +Allows +.Fa arg +to specify process IDs and /proc arguments. +.It Dv PR_ARG_CORES +Allows +.Fa arg +to specify core files. +.It PR_ARG_ANY +Encompasses all of the previous opens. +.El +.Pp +The argument +.Fa perr +must be a +.Pf non- Dv NULL +pointer and in the event that the +.Fn proc_arg_psinfo +or +.Fn proc_arg_xpsinfo +functions fail, then +.Fa perr +will be updated with a more detailed error number. +.Pp +If the +.Fa lwps +argument is +.Pf non- Dv NULL , +then if there is a thread specification present in +.Fa arg , +it will be validated to see if it is a valid range and then a pointer to +the start of the thread specification will be stored in +.Fa lwps . +For more information on determining process range validity, see +.Xr proc_lwp_range_valid 3PROC +for more information on valid and invalid tread specifications. +.Sh RETURN VALUES +Upon successful completion, the +.Fn proc_arg_psinfo +and +.Fn proc_arg_xpsinfo +functions return the process identifier and fill in +.Fa psp +with the ps information of the process. Otherwise, +.Sy -1 +is returned and +.Fa perr +is filled in with the error's details. +.Sh ERRORS +For a full list of additional errors, see the +.Sy ERRORS +section in +.Xr Pgrab_core 3PROC . +.Bl -tag -width Er +.It Er G_BADLWPS +.Fa arg +contains an invalid thread specification. +.It Er G_NOCORE +.Dv PR_ARG_CORES +was set and no core file could be found corresponding to +.Fa arg . +.It Er G_NOPROC +.Dv PR_ARG_PIDS +was set and no process could be found corresponding to +.Fa arg . +.It Er G_NOPROCORCORE +Both +.Dv PR_ARG_CORES +and +.Dv PR_ARG_NOPROC +were set and no process or core file could be found corresponding to +.Fa arg . +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr ps 1 , +.Xr libproc 3LIB , +.Xr Pgrab 3PROC , +.Xr Pgrab_core 3PROC , +.Xr Prelease 3PROC , +.Xr proc_lwp_range_valid 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/proc_content2str.3proc b/usr/src/man/man3proc/proc_content2str.3proc new file mode 100644 index 0000000000..01f3b6a979 --- /dev/null +++ b/usr/src/man/man3proc/proc_content2str.3proc @@ -0,0 +1,90 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROC_CONTENT2STR 3PROC +.Os +.Sh NAME +.Nm proc_content2str , +.Nm proc_str2content +.Nd convert a string to and from a core_content_t +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo proc_content2str +.Fa "core_content_t content" +.Fa "char *buf" +.Fa "size_t size" +.Fc +.Ft int +.Fo proc_str2content +.Fa "const char *str" +.Fa "core_content_t *cp" +.Fc +.Sh DESCRIPTION +The +.Fn proc_content2str +function converts the contents of a process (whether active or a core +file) from +.Fa content +into a string and writes up to +.Fa size +characters, including the null-terminator, into +.Fa buf . +.Pp +A content string will be a series of one or more tokens concatenated +together with the +.Sy + +or +.Sy - +characters, indicating that the subsequent token should be added or +subtracted from the previous ones. The full list of tokens and constants +is available in the +.Sy core_content_t +portion of the +.Sy TYPES +section in +.Xr libproc 3LIB . +.Pp +The +.Fn proc_str2content +function takes the character string +.Fa str +and based on the format described in the previous paragraph, converts it +back into a +.Vt core_content_t +which is placed into +.Fa cp . +.Sh RETURN VALUES +Upon successful completion, the +.Fn proc_content2str +function will return the number of characters written into +.Fa buf , +excluding the terminating null character. +.Pp +Upon successful completion, the +.Fn proc_str2content +function will return +.Sy 0 . +Otherwise, +.Sy -1 +will be returned to indicate an unknown string. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr coreadm 1M , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/proc_fltname.3proc b/usr/src/man/man3proc/proc_fltname.3proc new file mode 100644 index 0000000000..1dc563b714 --- /dev/null +++ b/usr/src/man/man3proc/proc_fltname.3proc @@ -0,0 +1,89 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROC_FLTNAME 3PROC +.Os +.Sh NAME +.Nm proc_fltname , +.Nm proc_signame , +.Nm proc_sysname +.Nd convert a fault, signal, and system call to a name +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "char *" +.Fo proc_fltname +.Fa "int flt" +.Fa "char *buf" +.Fa "size_t bufsz" +.Fc +.Ft "char *" +.Fo proc_signame +.Fa "int sig" +.Fa "char *buf" +.Fa "size_t bufsz" +.Fc +.Ft "char *" +.Fo proc_sysname +.Fa "int sys" +.Fa "char *buf" +.Fa "size_t bufsz" +.Fc +.Sh DESCRIPTION +The +.Fn proc_fltname , +.Fn proc_signame , +and +.Fn proc_sysname +functions respectively convert the fault, signal, and system call in +.Fa flt , +.Fa sig , +and +.Fa sys +to a human-readable name and place the corresponding string in +.Fa buf . +Up to +.Fa bufsz +characters, including the null terminator, will be written into +.Fa buf . +.Sh RETURN VALUES +Upon successful completion, the +.Fn proc_fltname , +.Fn proc_signame , +and +.Fn proc_sysname +functions return a pointer to +.Fa buf . +The contents of +.Fa buf +are always null terminated. +Otherwise, +.Dv NULL +is returned. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc_fltset2str 3PROC , +.Xr proc_sigset2str 3PROC , +.Xr proc_str2flt 3PROC , +.Xr proc_str2fltset 3PROC , +.Xr proc_str2sig 3PROC , +.Xr proc_str2sigset 3PROC , +.Xr proc_str2sys 3PROC , +.Xr proc_str2sysset 3PROC , +.Xr proc_sysset2str 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/proc_fltset2str.3proc b/usr/src/man/man3proc/proc_fltset2str.3proc new file mode 100644 index 0000000000..08e43c531f --- /dev/null +++ b/usr/src/man/man3proc/proc_fltset2str.3proc @@ -0,0 +1,117 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROC_FLTSET2STR 3PROC +.Os +.Sh NAME +.Nm proc_fltset2str , +.Nm proc_sigset2str , +.Nm proc_sysset2str +.Nd convert a fault, signal, or system call set to a string +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "char *" +.Fo proc_fltset2str +.Fa "const fltset_t *set" +.Fa "const char *delim" +.Fa "int members" +.Fa "char *buf" +.Fa "size_t buflen" +.Fc +.Ft "char *" +.Fo proc_sigset2str +.Fa "const sigset_t *set" +.Fa "const char *delim" +.Fa "int members" +.Fa "char *buf" +.Fa "size_t buflen" +.Fc +.Ft "char *" +.Fo proc_sysset2str +.Fa "const sysset_t *set" +.Fa "const char *delim" +.Fa "int members" +.Fa "char *buf" +.Fa "size_t buflen" +.Fc +.Sh DESCRIPTION +The +.Fn proc_fltset2str , +.Fn proc_sigset2str , +and +.Fn proc_sysset2str +functions respectively convert the fault, signal, and system call sets in +.Fa fltset , +.Fa sigset , +and +.Fa sysset +to a human-readable name and place the corresponding string in +.Fa buf . +.Pp +Up to +.Fa buflen +characters will be placed in +.Fa buf , +including the null terminator. If +.Fa buf +is not large enough to hold the entire string, then an error +will be returned. +.Pp +The +.Fa members +argument controls which members of the set are written out. If +.Fa members +is +.Sy 1 , +then the sets member are placed in +.Fa buf . +If +.Fa members +is +.Sy 0 , +then the members which are not in the set are placed in +.Fa buf . +.Pp +The string +.Fa delim +will be placed in-between every member of the set. It will not come after +the last entry in the set. +.Sh RETURN VALUES +Upon successful completion, the +.Fn proc_fltset2str , +.Fn proc_sigset2str , +and +.Fn proc_sysset2str +functions return +.Fa buf . +Otherwise, +.Dv NULL +is returned. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc_fltname 3PROC , +.Xr proc_signame 3PROC , +.Xr proc_str2flt 3PROC , +.Xr proc_str2fltset 3PROC , +.Xr proc_str2sig 3PROC , +.Xr proc_str2sigset 3PROC , +.Xr proc_str2sys 3PROC , +.Xr proc_str2sysset 3PROC , +.Xr proc_sysname 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/proc_get_auxv.3proc b/usr/src/man/man3proc/proc_get_auxv.3proc new file mode 100644 index 0000000000..8f2ec70299 --- /dev/null +++ b/usr/src/man/man3proc/proc_get_auxv.3proc @@ -0,0 +1,52 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROG_GET_AUXV 3PROC +.Os +.Sh NAME +.Nm proc_get_auxv +.Nd get process auxiliary vector +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo proc_get_auxv +.Fa "pid_t proc" +.Fa "auxv_t *pauxv" +.Fa "int naux" +.Fc +.Sh DESCRIPTION +The +.Fn proc_get_auxv +function is a convenient way to read the /proc auxv file for the process +.Fa proc . +Up to +.Fa naux +vectors will be read and written into +.Fa pauxv . +.Sh RETURN VALUES +Upon successful completion, the +.Fn proc_get_auxv +function returns the number of auxiliary vectors read into +.Fa pauxv. +Otherwise, +.Sy -1 +is returned to indicate an error occurred. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/proc_get_cred.3proc b/usr/src/man/man3proc/proc_get_cred.3proc new file mode 100644 index 0000000000..dbdb08c379 --- /dev/null +++ b/usr/src/man/man3proc/proc_get_cred.3proc @@ -0,0 +1,66 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROG_GET_CRED 3PROC +.Os +.Sh NAME +.Nm proc_get_cred +.Nd get process credentials +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo proc_get_cred +.Fa "pid_t proc" +.Fa "prcred_t *credp" +.Fa "int ngroups" +.Fc +.Sh DESCRIPTION +The +.Fn proc_get_cred +function is a convenient way to read the /proc cred file for the process +.Fa proc . +.Pp +Up to +.Fa ngroups +supplemental groups will be read and written into +.Fa credp +in addition to the normal information. If +.Fa ngroups +is more than one, than it is up to the caller to have allocated enough +space for +.Fa credp . +Callers could allocate it, using an expression similar to: +.Pp +.Dl credp = malloc(sizeof (prcred_t) + (ngroups - 1) * sizeof (gid_t)); +.Pp +The definition of the +.Sy prcred_t +structure may be found in +.Xr proc 4 . +.Sh RETURN VALUES +Upon successful completion, the +.Fn proc_get_cred +function returns +.Sy 0 . +Otherwise, +.Sy -1 +is returned to indicate an error occurred. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/proc_get_priv.3proc b/usr/src/man/man3proc/proc_get_priv.3proc new file mode 100644 index 0000000000..bc83a7d604 --- /dev/null +++ b/usr/src/man/man3proc/proc_get_priv.3proc @@ -0,0 +1,72 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROC_GET_PRIV 3PROC +.Os +.Sh NAME +.Nm proc_get_priv , +.Nm proc_free_priv +.Nd get process privileges +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft "prpriv_t *" +.Fo proc_get_priv +.Fa "pid_t pid" +.Fc +.Ft void +.Fo proc_free_priv +.Fa "prpriv_t *prp" +.Fc +.Sh DESCRIPTION +The +.Fn proc_get_priv +function is a convenient way to read the /proc privilege file for the +process +.Fa pid . +The +.Fn proc_get_priv +function takes care of allocating memory for the privilege set and +ensures that it is large enough to hold all of the privilege sets. The +definition of the +.Sy prpriv_t +structure may be found in +.Xr proc 4 . +.Pp +The +.Fn proc_free_priv +function releases the memory that was allocated by a call to +.Fn proc_get_priv . +It is safe to pass the +.Dv NULL +pointer in as +.Fa prp , +the function will simply return without taking any action in that case. +.Sh RETURN VALUES +Upon successful completion, the +.Fn proc_get_priv +function returns a pointer to an allocated +.Sy prpriv_t +with the privileges of +.Fa pid . +Otherwise, +.Dv NULL +is returned to indicate an error occurred. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/proc_get_psinfo.3proc b/usr/src/man/man3proc/proc_get_psinfo.3proc new file mode 100644 index 0000000000..cc2201b237 --- /dev/null +++ b/usr/src/man/man3proc/proc_get_psinfo.3proc @@ -0,0 +1,56 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROC_GET_PSINFO 3PROC +.Os +.Sh NAME +.Nm proc_get_psinfo +.Nd get process ps information +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo proc_get_psinfo +.Fa "pid_t pid" +.Fa "psinfo_t *psp" +.Fc +.Sh DESCRIPTION +The +.Fn proc_get_psinfo +function is a convenient way to read the /proc psinfo file for the +process +.Fa pid . +The +.Xr ps 1 +related information of the process will be filled into +.Fa psp . +The definition of the +.Sy psinfo_t +structure may be found in +.Xr proc 4 . +.Sh RETURN VALUES +Upon successful completion, the +.Fn proc_get_psinfo +function returns +.Sy 0 . +Otherwise, +.Sy -1 +is returned to indicate an error occurred. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/proc_get_status.3proc b/usr/src/man/man3proc/proc_get_status.3proc new file mode 100644 index 0000000000..45393a76bc --- /dev/null +++ b/usr/src/man/man3proc/proc_get_status.3proc @@ -0,0 +1,54 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROC_GET_STATUS 3PROC +.Os +.Sh NAME +.Nm proc_get_pstatus +.Nd get process status information +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo proc_get_pstatus +.Fa "pid_t pid" +.Fa "pstatus_t *psp" +.Fc +.Sh DESCRIPTION +The +.Fn proc_get_pstatus +function is a convenient way to read the /proc status file for the +process +.Fa pid . +The status information of the process will be filled into +.Fa psp . +The definition of the +.Sy pstatus_t +structure may be found in +.Xr proc 4 . +.Sh RETURN VALUES +Upon successful completion, the +.Fn proc_get_pstatus +function returns +.Sy 0 . +Otherwise, +.Sy -1 +is returned to indicate an error occurred. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/proc_initstdio.3proc b/usr/src/man/man3proc/proc_initstdio.3proc new file mode 100644 index 0000000000..315f717f81 --- /dev/null +++ b/usr/src/man/man3proc/proc_initstdio.3proc @@ -0,0 +1,107 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROC_INITSTDIO 3PROC +.Os +.Sh NAME +.Nm proc_initstdio , +.Nm proc_flushstdio , +.Nm proc_finistdio +.Nd stdio buffering functions +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo proc_initstdio +.Fa void +.Fc +.Ft int +.Fo proc_flushstdio +.Fa void +.Fc +.Ft int +.Fo proc_finistdio +.Fa void +.Fc +.Sh DESCRIPTION +The +.Fn proc_initstdio , +.Fn proc_flushstdio , +and +.Fn proc_finistdio +functions are utilities provided to aid with the possibility of deadlock +while doing I/O operations. If a process is trying to do I/O, but +holding the process handle that would consume that I/O, then eventually +the program holding the process handle will block as none of its I/O has +been drained. However, because it is holding a process handle to that +process, it will never be drained. +.Pp +Consider, for example, the following invocation: +.Li pfiles `pgrep xterm` +where the command was launched from a shell on an xterm. Because the +xterm is stopped, it will not be able to write out any of the standard +out that gets passed to it, leading to a deadlock. The +.Li pfiles +program cannot release the +.Li xterm +process because it still has pending I/O, but the I/O cannot be drained +due to the same hold. +.Pp +To address this, these functions duplicate the standard output and +standard error of the process to temporary files and then flushes it out +to the original file descriptors and streams later. When finished, the +original file descriptors are restored as standard out and standard +error. +.Pp +The +.Fn proc_initstdio +function initializes a new standard out and standard error file +descriptors and retains the originals. +.Pp +The +.Fn proc_flushstdio +functions flushes all of the cached data from the temporary standard out +and standard error back to the underlying ones. This function should +only be called after all process handles have been released. For +example, if iterating on multiple processes, calling this after handling +each one is safe. +.Pp +The +.Fn proc_finistdio +flushes any outstanding I/O and restores the original standard output +and standard error. +.Pp +Once called, the +.Fn proc_initstdio +function must not be called again until a successful call to +.Fn proc_finistdio . +.Sh RETURN VALUES +Upon successful completion, the +.Fn proc_initstdio , +.Fn proc_flushstdio , +and +.Fn proc_finistdio +functions all return +.Sy 0 . +Otherwise, +.Sy -1 +is returned to indicate failure. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy Unsafe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr Pgrab 3PROC , +.Xr Prelease 3PROC diff --git a/usr/src/man/man3proc/proc_lwp_in_set.3proc b/usr/src/man/man3proc/proc_lwp_in_set.3proc new file mode 100644 index 0000000000..62f3596d6e --- /dev/null +++ b/usr/src/man/man3proc/proc_lwp_in_set.3proc @@ -0,0 +1,120 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROC_LWP_IN_SET 3PROC +.Os +.Sh NAME +.Nm proc_lwp_in_set , +.Nm proc_lwp_range_valid +.Nd test and validate thread ranges +.Sh SYNOPSIS +.Lb libproc +.Ft int +.Fo proc_lwp_in_set +.Fa "const char *set" +.Fa "lwpid_t lwpid" +.Fc +.Ft int +.Fo proc_lwp_range_valid +.Fa "const char *set" +.Fc +.Sh DESCRIPTION +The +.Fn proc_lwp_in_set +and +.Fn proc_lwp_range_valid +functions provide means for testing the validity of thread ranges and +whether a thread is in a range. +.Pp +A thread range is a series of one or more series of range identifiers +which describe a collection of threads. These are often used by programs +such as +.Xr pbind 1M , +.Xr pstack 1 , +.Xr prun 1 , +.Xr pstop 1 , +and others as a means for a user to specify a selection of threads from +inside of a process. +.Pp +More formally, the thread range may be described as: +.Bd -literal -offset indent +lwp_range[,lwp_range]* +.Ed +.Pp +An LWP range may be specified as one of the following four strings. The +following table shows the string formats and the corresponding set of +valid threads that match it: +.Bl -column -offset indent ".Sy n-m" "n <= lwpid <= m" +.It Sy -n Ta lwpid <= n +.It Sy n-m Ta n <= lwpid <= m +.It Sy n- Ta lwpid >= n +.It Sy n Ta lwpid == n +.El +.Pp +For example, the thread range +.Sy -2,4-5,7,8- +matches thread with IDs 0-2, 4-5, 7, and any thread id 8 or greater. +.Pp +The +.Fn proc_lwp_range_valid +function determines whether or not the character string +.Fa set +is a valid thread range based on the rules above. Note, the empty +string, the +.Dv NULL +pointer, or otherwise are not valid. +.Pp +The +.Fn proc_lwp_in_set +function determines whether the thread identifier +.Fa lwpid +is contained in the set described by +.Fa set . +If +.Fa set +is the +.Dv NULL +pointer, then every thread matches the set. +.Sh RETURN VALUES +Upon successful completion, the +.Fa proc_lwp_in_set +function returns +.Sy 1 +to indicate +.Fa lwpid +is in +.Fa set . +Otherwise, +.Sy 0 +is returned to indicate that +.Fa lwpid +is not in +.Fa set . +.Pp +Upon successful completion, the +.Fa proc_lwp_range_valid +function returns +.Sy 0 +to indicate +.Fa set +is valid. Otherwise, +.Sy -1 +is returned to indicate that the set is invalid. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/proc_service.3proc b/usr/src/man/man3proc/proc_service.3proc index a088af2b9d..ce819d4dab 100644 --- a/usr/src/man/man3proc/proc_service.3proc +++ b/usr/src/man/man3proc/proc_service.3proc @@ -158,7 +158,6 @@ proc_service \- process service interfaces .fi .SH DESCRIPTION -.sp .LP Every program that links \fBlibthread_db\fR or \fBlibrtld_db\fR must provide a set of process control primitives that allow \fBlibthread_db\fR and @@ -173,7 +172,6 @@ a functional specification that clients of \fBlibthread_db\fR and \fBlibrtld_db\fR can use to implement this required interface. The <\fBproc_service.h\fR> header lists the C declarations of these routines. .SH FUNCTIONS -.sp .ne 2 .na \fB\fBps_pdmodel()\fR\fR @@ -334,7 +332,8 @@ Sets the \fBLWP`s\fR floating point register set. \fB\fBps_pauxv()\fR\fR .ad .RS 23n -Returns a pointer to a read-only copy of the target process's auxiliary vector. +Returns a pointer to a read-only copy of the auxiliary vector of the target +process. .RE .sp @@ -365,7 +364,6 @@ Logs a message. .RE .SS "SPARC" -.sp .ne 2 .na \fB\fBps_lgetxregsize()\fR\fR @@ -393,7 +391,6 @@ Sets the extra state registers of the \fBLWP\fR. .RE .SS "x86" -.sp .ne 2 .na \fB\fBps_lgetLDT()\fR\fR @@ -403,7 +400,6 @@ Reads the local descriptor table of the \fBLWP\fR. .RE .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for description of the following attributes: .sp @@ -419,7 +415,6 @@ MT Level Safe .TE .SH SEE ALSO -.sp .LP \fBlibc_db\fR(3LIB), \fBlibrtld_db\fR(3LIB), \fBps_pread\fR(3PROC), \fBrtld_db\fR(3EXT), \fBattributes\fR(5) diff --git a/usr/src/man/man3proc/proc_str2flt.3proc b/usr/src/man/man3proc/proc_str2flt.3proc new file mode 100644 index 0000000000..672fbf98bb --- /dev/null +++ b/usr/src/man/man3proc/proc_str2flt.3proc @@ -0,0 +1,83 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROC_STR2FLT 3PROC +.Os +.Sh NAME +.Nm proc_str2flt , +.Nm proc_str2sig , +.Nm proc_str2sys +.Nd convert a string to a fault, signal, or system call +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo proc_str2flt +.Fa "const char *str" +.Fa "int *fltnum" +.Fc +.Ft int +.Fo proc_str2sig +.Fa "const char *str" +.Fa "int *signum" +.Fc +.Ft int +.Fo proc_str2sys +.Fa "const char *sys" +.Fa "int *sysnum" +.Fc +.Sh DESCRIPTION +The +.Fn proc_str2flt , +.Fn proc_str2sig , +and +.Fn proc_str2sys +functions convert a string into the corresponding fault, signal, and +system call number respectively and stores the resulting value in +.Fa fltnum , +.Fa signum , +or +.Fa sysnum +respectively. +.Sh RETURN VALUES +Upon successful completion, the +.Fn proc_str2flt , +.Fn proc_str2sig , +and +.Fn proc_str2sys +functions return +.Sy 0 +and update +.Fa fltnum , +.Fa signum , +and +.Fa sysnum +respectively. Otherwise, +.Sy -1 +is returned to indicate that a conversion could not take place. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc_fltname 3PROC , +.Xr proc_fltset2str 3PROC , +.Xr proc_signame 3PROC , +.Xr proc_sigset2str 3PROC , +.Xr proc_str2fltset 3PROC , +.Xr proc_str2sigset 3PROC , +.Xr proc_str2sysset 3PROC , +.Xr proc_sysset2str 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/proc_str2fltset.3proc b/usr/src/man/man3proc/proc_str2fltset.3proc new file mode 100644 index 0000000000..ebc8e60be5 --- /dev/null +++ b/usr/src/man/man3proc/proc_str2fltset.3proc @@ -0,0 +1,125 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROC_STR2FLTSET 3PROC +.Os +.Sh NAME +.Nm proc_str2fltset , +.Nm proc_str2sigset , +.Nm proc_str2sysset +.Nd convert a string to a fault, signal, or system call set +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft char * +.Fo proc_str2fltset +.Fa "const char *str" +.Fa "const char *delim" +.Fa "int members" +.Fa "fltset_t *set" +.Fc +.Ft char * +.Fo proc_str2sigset +.Fa "const char *str" +.Fa "const char *delim" +.Fa "int members" +.Fa "sigset_t *set" +.Fc +.Ft char * +.Fo proc_str2sysset +.Fa "const char *str" +.Fa "const char *delim" +.Fa "int members" +.Fa "sysset_t *set" +.Fc +.Sh DESCRIPTION +The +.Fn proc_str2fltset , +.Fn proc_str2sigset , +and +.Fn proc_str2sysset +functions translate a character string, +.Fa str , +into the corresponding fault set, signal set, and system call set +respectively. +.Pp +The character string +.Fa delim +will be used as a delimiter between subsequent entries in the string +.Fa set . +The value of +.Fa members +determines whether the entries in +.Fa str +enable or disable entries in +.Fa set . +If +.Fa members +is zero, then +.Fa set +is filled in entirely and then each entry in +.Fa str +causes the corresponding entry to be disabled in +.Fa set. +If +.Fa members +is non-zero, then +.Fa set +is empty initially and for each entry in +.Fa str +the corresponding entry in +.Fa set +will be enabled. +.Pp +If an unknown entry is encountered in +.Fa str +then the conversion will fail and a pointer to the first unknown +character will be returned. +.Sh RETURN VALUES +Upon successful completion, +.Dv NULL +is returned and +.Fa set +is filled in. Otherwise, a pointer to the first unknown character is +returned and +.Sy errno +is set to indicate the error. +.Sh ERRORS +The +.Fn proc_str2fltset , +.Fn proc_str2sigset , +and +.Fn proc_str2sigset +functions will fail if: +.Bl -tag -width Er +.It Er EINVAL +.Fa str +contains an unrecognized set name. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc_fltname 3PROC , +.Xr proc_fltset2str 3PROC , +.Xr proc_signame 3PROC , +.Xr proc_sigset2str 3PROC , +.Xr proc_str2flt 3PROC , +.Xr proc_str2sig 3PROC , +.Xr proc_str2sys 3PROC , +.Xr proc_sysname 3PROC , +.Xr proc_sysset2str 3PROC , +.Xr proc 4 diff --git a/usr/src/man/man3proc/proc_unctrl_psinfo.3proc b/usr/src/man/man3proc/proc_unctrl_psinfo.3proc new file mode 100644 index 0000000000..f5bff350a6 --- /dev/null +++ b/usr/src/man/man3proc/proc_unctrl_psinfo.3proc @@ -0,0 +1,53 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROC_UNCTRL_PSINFO 3PROC +.Os +.Sh NAME +.Nm proc_unctrl_psinfo +.Nd fix unprintable characters in a psinfo structures +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft void +.Fo proc_unctrl_psinfo +.Fa "psinfo_t *psp" +.Fc +.Sh DESCRIPTION +The +.Fn proc_uncctrl_psinfo +function walks the process arguments of the +.Fa psp +structure (the +.Sy pr_psargs +member) converting unprintable characters into spaces. The conversion +continues until a null character is encountered. Note, this routine only +will correctly handle 7-bit ASCII characters. Characters in other +encodings, e.g. UTF-8, may be misinterpreted as unprintable. +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +with exceptions. +.Pp +Note, the +.Fn proc_unctrl_psinfo +function is +.Sy UNSAFE +if the same value for +.Fa psp +is passed in from multiple threads. +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/proc_walk.3proc b/usr/src/man/man3proc/proc_walk.3proc new file mode 100644 index 0000000000..cc9a831bec --- /dev/null +++ b/usr/src/man/man3proc/proc_walk.3proc @@ -0,0 +1,121 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Joyent, Inc. +.\" +.Dd May 11, 2016 +.Dt PROC_WALK 3PROC +.Os +.Sh NAME +.Nm proc_walk +.Nd walk all processes or threads in /proc +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo proc_walk +.Fa "proc_walk_f *func" +.Fa "void *arg" +.Fa "int flag" +.Fc +.Sh DESCRIPTION +The +.Fn proc_walk +function walks all threads and processes in /proc and calls the callback +function +.Fa func +once for each one with the user specified +.Fa arg . +The definition of the +.Sy proc_walk_f +is available in +.Xr libproc 3LIB . +.Pp +.Fa func +will be called once for each process and will always have its first +argument filled in with the value of the +.Sy psinfo +file of the process. +The value of +.Fa flag +controls whether or not information about the threads in the process are +included and how many times the callback function +.Fa func +is called. The following values may be passed in for +.Fa flag : +.Bl -tag -width Dv -offset indent +.It Dv PR_WALK_PROC +Indicates that the walker is only concerned with the process. +.Fa func +will be called once for each process in the system. Only the +.Sy psinfo +will be read for the process and passed to +.Fa func . +The second argument, the one for the +.Sy lwpsinfo_t , +will be passed as +.Dv NULL . +.It Dv PR_WALK_LWP +The caller wants both process and thread information. +.Fa func +will be called once for each thread in the system. In addition to the +process +.Sy psinfo +information, the ps specific information for a given thread will be +included in the +.Fa lwpsinfo_t +argument. +.El +.Pp +The return value of the caller's +.Fa func +function determines whether or not iteration will continue. If +.Fa func +returns a non-zero value, then iteration will terminate and that +return value will be returned to the caller. To distinguish between +system errors and caller errors, it is recommended that the function +only return positive integers in the event of an error. +.Sh RETURN VALUES +Upon successful completion, the +.Fn proc_walk +function returns +.Sy 0 . +Otherwise, +.Sy -1 +is returned and +.Sy errno +is updated to reflect the error that occurred. +.Sh ERRORS +In addition to the errors listed below, the +.Fn proc_walk +function may fail for the same reasons as the +.Xr opendir 3C , +.Xr readdir 3C , +and +.Xr malloc 3C +functions. +.Bl -tag -width Er +.It Er EINVAL +.Fa flag is not one of +.Dv PR_WALK_PROC +or +.Dv PR_WALK_LWP . +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr malloc 3C , +.Xr opendir 3C , +.Xr readdir 3C , +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man3proc/ps_lgetregs.3proc b/usr/src/man/man3proc/ps_lgetregs.3proc index 6f80838005..2ae19d7ff4 100644 --- a/usr/src/man/man3proc/ps_lgetregs.3proc +++ b/usr/src/man/man3proc/ps_lgetregs.3proc @@ -54,7 +54,6 @@ in libthread_db .fi .SH DESCRIPTION -.sp .LP \fBps_lgetregs()\fR, \fBps_lsetregs()\fR, \fBps_lgetfpregs()\fR, \fBps_lsetfpregs()\fR, \fBps_lgetxregsize()\fR, \fBps_lgetxregs()\fR, @@ -64,7 +63,6 @@ in libthread_db \fIlid\fR, and \fBps_lsetregs()\fR sets them. \fBps_lgetfpregs()\fR gets the \fBLWP\fR's floating point register set, while \fBps_lsetfpregs()\fR sets it. .SS "SPARC Only" -.sp .LP \fBps_lgetxregsize()\fR,\fBps_lgetxregs()\fR, and\fBps_lsetxregs()\fR are SPARC-specific. They do not need to be defined by a controlling process on @@ -73,7 +71,6 @@ non-SPARC architecture. \fBps_lgetxregsize()\fR returns in registers. \fBps_lgetxregs()\fR gets the extra state registers, and \fBps_lsetxregs()\fR sets them. .SH RETURN VALUES -.sp .ne 2 .na \fB\fBPS_OK\fR \fR @@ -111,7 +108,6 @@ The function did not return successfully. .RE .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for description of the following attributes: .sp @@ -127,7 +123,6 @@ MT Level Safe .TE .SH SEE ALSO -.sp .LP \fBlibc_db\fR(3LIB), \fBproc_service\fR(3PROC), \fBattributes\fR(5), \fBthreads\fR(5) diff --git a/usr/src/man/man3proc/ps_pglobal_lookup.3proc b/usr/src/man/man3proc/ps_pglobal_lookup.3proc index 8175869cb2..664d340baf 100644 --- a/usr/src/man/man3proc/ps_pglobal_lookup.3proc +++ b/usr/src/man/man3proc/ps_pglobal_lookup.3proc @@ -25,7 +25,6 @@ the load object in the target process .fi .SH DESCRIPTION -.sp .LP \fBps_pglobal_lookup()\fR looks up the symbol \fIsym_name\fR in the symbol table of the load object \fIobject_name\fR in the target process identified by @@ -39,7 +38,6 @@ of the load object \fIobject_name\fR in the target process identified by the symbol table entry is the symbol's value as an address in the target process. .SH RETURN VALUES -.sp .ne 2 .na \fB\fBPS_OK\fR \fR @@ -67,7 +65,6 @@ The function did not return successfully. .RE .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for description of the following attributes: .sp @@ -83,7 +80,6 @@ MT Level Safe .TE .SH SEE ALSO -.sp .LP \fBkill\fR(2), \fBlibc_db\fR(3LIB), \fBproc_service\fR(3PROC), \fBattributes\fR(5), \fBthreads\fR(5) diff --git a/usr/src/man/man3proc/ps_pread.3proc b/usr/src/man/man3proc/ps_pread.3proc index 7769fadb25..25bae238b7 100644 --- a/usr/src/man/man3proc/ps_pread.3proc +++ b/usr/src/man/man3proc/ps_pread.3proc @@ -47,14 +47,13 @@ in libthread_db that target process memory access .fi .SH DESCRIPTION -.sp .LP -These routines copy data between the target process's address space and the -controlling process. \fBps_pread()\fR copies \fIsize\fR bytes from address -\fIaddr\fR in the target process into \fIbuf\fR in the controlling process. -\fBpr_pwrite()\fR is like \fBps_pread()\fR except that the direction of the -copy is reversed; data is copied from the controlling process to the target -process. +These routines copy data between the address space of the target process +and the controlling process. \fBps_pread()\fR copies \fIsize\fR bytes from +address \fIaddr\fR in the target process into \fIbuf\fR in the controlling +process. \fBpr_pwrite()\fR is like \fBps_pread()\fR except that the +direction of the copy is reversed; data is copied from the controlling +process to the target process. .sp .LP \fBps_pdread()\fR and \fBps_ptread()\fR behave identically to \fBps_pread()\fR. @@ -63,7 +62,6 @@ process. corresponding primary functions. They are artifacts of history that must be maintained. .SH RETURN VALUES -.sp .ne 2 .na \fB\fBPS_OK\fR\fR @@ -79,8 +77,8 @@ The call returned successfully. \fIsize\fR bytes were copied. .ad .RS 14n Some part of the address range from \fIaddr\fR through -\fIaddr\fR+\fIsize\fR\(mi\fB1\fR is not part of the target process's address -space. +\fIaddr\fR+\fIsize\fR\(mi\fB1\fR is not part of the address space of the +target process. .RE .sp @@ -93,7 +91,6 @@ The function did not return successfully. .RE .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for description of the following attributes: .sp @@ -109,7 +106,6 @@ MT Level Safe .TE .SH SEE ALSO -.sp .LP \fBlibc_db\fR(3LIB), \fBlibrtld_db\fR(3LIB), \fBproc_service\fR(3PROC), \fBrtld_db\fR(3EXT), \fBattributes\fR(5), \fBthreads\fR(5) diff --git a/usr/src/man/man3proc/ps_pstop.3proc b/usr/src/man/man3proc/ps_pstop.3proc index 4769e072a9..9932acb9cb 100644 --- a/usr/src/man/man3proc/ps_pstop.3proc +++ b/usr/src/man/man3proc/ps_pstop.3proc @@ -43,7 +43,6 @@ process and LWP control in libthread_db .fi .SH DESCRIPTION -.sp .LP \fBThe ps_pstop()\fR function stops the target process identified by \fIph\fR, while the \fBps_pcontinue()\fR function allows it to resume. @@ -83,7 +82,6 @@ The \fBps_kill()\fR function directs the signal \fIsignum\fR to the target process for which the handle is \fIph\fR. It has the same semantics as \fBkill\fR(2). .SH RETURN VALUES -.sp .ne 2 .na \fB\fBPS_OK\fR \fR @@ -100,7 +98,7 @@ process is stopped. .ad .RS 14n For \fBps_lstop()\fR, \fBps_lcontinue()\fR and \fBps_lrolltoaddr()\fR; there is -no \fBLWP\fR with id \fIlwipd\fR in the target process. +no \fBLWP\fR with id \fIlwpid\fR in the target process. .RE .sp @@ -113,7 +111,6 @@ The function did not return successfully. .RE .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for description of the following attributes: .sp @@ -129,7 +126,6 @@ MT Level Safe .TE .SH SEE ALSO -.sp .LP \fBkill\fR(2), \fBlibc_db\fR(3LIB), \fBproc_service\fR(3PROC), \fBattributes\fR(5), \fBthreads\fR(5) |