2012-02-06 04:12:50 +04:00
|
|
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SHM_H
|
|
|
|
#define SHM_H
|
|
|
|
|
2013-04-25 07:20:34 +04:00
|
|
|
#include <system.h>
|
2012-02-06 04:12:50 +04:00
|
|
|
#include <types.h>
|
|
|
|
|
2012-02-06 05:56:21 +04:00
|
|
|
#define SHM_PATH_SEPARATOR "."
|
|
|
|
|
2012-02-06 00:16:59 +04:00
|
|
|
/* Types */
|
|
|
|
struct shm_node;
|
|
|
|
|
2012-02-06 04:12:50 +04:00
|
|
|
typedef struct {
|
2012-02-06 00:16:59 +04:00
|
|
|
struct shm_node * parent;
|
|
|
|
volatile uint8_t lock;
|
|
|
|
int32_t ref_count;
|
|
|
|
|
|
|
|
uint32_t num_frames;
|
|
|
|
uintptr_t *frames;
|
|
|
|
} shm_chunk_t;
|
|
|
|
|
|
|
|
typedef struct shm_node {
|
2012-02-06 04:12:50 +04:00
|
|
|
char name[256];
|
2012-02-06 00:16:59 +04:00
|
|
|
shm_chunk_t * chunk;
|
2012-02-06 04:12:50 +04:00
|
|
|
} shm_node_t;
|
|
|
|
|
2012-02-06 00:16:59 +04:00
|
|
|
typedef struct {
|
|
|
|
shm_chunk_t * chunk;
|
|
|
|
uint8_t volatile lock;
|
|
|
|
|
|
|
|
uint32_t num_vaddrs;
|
|
|
|
uintptr_t *vaddrs;
|
|
|
|
} shm_mapping_t;
|
|
|
|
|
|
|
|
/* Syscalls */
|
2013-06-06 10:10:36 +04:00
|
|
|
extern void * shm_obtain(char * path, size_t * size);
|
|
|
|
extern int shm_release(char * path);
|
2012-02-06 00:16:59 +04:00
|
|
|
|
|
|
|
/* Other exposed functions */
|
2013-06-06 10:10:36 +04:00
|
|
|
extern void shm_install(void);
|
|
|
|
extern void shm_release_all(process_t * proc);
|
2012-02-06 04:12:50 +04:00
|
|
|
|
|
|
|
#endif
|