pathmgr_symlink()
Create a procmgr symlink
Synopsis:
#include <sys/pathmgr.h>
int pathmgr_symlink( const char * path,
const char * symlink );
Arguments:
- path
- The path that you want to link to.
- symlink
- The name of the link that you want to create.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The pathmgr_symlink() function creates a symbolic link in the process manager (procmgr symlink) that redirects to the path specified by path.
To create the link, your process must have the PROCMGR_AID_PATHSPACE ability. If
security policies are in use, its type must have an allow_link rule that specifies
the path where the symlink is created. For more information, go to procmgr_ability(), and Security
policy language
in the QNX OS
System Security Guide.
The pathmgr_unlink() function removes the link.
- The procmgr symlink isn't persistent and is lost when the system reboots.
- Mixing procmgr symlinks with filesystem symlinks, or having a procmgr symlink to a directory
that's a procmgr symlink to somewhere else, can result in some surprising results. For
more information, see
Links and inodes
in theWorking with Filesystems
chapter of the QNX OS User's Guide.
Returns:
- 0
- Success.
- -1
- An error occurred (errno is set).
Errors:
- EACCES
- Security policies are in use and there is no rule to permit the use of that path.
- EBUSY
- A procmgr symlink of the given name already exists.
- ENOMEM
- There isn't enough free memory to complete the operation.
- EPERM
- The calling process doesn't have the required permission; see procmgr_ability().
Examples:
#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;
}
Classification:
Safety: | |
---|---|
Cancellation point | Yes |
Signal handler | Yes |
Thread | Yes |