3 * Copyright (C) 1999 Christoph Rohland
5 * ipc helper functions (c) 1999 Manfred Spraul <manfreds@colorfullife.com>
7 #define USHRT_MAX 0xffff
8 #define SEQ_MULTIPLIER (IPCMNI)
19 unsigned short seq_max
;
21 struct ipc_id
* entries
;
25 struct kern_ipc_perm
* p
;
28 void __init
ipc_init_ids(struct ipc_ids
* ids
, int size
);
30 /* must be called with ids->sem acquired.*/
31 int ipc_findkey(struct ipc_ids
* ids
, key_t key
);
32 int ipc_addid(struct ipc_ids
* ids
, struct kern_ipc_perm
* new, int size
);
34 /* must be called with both locks acquired. */
35 struct kern_ipc_perm
* ipc_rmid(struct ipc_ids
* ids
, int id
);
37 int ipcperms (struct kern_ipc_perm
*ipcp
, short flg
);
39 /* for rare, potentially huge allocations.
40 * both function can sleep
42 void* ipc_alloc(int size
);
43 void ipc_free(void* ptr
, int size
);
44 /* for allocation that need to be freed by RCU
45 * both function can sleep
47 void* ipc_rcu_alloc(int size
);
48 void ipc_rcu_free(void* arg
, int size
);
50 struct kern_ipc_perm
* ipc_get(struct ipc_ids
* ids
, int id
);
51 struct kern_ipc_perm
* ipc_lock(struct ipc_ids
* ids
, int id
);
52 void ipc_unlock(struct kern_ipc_perm
* perm
);
53 int ipc_buildid(struct ipc_ids
* ids
, int id
, int seq
);
54 int ipc_checkid(struct ipc_ids
* ids
, struct kern_ipc_perm
* ipcp
, int uid
);
56 void kernel_to_ipc64_perm(struct kern_ipc_perm
*in
, struct ipc64_perm
*out
);
57 void ipc64_perm_to_ipc_perm(struct ipc64_perm
*in
, struct ipc_perm
*out
);
60 /* On IA-64, we always use the "64-bit version" of the IPC structures. */
61 # define ipc_parse_version(cmd) IPC_64
63 int ipc_parse_version (int *cmd
);