forked from lishiming/shm_round_robin_queue
-
Notifications
You must be signed in to change notification settings - Fork 1
/
shm_check_authorize.h
64 lines (49 loc) · 1.71 KB
/
shm_check_authorize.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
57
58
59
60
61
62
63
64
/*##################################################################################*//*
*# @FILE: shm_check_authorize.h
*# DESCRIPTION :
this file is used for checking the process's authorize
if the process don't have a right id, the interface
will refuse the read or write operation.
*# Author:lishiming2007@gmail.com
*####################################################################################*/
#ifndef __H_CHECK_AUTHORIZE_HEADER_
#define __H_CHECK_AUTHORIZE_HEADER_
#ifndef SHM_TRUE
#define SHM_TRUE 1
#endif
#ifndef SHM_FAIL
#define SHM_FALSE -1
#endif
/**
*
* METHOD: check_read_id
* DESCRIPTION: check the id whether has been authorized
* @param :id, the read id who is distributed to the read process,not pid!
* @return :SHM_TRUE if this id has been authorized,if not,SHM_FALSE is returned
*/
int check_read_id(int id);
/**
*
* METHOD: get_read_num
* DESCRIPTION: actually,the id can be mapped to a num between 1-32,we can use this num to stand for the process
* @param :id,the read id who is distributed to the read process,not pid!
* @return :the num between 1-32
*/
int get_read_num(int id);
/**
*
* METHOD: check_write_id
* DESCRIPTION: check the id whether has been authorized
* @param :id, the write id who is distributed to the write process,not pid!
* @return :SHM_TRUE if this id has been authorized,if not,SHM_FALSE is returned
*/
int check_write_id(int id);
/**
*
* METHOD: get_write_num
* DESCRIPTION: actually,the id can be mapped to a num between 1-32,we can use this num to stand for the process
* @param :id,the write id who is distributed to the write process,not pid!
* @return :the num between 1-32
*/
int get_write_num(int id);
#endif