dwww Home | Manual pages | Find package

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

NAME
       psx_syscall3,  psx_syscall6,  psx_set_sensitivity - POSIX semantics for
       system calls

SYNOPSIS
       #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);
       int psx_set_sensitivity(psx_sensitivity_t sensitivity);

       Link with one of these:

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

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

DESCRIPTION
       The libpsx library attempts to fill a gap left by the  pthreads(7)  im-
       plementation  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. How-
       ever, other credential state is not supported by this  abstraction.  To
       support  these extended kernel managed security attributes, libpsx pro-
       vides  a  more  generic  pair  of  wrapping  system   call   functions:
       psx_syscall3()  and psx_syscall6().  Like the setxid mechanism, the co-
       ordination of thread state is mediated by a  realtime  signal.  Whereas
       the nptl:setxid mechanism uses signo=33 (which is hidden by glibc below
       a redefined SIGRTMIN), libpsx inserts  itself  in  the  SIGSYS  handler
       stack. It goes to great length to be the first such handler but acts as
       a pass-through for other SIGSYS uses.

       A linker trick of wrapping the pthread_create() call with a psx  thread
       registration  function  is  used to ensure libpsx can keep track of all
       pthreads.

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

       psx_set_sensitivity() changes  the  behavior  of  the  mirrored  system
       calls: PSX_IGNORE ensures that differences are ignored (the default be-
       havior); PSX_WARNING prints a stderr notification about how the results
       differ;  and  PSX_ERROR prints the error details and generates a SIGSYS
       signal.

RETURN VALUE
       The return value for system call functions is generally the  value  re-
       turned  by the kernel, or -1 in the case of an error. In such cases er-
       rno(3) is set to the  detailed  error  value.  The  psx_syscall3()  and
       psx_syscall6()  functions attempt a single threaded system call and re-
       turn 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
       The needs of libcap(3) for POSIX semantics of capability  manipulation.
       You can read more about why this is needed here:

       https://sites.google.com/site/fullycapable/who-ordered-libpsx

REPORTING BUGS
       The        libpsx        library        is       distributed       from
       https://sites.google.com/site/fullycapable/ where the release notes may
       already cover recent issues.  Please report newly discovered bugs via:

       https://bugzilla.kernel.org/buglist.cgi?component=lib-
       cap&list_id=1090757

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

                                  2021-12-12                         LIBPSX(3)

Generated by dwww version 1.15 on Sat Jun 29 11:27:25 CEST 2024.