rtapi_open_as_root(3rtapi) | RTAPI | rtapi_open_as_root(3rtapi) |
rtapi_open_as_root - Open a file with "root" privilege
#include <rtapi.h>
int rtapi_open_as_root(const char *filename, int flags)
In "uspace" realtime, root privileges are dropped whenever possible. This API temporarily switches on root privileges to open a file, and switches them off before returning. This can be useful for example when accessing device nodes or memory-mapped I/O.
In the case of PCI devices on x86 and x86-64 systems, prefer the linux-style PCI interfaces provided in <rtapi_pci.h>.
In case of success, the nonnegative file descriptor opened. If the caller does not close it, it remains open until rtapi_app exits.
In case of failure, a negative errno value.
Call only from realtime initcode in "uspace" realtime.
open(2), rtapi_pci(3)
LinuxCNC Documentation |