Mount a filesystem
#include <sys/mount.h>
int mount( const char* spec,
const char* dir,
int flags,
const char* type,
const void* data,
int datalen );
- spec
- A null-terminated string describing a special device
(e.g. /dev/hd0t77), or NULL if there's no
special device.
- dir
- A null-terminated string that names the directory that you want to mount
(e.g. /mnt/home).
- flags
- Flags that are passed to the driver:
- _MFLAG_OCB — ignore the special device string,
and contact all servers.
- _MOUNT_READONLY — mark the filesystem mountpoint
as read-only.
- _MOUNT_NOEXEC — don't allow executables to load.
- _MOUNT_NOSUID — don't honor setuid bits on the
filesystem.
- _MOUNT_NOCREAT — don't allow file creation on
the filesystem.
- _MOUNT_OFF32 — limit off_t to 32
bits.
- _MOUNT_NOATIME — disable logging of file access
times.
- _MOUNT_BEFORE — call
resmgr_attach()
with _RESMGR_FLAG_BEFORE.
- _MOUNT_AFTER — call resmgr_attach()
with _RESMGR_FLAG_AFTER.
- _MOUNT_OPAQUE — call resmgr_attach()
with _RESMGR_FLAG_OPAQUE.
- _MOUNT_UNMOUNT — unmount this path.
- _MOUNT_REMOUNT — this path is already mounted;
perform an update.
- _MOUNT_FORCE — force an unmount or a remount
change.
- _MOUNT_ENUMERATE — autodetect on this device.
- type
- A null-terminated string with the filesystem type
(e.g. nfs, cifs, qnx4,
ext2, network).
- data
- A pointer to additional data to be sent to the manager.
If datalen is <0, the data points to a null-terminated
string.
- datalen
- The length of the data, in bytes, that's being sent to the server,
or <0 if the data is a null-terminated string.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The mount() function sends a request to servers to mount the
services provided by spec
and type at dir.
If you set _MFLAG_OCB in the flags,
then the special device string is ignored, and all servers are contacted.
If you don't set this bit, and the special device spec exists,
then only the server that created that device is contacted, and the full path
to spec is provided.
If datalen is any value <0, and
there's a data pointer, the function assumes that the data pointer is a
pointer to a string.
-1 on failure; no server supports the request (errno is set).
QNX Neutrino
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
mount_parse_generic_args(),
resmgr_attach(),
umount()
“Layers in a resource manager”
in the Bones of a Resource Manager chapter of Writing a Resource Manager