48 lines
1 KiB
C
48 lines
1 KiB
C
#ifndef _NZG_GLOBAL
|
|
#define _NZG_GLOBAL 1
|
|
|
|
#include <unistd.h> /* POSIX et al */
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <fcntl.h> /* pour O_RDWR */
|
|
#include <sys/types.h>
|
|
#include <sys/mman.h> /* shm_open */
|
|
#include <errno.h>
|
|
#include <semaphore.h>
|
|
|
|
#define PAGESIZE sysconf(_SC_PAGESIZE)
|
|
#define MSGSPACE_DEFAULT_MODE 0600
|
|
#define SEM_DEFAULT_MODE 0600
|
|
#define SHM_DEFAULT_MODE 0600
|
|
#define MSGSPACE_ID_LEN 32
|
|
#define ERR_UNHANDLED "Gérer mieu les erreurs"
|
|
|
|
#define ANYPOOL -1
|
|
#define SPECIFICPOOL 0
|
|
|
|
#ifndef SEM_FAILED
|
|
#define SEM_FAILED ((sem_t *)0)
|
|
#endif
|
|
|
|
|
|
#ifndef MAP_FAILED
|
|
#define MAP_FAILED ((void *)-1)
|
|
#endif
|
|
|
|
|
|
#ifdef _NZG_REALFILEID
|
|
#define DEFAULT_MSGSPACELISTID "/tmp/nzgSpaceList"
|
|
#else
|
|
#define DEFAULT_MSGSPACELISTID "/nzgSpaceList"
|
|
#endif
|
|
|
|
#ifdef _NZG_REALFILEID
|
|
#define DEFAULT_MSGSPACELISTSEMID "/tmp/nzgSpaceListSem"
|
|
#else
|
|
#define DEFAULT_MSGSPACELISTSEMID "/nzgSpaceListSem"
|
|
#endif
|
|
|
|
#define NZG_ERROR(func,str) fprintf(stderr,"*** %s: %s***\n%s in %s:%d\n",func,strerror(errno),str,__FILE__,__LINE__);
|
|
|
|
#endif
|