2004 by Marc J. Rochkind. All rights reserved. Portions marked "Open Source" may be copied under license.

 

Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

c7/smi_pshm.c File Reference


Detailed Description

SMI - POSIX shared memory [Sec. 7.14.2].

Definition in file smi_pshm.c.

Go to the source code of this file.

Compounds

struct  shared_mem
struct  SMIQ_PSHM
struct  SMIQ_PSHM::client

Defines

#define _P1003_1B_VISIBLE
#define MAX_CLIENTS   50
#define MEM_SIZE(s)   (sizeof(struct shared_mem) - sizeof(struct smi_msg) + (s))
#define SEMI_READ   0
#define SEMI_WRITE   1
#define SEMI_DESTROY   2
#define SEMI_POST   1
#define SEMI_WAIT   -1

Functions

void mkshm_name_server (const SMIQ_PSHM *p, char *shmname, size_t shmname_max)
void mkshm_name_client (pid_t pid, char *shmname, size_t shmname_max)
int op_semi (struct shared_mem *m, int sem_num, int sem_op)
client * get_client (SMIQ_PSHM *p, pid_t pid)
SMIQsmi_open_pshm (const char *name, SMIENTITY entity, size_t msgsize)
bool smi_close_pshm (SMIQ *sqp)
bool smi_send_getaddr_pshm (SMIQ *sqp, struct client_id *client, void **addr)
bool smi_send_release_pshm (SMIQ *sqp)
bool smi_receive_getaddr_pshm (SMIQ *sqp, void **addr)
bool smi_receive_release_pshm (SMIQ *sqp)


Define Documentation

#define _P1003_1B_VISIBLE
 

Definition at line 31 of file smi_pshm.c.

#define MAX_CLIENTS   50
 

Definition at line 49 of file smi_pshm.c.

#define MEM_SIZE  )     (sizeof(struct shared_mem) - sizeof(struct smi_msg) + (s))
 

Definition at line 65 of file smi_pshm.c.

Referenced by get_client(), smi_close_pshm(), and smi_open_pshm().

#define SEMI_DESTROY   2
 

Definition at line 82 of file smi_pshm.c.

Referenced by op_semi(), and smi_close_pshm().

#define SEMI_POST   1
 

Definition at line 83 of file smi_pshm.c.

Referenced by init_semi(), op_semi(), smi_receive_release_pshm(), smi_receive_release_shm(), smi_send_release_pshm(), and smi_send_release_shm().

#define SEMI_READ   0
 

Definition at line 80 of file smi_pshm.c.

Referenced by init_semi(), smi_close_pshm(), smi_receive_getaddr_pshm(), smi_receive_getaddr_shm(), smi_send_release_pshm(), and smi_send_release_shm().

#define SEMI_WAIT   -1
 

Definition at line 84 of file smi_pshm.c.

Referenced by op_semi(), smi_receive_getaddr_pshm(), smi_receive_getaddr_shm(), smi_send_getaddr_pshm(), and smi_send_getaddr_shm().

#define SEMI_WRITE   1
 

Definition at line 81 of file smi_pshm.c.

Referenced by init_semi(), op_semi(), smi_close_pshm(), smi_open_shm(), smi_receive_release_pshm(), smi_receive_release_shm(), smi_send_getaddr_pshm(), and smi_send_getaddr_shm().


Function Documentation

struct client* get_client SMIQ_PSHM p,
pid_t  pid
[static]
 

Definition at line 111 of file smi_pshm.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, ec_cmp, EC_FAIL, ec_neg1, errno, get_client(), MAX_CLIENTS, MEM_SIZE, mkshm_name_client(), mmap(), PERM_FILE, SERVER_NAME_MAX, and shm_open().

Referenced by get_client(), smi_send_getaddr_pshm(), and smi_send_release_pshm().

void mkshm_name_client pid_t  pid,
char *  shmname,
size_t  shmname_max
[static]
 

Definition at line 74 of file smi_pshm.c.

Referenced by get_client(), smi_close_pshm(), and smi_open_pshm().

void mkshm_name_server const SMIQ_PSHM p,
char *  shmname,
size_t  shmname_max
[static]
 

Definition at line 68 of file smi_pshm.c.

References SMIQ_PSHM::sq_name.

int op_semi struct shared_mem m,
int  sem_num,
int  sem_op
[static]
 

