This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
Create an entry in the project manager namespace
#include <sys/pm.h> #include <sys/stat.h> int pm_create(const char *name, mode_t mode);
libpm
The pm_create() creates a new entry in the power manager namespace. The mode specifies the file type and access permissions of the new object:
PM_NODE_NEXUS indicates the object is a non-leaf node (directory-like) object that can have further objects created below it in the name space.
If PM_NODE_NEXUS is not specified, the object is a leaf node and cannot have objects created below it in the namespace.
The access permissions are specified as for open() or creat(). See "Access Permissions" in the documentation for stat().
#include <sys/pm.h> #include <stat.h> #include <stdlib.h>
int main() { // create a directory node with rwxrwxr-x permissions if (pm_create("dir", PM_NODE_NEXUS|S_IRWXU|S_RWXG|S_IROTH|S_IXOTH) == -1) { perror("pm_create"); return EXIT_FAILURE; } // create a node under "dir" with rw-rx-r-- permissions if (pm_create("dir/obj", S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH) == -1) { perror("pm_create"); return EXIT_FAILURE; } return EXIT_SUCCESS; }
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
pm_attach(), stat()