-
Notifications
You must be signed in to change notification settings - Fork 3
/
utils.h
56 lines (41 loc) · 994 Bytes
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* chatterbox Progetto del corso di LSO 2017
*
* Dipartimento di Informatica Università di Pisa
* Docenti: Prencipe, Torquati
*
* Si dichiara che il programma è, in ogni sua parte,
* opera originale dello studente.
*
* Studente: Luca Corbucci
* Matricola: 516450
*
*/
#define _GNU_SOURCE 1
#ifndef UTILS_H_
#define UTILS_H_
#include <stdio.h>
#include <errno.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#define BITS_IN_int ( sizeof(int) * CHAR_BIT )
#define THREE_QUARTERS ((int) ((BITS_IN_int * 3) / 4))
#define ONE_EIGHTH ((int) (BITS_IN_int / 8))
#define HIGH_BITS ( ~((unsigned int)(~0) >> ONE_EIGHTH ))
typedef struct config_{
char * UnixPath;
int MaxConnessioni;
int ThreadInPool;
int MaxMsgSize;
int MaxFileSize;
int MaxHistMsgs;
char * DirName;
char * StatFileName;
} config;
#define checkMU(r,c,e) \
if((r=c)==-1) { return -1; }
void * Malloc(size_t size);
#endif