Definition at line 86 of file smi_pshm.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, ec_neg1, sem_destroy(), sem_post(), sem_t, sem_wait(), SEMI_DESTROY, SEMI_POST, SEMI_WAIT, SEMI_WRITE, shared_mem::sm_sem_r, and shared_mem::sm_sem_w.

bool smi_close_pshm SMIQ sqp  ) 
 

Definition at line 202 of file smi_pshm.c.

References SMIQ_PSHM::client::cl_fd, SMIQ_PSHM::client::cl_mem, SMIQ_PSHM::client::cl_pid, close(), MAX_CLIENTS, MEM_SIZE, mkshm_name_client(), mkshm_name_server(), munmap(), op_semi(), SEMI_DESTROY, SEMI_READ, SEMI_WRITE, SERVER_NAME_MAX, shm_unlink(), SMI_CLIENT, SMI_SERVER, SMIQ_PSHM::sq_clients, SMIQ_PSHM::sq_entity, SMIQ_PSHM::sq_msgsize, SMIQ_PSHM::sq_srv_fd, and SMIQ_PSHM::sq_srv_mem.

Referenced by smi_open_pshm().

SMIQ* smi_open_pshm const char *  name,
SMIENTITY  entity,
size_t  msgsize
 

Definition at line 143 of file smi_pshm.c.

References SMIQ_PSHM::client::cl_fd, SMIQ_PSHM::client::cl_mem, close(), EC_CLEANUP_BGN, EC_CLEANUP_END, ec_cmp, EC_FAIL, ec_neg1, ec_null, errno, ftruncate(), getpid(), MEM_SIZE, mkshm_name_client(), mkshm_name_server(), mmap(), PERM_FILE, sem_init(), SERVER_NAME_MAX, shm_open(), shm_unlink(), shared_mem::sm_sem_r, shared_mem::sm_sem_w, smi_close_pshm(), SMI_SERVER, SMIQ, SMIQ_PSHM::sq_clients, SMIQ_PSHM::sq_entity, SMIQ_PSHM::sq_msgsize, SMIQ_PSHM::sq_name, SMIQ_PSHM::sq_srv_fd, and SMIQ_PSHM::sq_srv_mem.

bool smi_receive_getaddr_pshm SMIQ sqp,
void **  addr
 

Definition at line 286 of file smi_pshm.c.

References SMIQ_PSHM::client::cl_mem, EC_CLEANUP_BGN, EC_CLEANUP_END, ec_neg1, op_semi(), SEMI_READ, SEMI_WAIT, shared_mem::sm_msg, SMI_SERVER, SMIQ_PSHM::sq_clients, SMIQ_PSHM::sq_entity, and SMIQ_PSHM::sq_srv_mem.

bool smi_receive_release_pshm SMIQ sqp  ) 
 

Definition at line 304 of file smi_pshm.c.

References SMIQ_PSHM::client::cl_mem, EC_CLEANUP_BGN, EC_CLEANUP_END, ec_neg1, op_semi(), SEMI_POST, SEMI_WRITE, SMI_SERVER, SMIQ_PSHM::sq_clients, SMIQ_PSHM::sq_entity, and SMIQ_PSHM::sq_srv_mem.

bool smi_send_getaddr_pshm SMIQ sqp,
struct client_id *  client,
void **  addr
 

Definition at line 241 of file smi_pshm.c.

References smi_msg::client_id::c_id1, EC_CLEANUP_BGN, EC_CLEANUP_END, ec_neg1, ec_null, get_client(), getpid(), op_semi(), SEMI_WAIT, SEMI_WRITE, shared_mem::sm_msg, SMI_CLIENT, smi_msg::smi_client, SMI_SERVER, SMIQ_PSHM::sq_client, SMIQ_PSHM::sq_entity, and SMIQ_PSHM::sq_srv_mem.

bool smi_send_release_pshm SMIQ sqp  ) 
 

Definition at line 266 of file smi_pshm.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, ec_neg1, ec_null, get_client(), op_semi(), SEMI_POST, SEMI_READ, SMI_SERVER, SMIQ_PSHM::sq_client, SMIQ_PSHM::sq_entity, and SMIQ_PSHM::sq_srv_mem.


Generated on Fri Apr 23 10:57:09 2004 for AUP2 Example Source by doxygen 1.3.1