function to mmap a file
More...
#include <mmap.h>
#include <log.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
#include <syslog.h>
|
void * | mmap_fd (int fd, off_t *len) |
| map an already opened file into memory More...
|
|
void * | mmap_name (int dirfd, const char *fname, off_t *len, int *fd) |
| map a file into memory More...
|
|
void* mmap_fd |
( |
int |
fd, |
|
|
off_t * |
len |
|
) |
| |
map an already opened file into memory
- Parameters
-
fd | file descriptor of opened file |
len | length of mapping will be stored here |
- Returns
- pointer to mapped area
- Return values
-
NULL | an error occured (errno is set) or file is empty (errno is 0) |
void* mmap_name |
( |
int |
dirfd, |
|
|
const char * |
fname, |
|
|
off_t * |
len, |
|
|
int * |
fd |
|
) |
| |
map a file into memory
- Parameters
-
dirfd | descriptor of directory |
fname | path to file to map relative to dirfd |
len | length of mapping will be stored here |
fd | file descriptor of opened file will be stored here |
- Returns
- pointer to mapped area
- Return values
-
NULL | an error occured (errno is set) |
The file is flock()'ed to allow atomic modification of this file.