NAME |SYNOPSIS |DESCRIPTION |RETURN VALUE |CONFORMING TO |REPORTING BUGS |SEE ALSO |COLOPHON | |
LIBPSX(3) Linux Programmer's ManualLIBPSX(3)psx_syscall3, psx_syscall6, psx_set_sensitivity - POSIX semantics for system calls
#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); void psx_load_syscalls(long int (**syscall_fn)(long int, long int, long int, long int), long int (**syscall6_fn)(long int, long int, long int, long int, long int, long int, long int)); Any code that uses one of the above functions can be linked as follows:ld ... -lpsx -lpthreadgcc ... -lpsx -lpthread Note, special flags are needed to get-lcapto operated with process wide capabilities when linked with-lpsx. Namely, use thepkg-configoption file:gcc ... -lcap $(pkg-config --libs --cflagslibpsx)More details are available in thecap_get_proc(3) man page.
Thelibpsxlibrary attempts to fill a gap left by thepthreads(7) implementation on Linux. To be compliant POSIX threads, via thenptl(7)setxidmechanism, 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,libpsxprovides a more generic pair of wrapping system call functions:psx_syscall3() andpsx_syscall6(). Like thesetxidmechanism, the coordination of thread state is mediated by a realtime signal. Whereas thenptl:setxidmechanism uses signo=33 (which is hidden by glibc below a redefinedSIGRTMIN),libpsx inserts itself in theSIGSYShandler stack. It goes to great length to be the first such handler but acts as a pass-through for otherSIGSYSuses. An inefficient macrology trick supports thepsx_syscall() pseudo function which takes 1 to 7 arguments, depending on the needs of the caller. The macrology (which ultimately invokes__psx_syscall()) pads out the call to actually usepsx_syscall3() orpsx_syscall6() 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 explicitpsx_syscall3() andpsx_syscall6() functions as needed.psx_set_sensitivity() changes the behavior of the mirrored system calls:PSX_IGNOREensures that differences are ignored (the default behavior);PSX_WARNINGprints a stderr notification about how the results differ; andPSX_ERRORprints the error details and generates aSIGSYSsignal.psx_load_syscalls() can be used to set caller defined function pointers for invoking 3 and 6 argument syscalls. This function can be used to configure a library, or program to change behavior when linked againstlibpsx. Indeed,libcapuses this function fromlibpsxto override its thread scoped default system call based API. When linked withlibpsx,libcapcan operate on all the threads of a multithreaded program to operate with POSIX semantics.
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 caseserrno(3) is set to the detailed error value. Thepsx_syscall3() andpsx_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.
The needs oflibcap(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 Versions oflibpsxprior to 2.72 only supported pthreads. Since libpsx-2.72 the library works with all Linux thread implementations as it operates at the lowest level of thread abstraction, LWPs.
Thelibpsxlibrary is distributed fromhttps://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=libcap&list_id=1090757
libcap(3),cap_get_proc(3),pthreads(7) andnptl(7).
This page is part of thelibcap (capabilities commands and library) project. Information about the project can be found at ⟨https://git.kernel.org/pub/scm/libs/libcap/libcap.git/⟩. If you have a bug report for this manual page, send it to morgan@kernel.org (please put "libcap" in the Subject line). This page was obtained from the project's upstream Git repository ⟨https://git.kernel.org/pub/scm/libs/libcap/libcap.git/⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2025-08-10.) 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 isnot part of the original manual page), send a mail to man-pages@man7.org 2024-11-09LIBPSX(3)Pages that refer to this page:cap_get_proc(3), cap_launch(3), libcap(3)
HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface. For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere. Hosting byjambit GmbH. | ![]() |