ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcbDiskMem.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ngc/core/ngcb.h>

Macros

#define _GNU_SOURCE
 
#define _REENTRANT
 
#define ngcb64BIT   (sizeof(void *) >= 8)
 

Functions

int ngcbDiskMemCreate (const char *path, int idx, unsigned int size, unsigned int chunk, char *erms)
 
void ngcbDiskMemDelete (const char *path, int idx, unsigned int offset)
 

Detailed Description

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

◆ _REENTRANT

#define _REENTRANT

◆ ngcb64BIT

#define ngcb64BIT   (sizeof(void *) >= 8)

Macro to check whether we are running on a 64-bit platform

Function Documentation

◆ ngcbDiskMemCreate()

int ngcbDiskMemCreate ( const char * path,
int idx,
unsigned int size,
unsigned int chunk,
char * erms )

Create a disk memory mapping area in the directory pointed to by path. The size of the area is given in MBytes. The minimum size is 1 (MByte). When the size is larger than chunk then multiple chunks of size chunk + rest are created. When chunk is zero a default 1 GB chunk size is used. The idx defines a generic index to define the file names. The names of the files are:

"ngcb_swap<idx>_uid<uid>_<n>.mem" 

where n indicates the nth chunk and uid is the user id of the calling user. The chunks are filled with zeroes when being created. Chunks of valid size which are already existing will not be re-created.

◆ ngcbDiskMemDelete()

void ngcbDiskMemDelete ( const char * path,
int idx,
unsigned int offset )

Delete all disk memory files in the directory pointed to by path beginning with file name offset offset. When offset is zero then all files in the directory are deleted. The idx is a generic index to define the file-name.