Reserving syscall numbers for shared memory

This commit is contained in:
Kevin Lange 2012-02-05 18:12:50 -06:00
parent b83fb0de13
commit aba36f4dce
3 changed files with 54 additions and 0 deletions

17
kernel/include/shm.h Normal file
View File

@ -0,0 +1,17 @@
/* vim: tabstop=4 shiftwidth=4 noexpandtab
*/
#ifndef SHM_H
#define SHM_H
#include <types.h>
typedef struct {
char name[256];
} shm_node_t;
char * shm_negotiate(char * shm_path, uintptr_t address, size_t * size);
int shm_free(char * shm_path);
#endif

34
kernel/mem/shm.c Normal file
View File

@ -0,0 +1,34 @@
/* vim: tabstop=4 shiftwidth=4 noexpandtab
*
* Shared Memory Negotiation
*
*/
#include <system.h>
#include <syscall.h>
#include <process.h>
#include <logging.h>
#include <fs.h>
#include <pipe.h>
#include <shm.h>
#include <tree.h>
#include <list.h>
tree_t * shm_tree = NULL;
void shm_install() {
LOG(INFO, "Installing SHM");
}
char * shm_negotiate(char * shm_path, uintptr_t address, size_t * size) {
/* Sanity check */
if (__builtin_expect(shm_tree == NULL, 0)) {
shm_tree = tree_create();
}
return 0;
}
int shm_free(char * shm_path) {
return 0;
}

View File

@ -10,6 +10,7 @@
#include <fs.h>
#include <pipe.h>
#include <version.h>
#include <shm.h>
#define SPECIAL_CASE_STDIO
@ -426,6 +427,8 @@ static uintptr_t syscalls[] = {
(uintptr_t)&gethostname, /* 32 */
(uintptr_t)&mousedevice,
(uintptr_t)&sys_mkdir,
(uintptr_t)&shm_negotiate,
(uintptr_t)&shm_free, /* 33 */
0
};
uint32_t num_syscalls;