1LIBPSX(3)                  Linux Programmer's Manual                 LIBPSX(3)
2
3
4

NAME

6       psx_syscall3, psx_syscall6 - POSIX semantics for system calls
7

SYNOPSIS

9       #include <sys/psx_syscall.h>
10
11       long int psx_syscall3(long int syscall_nr, long int arg1, long int arg2, long int arg3);
12
13       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);
14
15       Link with one of these:
16
17       ld ... -lpsx -lpthread --wrap=pthread_create
18
19       gcc ... -lpsx -lpthread -Wl,-wrap,pthread_create
20

DESCRIPTION

22       The  libpsx  library  attempts  to  fill  a gap left by the pthreads(7)
23       implementation on Linux. To be compliant POSIX threads, via the nptl(7)
24       setxid  mechanism  glibc  maintains  consistent UID and GID credentials
25       amongst all of the threads associated with the  current  process.  How‐
26       ever,  other  credential state is not supported by this abstraction. To
27       support these extended kernel managed security attributes, libpsx  pro‐
28       vides   a   more  generic  pair  of  wrapping  system  call  functions:
29       psx_syscall3() and psx_syscall6().   Like  the  setxid  mechanism,  the
30       coordination  of thread state is mediated by a realtime signal. Whereas
31       the nptl:setxid mechanism uses signo=33 (which is hidden by glibc below
32       a  redefined  SIGRTMIN),  libpsx  inserts  itself in the SIGSYS handler
33       stack. It goes to great length to be the first such handler but acts as
34       a pass-through for other SIGSYS uses.
35
36       A  linker trick of wrapping the pthread_create() call with a psx thread
37       registration function is used to ensure libpsx can keep  track  of  all
38       pthreads.
39
40       An  inefficient macrology trick supports the psx_syscall() pseudo func‐
41       tion which takes 1 to 7 arguments, depending on the needs of the  call‐
42       er.  The  macrology pads out the call to actually use psx_syscall3() or
43       psx_syscall6() with zeros filling the missing  arguments.  While  using
44       this  in  source  code will make it appear clean, the actual code foot‐
45       print  is  larger.  You  are  encouraged  to  use  the  more   explicit
46       psx_syscall3() and psx_syscall6() functions as needed.
47

RETURN VALUE

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

CONFORMING TO

58       The  needs of libcap(3) for POSIX semantics of capability manipulation.
59       You can read more about why this is needed here:
60
61       https://sites.google.com/site/fullycapable/who-ordered-libpsx
62

REPORTING BUGS

64       Please report bugs via:
65
66       https://bugzilla.kernel.org/buglist.cgi?component=lib
67       cap&list_id=1047723&product=Tools&resolution=---
68

SEE ALSO

70       libcap(3), pthreads(7) and nptl(7).
71
72
73
74                                  2021-01-31                         LIBPSX(3)
Impressum