56 строки
1.6 KiB
C
56 строки
1.6 KiB
C
#ifndef _MPOOL_SM_MMAP_H_
|
|
#define _MPOOL_SM_MMAP_H_
|
|
|
|
#include "class/ompi_object.h"
|
|
#include "os/atomic.h"
|
|
#include "class/ompi_list.h"
|
|
|
|
struct mca_mpool_sm_segment_t {
|
|
ompi_lock_data_t seg_lock;
|
|
volatile bool seg_inited;
|
|
size_t seg_offset;
|
|
size_t seg_size;
|
|
};
|
|
typedef struct mca_mpool_sm_segment_t mca_mpool_sm_segment_t;
|
|
|
|
|
|
struct mca_mpool_sm_mmap_t {
|
|
ompi_list_item_t map_item;
|
|
mca_mpool_sm_segment_t* map_seg;
|
|
unsigned char *map_addr;
|
|
size_t map_size;
|
|
char map_path[PATH_MAX];
|
|
};
|
|
typedef struct mca_mpool_sm_mmap_t mca_mpool_sm_mmap_t;
|
|
|
|
OBJ_CLASS_DECLARATION(mca_mpool_sm_mmap_t);
|
|
|
|
|
|
/**
|
|
* This routine is used to set up a shared memory file, backed
|
|
* by a specified file. It is assumed that the file does not
|
|
* exist before any of the current set of processes try and open
|
|
* it.
|
|
*
|
|
* @param size - size of the file, in bytes (IN)
|
|
*
|
|
* @param file_name name of file to be opened. (IN)
|
|
*
|
|
* @param size_ctl_structure size of the control structure at
|
|
* the head of the file. The control structure
|
|
* is assumed to have mca_mpool_sm_segment_t
|
|
* as its first segment (IN)
|
|
*
|
|
* @param data_set_alignment alignment of the data segment. this
|
|
* follows the control structure (IN)
|
|
*/
|
|
|
|
mca_mpool_sm_mmap_t* mca_mpool_sm_mmap_init(size_t size, char *file_name,
|
|
size_t size_ctl_structure, size_t data_seg_alignment);
|
|
void* mca_mpool_sm_mmap_alloc(size_t* size);
|
|
void mca_mpool_sm_mmap_free(void* addr);
|
|
|
|
|
|
#endif
|
|
|