mount a file system
#include <unistd.h>
#include <sys/fsys.h>
int mount( const char *special,
const char *dir,
int rwflag );
The mount() function requests that the file system contained on the block special file identified by special be mounted on the directory specified by dir. If rwflag is 1, then writing is forbidden (the file system is mounted as a read-only file system); otherwise writing is permitted according to individual file accessibility.
![]() |
If the path named by dir exists, it must resolve to a directory, and the calling program must have write access to that directory. |
/*
* mount the floppy as a read-only file system
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void main()
{
if( mount( "/dev/fd0", "/floppy0", 1 ) != 0 ) {
perror( "mount /dev/fd0" );
exit( EXIT_FAILURE );
}
exit( EXIT_SUCCESS );
}
UNIX
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |