Create a symlink
#include <sys/pathmgr.h> int pathmgr_symlink( const char * path, const char * symlink );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The pathmgr_symlink() function creates a symbolic link, symlink, in the process manager that redirects to the path specified by path.
In order to create the link, your process must have the PROCMGR_AID_PATHSPACE ability enabled. For more information, see procmgr_ability().
The pathmgr_unlink() function removes the link.
#include <stdio.h> #include <sys/pathmgr.h> int main(int argc, char **argv) { /* Create a link from /mytmp to /dev/shmem */ if(pathmgr_symlink("/dev/shmem", "/mytmp") == -1) { perror("Can't make link"); } getchar(); if(pathmgr_unlink("/mytmp") == -1) { perror("Can't unlink "); } return 0; }
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |