OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

shmem_types.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2005 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
13 * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
14 * Copyright (c) 2010 IBM Corporation. All rights reserved.
15 * Copyright (c) 2010-2011 Los Alamos National Security, LLC.
16 * All rights reserved.
17 * $COPYRIGHT$
18 *
19 * Additional copyrights may follow
20 *
21 * $HEADER$
22 */
23
24 /**
25 * @file
26 *
27 * shmem (shared memory backing facility) framework types, convenience macros,
28 * etc.
29 */
30
31 #ifndef OPAL_SHMEM_TYPES_H
32 #define OPAL_SHMEM_TYPES_H
33
34 #include "opal_config.h"
35
36 BEGIN_C_DECLS
37
38 /* ////////////////////////////////////////////////////////////////////////// */
39 /**
40 * ds_buf: pointer to opal_shmem_ds_t typedef'd struct
41 */
42
43 /**
44 * flag indicating the state (valid/invalid) of the shmem data structure
45 * 0x0* - reserved for non-internal flags
46 */
47 #define OPAL_SHMEM_DS_FLAGS_VALID 0x01
48
49 /**
50 * 0x1* - reserved for internal flags. that is, flags that will NOT be
51 * propagated via ds_copy during inter-process information sharing.
52 */
53
54 /**
55 * masks out internal flags
56 */
57 #define OPAL_SHMEM_DS_FLAGS_INTERNAL_MASK 0x0F
58
59 /**
60 * invalid id value
61 */
62 #define OPAL_SHMEM_DS_ID_INVALID -1
63
64 /**
65 * macro that sets all bits in flags to 0
66 */
67 #define OPAL_SHMEM_DS_RESET_FLAGS(ds_buf) \
68 do { \
69 (ds_buf)->flags = 0x00; \
70 } while (0)
71
72 /**
73 * sets valid bit in flags to 1
74 */
75 #define OPAL_SHMEM_DS_SET_VALID(ds_buf) \
76 do { \
77 (ds_buf)->flags |= OPAL_SHMEM_DS_FLAGS_VALID; \
78 } while (0)
79
80 /**
81 * sets valid bit in flags to 0
82 */
83 #define OPAL_SHMEM_DS_INVALIDATE(ds_buf) \
84 do { \
85 (ds_buf)->flags &= ~OPAL_SHMEM_DS_FLAGS_VALID; \
86 } while (0)
87
88 /**
89 * evaluates to 1 if the valid bit in flags is set to 1. evaluates to 0
90 * otherwise.
91 */
92 #define OPAL_SHMEM_DS_IS_VALID(ds_buf) \
93 ( (ds_buf)->flags & OPAL_SHMEM_DS_FLAGS_VALID )
94
95 /* ////////////////////////////////////////////////////////////////////////// */
96 typedef uint8_t opal_shmem_ds_flag_t;
97
98 /* shared memory segment header */
99 struct opal_shmem_seg_hdr_t {
100 /* segment lock */
101 opal_atomic_lock_t lock;
102 /* pid of the segment creator */
103 pid_t cpid;
104 };
105 typedef struct opal_shmem_seg_hdr_t opal_shmem_seg_hdr_t;
106
107 struct opal_shmem_ds_t {
108 /* pid of the shared memory segment creator */
109 pid_t seg_cpid;
110 /* state flags */
111 opal_shmem_ds_flag_t flags;
112 /* ds id */
113 int seg_id;
114 /* size of shared memory segment */
115 size_t seg_size;
116 /* path to backing store */
117 char seg_name[OPAL_PATH_MAX];
118 /* base address of shared memory segment */
119 unsigned char *seg_base_addr;
120 };
121 typedef struct opal_shmem_ds_t opal_shmem_ds_t;
122
123 END_C_DECLS
124
125 #endif /* OPAL_SHMEM_TYPES_H */
opal_shmem_seg_hdr_t
Definition: shmem_types.h:99
opal_atomic_lock_t
Volatile lock object (with optional padding).
Definition: atomic.h:102
opal_shmem_ds_t
Definition: shmem_types.h:107