toaruos/base/usr/include/kernel/shm.h

42 lines
754 B
C
Raw Normal View History

2018-03-16 15:56:19 +03:00
/* vim: tabstop=4 shiftwidth=4 noexpandtab
*/
#pragma once
2021-05-31 04:47:02 +03:00
#include <stddef.h>
#include <stdint.h>
2018-03-19 05:38:11 +03:00
#include <kernel/types.h>
2018-03-16 15:56:19 +03:00
#define SHM_PATH_SEPARATOR "."
/* Types */
struct shm_node;
typedef struct {
struct shm_node * parent;
volatile uint8_t lock;
2021-05-31 04:47:02 +03:00
ssize_t ref_count;
size_t num_frames;
2018-03-16 15:56:19 +03:00
uintptr_t *frames;
} shm_chunk_t;
typedef struct shm_node {
char name[256];
shm_chunk_t * chunk;
} shm_node_t;
typedef struct {
shm_chunk_t * chunk;
uint8_t volatile lock;
2021-05-31 04:47:02 +03:00
size_t num_vaddrs;
2018-03-16 15:56:19 +03:00
uintptr_t *vaddrs;
} shm_mapping_t;
/* Syscalls */
extern void * shm_obtain(char * path, size_t * size);
extern int shm_release(char * path);
/* Other exposed functions */
extern void shm_install(void);
extern void shm_release_all(process_t * proc);