-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInformation.cpp
More file actions
executable file
·72 lines (56 loc) · 2.29 KB
/
Copy pathInformation.cpp
File metadata and controls
executable file
·72 lines (56 loc) · 2.29 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*************************************************************************
Information - description
-------------------
date : Feb. 19 2014
copyright : (C) 2014 Yannick Marion & Gustave Monod
e-mail : yannick.marion@insa-lyon.fr
gustave.monod@insa-lyon.fr
*************************************************************************/
//---- Realization of the <Information> module (file Information.cpp) ----
///////////////////////////////////////////////////////////////// INCLUDE
//--------------------------------------------------------- System include
#include <sys/sem.h>
//------------------------------------------------------- Personal include
#include "Information.h"
///////////////////////////////////////////////////////////////// PRIVATE
//-------------------------------------------------------------- Constants
//------------------------------------------------------------------ Types
//------------------------------------------------------- Static variables
//------------------------------------------------------ Private functions
//static type name ( parameter list )
// How to use:
//
// Contract:
//
// Algorithm:
//
//{
//} //----- End of name
////////////////////////////////////////////////////////////////// PUBLIC
//------------------------------------------------------- Public constants
int const RIGHTS = 0660;
char const PROGRAM_NAME[] = "./Parking";
char const FTOK_CHAR = '3';
unsigned int NB_CHAR_STATE = 18;
// Used for the shared memory:
size_t const SHM_SIZE = sizeof( struct ParkingLot );
// Mutex for the shared memory
struct sembuf const MUTEX_ACCESS = {0, -1, 0};
struct sembuf const MUTEX_FREE = {0, 1, 0};
int const MUTEX_NB = 1;
int const MUTEX_OK = 1;
int const MUTEX_KO = 0;
// Command message info for the mailbox:
int const ENTER_CMD_SIZE = sizeof( enum TypeUsager );
int const EXIT_CMD_SIZE = sizeof( unsigned int );
//------------------------------------------------------- Public functions
struct sembuf SemP ( short unsigned int noSem )
{
struct sembuf result = {noSem, -1, 0};
return result;
} //----- End of SemP
struct sembuf SemV ( short unsigned int noSem )
{
struct sembuf result = {noSem, 1, 0};
return result;
} //----- End of SemV