Stubs for EnumServiceStatus32, small changes.
[wine/multimedia.git] / include / shm_block.h
blobe8612d27b91fdca1263a04ebada5d001366440e8
1 /***************************************************************************
2 * Copyright 1995, Technion, Israel Institute of Technology
3 * Electrical Eng, Software Lab.
4 * Author: Michael Veksler.
5 ***************************************************************************
6 * File: shm_block.ch
7 * Purpose: treat a shared memory block.
8 ***************************************************************************
9 */
10 #ifndef __WINE_SHM_BLOCK_H
11 #define __WINE_SHM_BLOCK_H
13 #ifdef CONFIG_IPC
15 #include <sys/shm.h>
16 #include "wintypes.h"
17 #define SEGSIZE 0x10000 /* 64 */
18 #define SHM_GRANULARITY SEGSIZE
19 #define SHM_MINBLOCK SHM_GRANULARITY
20 #define SHM_MAXBLOCK (((int)SHMMAX/(int)SHM_GRANULARITY)* \
21 SHM_GRANULARITY)
22 #define PTR2REL(block,ptr) (REL_PTR) ( (char *) (ptr) - (char *) (block) )
23 #define REL2PTR(block,rel) (void *) ( (char *) (block) + (rel) )
25 typedef int REL_PTR;
27 /* full info for each shm block. */
28 struct shm_block {
29 /* private */
30 int next_shm_id; /* IPC shm ID (for initial linking) */
32 /* public (read only) */
33 int size; /* size of the shm block */
34 int free; /* how much of the block is free */
35 int proc_idx; /* The index of the owner */
37 /* public - writable for shm_fragment */
38 REL_PTR free_list; /* first item in the free list */
41 /* used for mapping local attachments */
42 struct local_shm_map {
43 struct local_shm_map *next;
44 int shm_id;
45 int proc_idx;
47 /* 32 bit pointer to the beginning of the block */
48 struct shm_block *ptr;
50 extern struct local_shm_map *shm_map;
51 void shm_setup_block(struct shm_block *block, REL_PTR first, int size);
53 /* shm_create_block:
54 * allocate and setup a new block:
55 * first - first non header byte.
56 * size - block size (in bytes).
57 * shm_id- IPC shared memory ID.
59 struct shm_block *shm_create_block(REL_PTR first, int size, int *shm_id);
61 /* shm_locate_block:
62 * locate existing block according to shm_id,
63 * Attach the block if needed. Assume the shm_id is wine's
64 * Set selectors also.
66 struct shm_block *shm_locate_block(int shm_id, struct local_shm_map *map);
68 /* shm_locate_attached_block:
69 * locate existing block according to shm_id,
70 * Blocks are never attached.
71 * if proc_idx is not NULL, it will be set to owner's index.
72 * map - localy mapped info about block may be NULL;
74 struct shm_block *shm_locate_attached_block(int shm_id,
75 struct local_shm_map *map);
77 /* shm_attach_block: attach existing shm block, setup selectors
78 * shm_id - id of the block to attach.
79 * proc_idx - if not -1, puts this data into local mapping
80 * map - localy mapped info about this block. (may be NULL)
81 * NOTE: same block can be attached many times
83 struct shm_block *shm_attach_block(int shm_id, int proc_idx,
84 struct local_shm_map *map);
86 /* delete chain of shm blocks (pointing to each other */
87 void shm_delete_chain(int *shmid);
89 #endif /* CONFIG_IPC */
90 #endif /* __WINE_SHM_BLOCK_H */