Qsmtp  0.30dev
Functions
mmap.h File Reference

headers of functions for mapping files into memory More...

#include <sys/types.h>

Go to the source code of this file.

Functions

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...
 

Detailed Description

headers of functions for mapping files into memory

Function Documentation

void* mmap_fd ( int  fd,
off_t *  len 
)

map an already opened file into memory

Parameters
fdfile descriptor of opened file
lenlength of mapping will be stored here
Returns
pointer to mapped area
Return values
NULLan 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
dirfddescriptor of directory
fnamepath to file to map relative to dirfd
lenlength of mapping will be stored here
fdfile descriptor of opened file will be stored here
Returns
pointer to mapped area
Return values
NULLan error occured (errno is set)

The file is flock()'ed to allow atomic modification of this file.