Determine if a file is trusted
#include <unistd.h> int fdistrusted( int fd );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The fdistrusted() function determines whether or not the file associated with the given file descriptor is trusted or is in a trusted filesystem.
If a process with any privileged abilities enabled—see procmgr_ability()—attempts to mark a region of memory as PROT_EXEC, any memory-mapped files in the region must be trusted or be from a trusted filesystem.
You can use the pathtrust utility to mark files or filesystems as trusted. If no files or filesystems are designated as trusted, all are trusted.
EOK if the file is trusted, EPERM if it isn't, or some other errno value if an error occurred.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |