libpsx(3) — Linux manual page


LIBPSX(3)                 Linux Programmer's Manual                LIBPSX(3)

NAME         top

       psx_syscall3, psx_syscall6 - POSIX semantics for system calls

SYNOPSIS         top

       #include <sys/psx_syscall.h>

       long int psx_syscall3(long int syscall_nr, long int arg1, long int arg2, long int arg3);

       long int psx_syscall6(long int syscall_nr, long int arg1, long int arg2, long int arg3, long int arg4, long int arg5, long int arg6);

       Link with one of these:

       ld ... -lpsx -lpthread --wrap=pthread_create

       gcc ... -lpsx -lpthread -Wl,-wrap,pthread_create

DESCRIPTION         top

       The libpsx library attempts to fill a gap left by the pthreads(7)
       implementation on Linux. To be compliant POSIX threads, via the
       nptl(7) setxid mechanism glibc maintains consistent UID and GID
       credentials amongst all of the threads associated with the current
       process. However, other credential state is not supported by this
       abstraction. To support these extended kernel managed security
       attributes, libpsx(3) provides a more generic pair of wrapping system
       call functions: psx_syscall3(3) and psx_syscall6(3).  Like the setxid
       mechanism, the coordination of thread state is arranged by a realtime
       signal SIGRTMAX which is usurped for this process.

       A linker trick of wrapping the pthread_create() call with a psx
       thread registration function is used to allow libpsx to keep track of
       all pthreads. If that trick is not usable by your application, then
       the much more cumbersome and fragile <sys/psx_syscall.h> header file.

       An inefficient macrology trick supports the psx_syscall() pseudo
       function which takes 1 to 7 arguments, depending on the needs of the
       caller. The macrology pads out the call to actually use
       psx_syscall3(3) or psx_syscall6(3) with zeros filling the missing
       arguments. While using this in source code will make it appear clean,
       the actual code footprint is larger. You are encouraged to use the
       more explicit psx_syscall3(3) and psx_syscall6(3) functions.

RETURN VALUE         top

       The return value for system call functions is generally the value
       returned by the kernel, or -1 in the case of an error. In such cases
       errno(3) is set to the detailed error value. The psx_syscall3 and
       psx_syscall6 functions attempt a single threaded system call and
       return immediately in the case of an error. Should this call succeed,
       then the same system calls are executed from a signal handler on each
       of the other threads of the process.

CONFORMING TO         top

       The needs of libcap(3) for POSIX semantics of capability

REPORTING BUGS         top

       Please report bugs via:

SEE ALSO         top

       libcap(3), pthreads(7) and nptl(7).

COLOPHON         top

       This page is part of the libcap (capabilities commands and library)
       project.  Information about the project can be found at 
       ⟨⟩.  If you have
       a bug report for this manual page, send it to
       (please put "libcap" in the Subject line).  This page was obtained
       from the project's upstream Git repository
       ⟨⟩ on
       2020-09-18.  (At that time, the date of the most recent commit that
       was found in the repository was 2020-09-12.)  If you discover any
       rendering problems in this HTML version of the page, or you believe
       there is a better or more up-to-date source for the page, or you have
       corrections or improvements to the information in this COLOPHON
       (which is not part of the original manual page), send a mail to

                                 2020-01-07                        LIBPSX(3)

Pages that refer to this page: cap_drop_bound(3)cap_get_ambient(3)cap_get_bound(3)cap_get_mode(3)capgetp(3)cap_get_pid(3)cap_get_proc(3)cap_get_secbits(3)cap_mode_name(3)cap_reset_ambient(3)cap_set_ambient(3)cap_setgroups(3)cap_set_mode(3)capsetp(3)cap_set_proc(3)cap_set_secbits(3)cap_setuid(3)libpsx(3)psx_syscall3(3)psx_syscall(3)psx_syscall6(3)