All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m24s
81 lines
1.8 KiB
C
81 lines
1.8 KiB
C
#ifndef _LIBMSL_M_SYSTEM_H
|
|
#define _LIBMSL_M_SYSTEM_H
|
|
|
|
#include <desc.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#if defined(__x86_64__)
|
|
#define PAGE_SIZE 4096
|
|
#endif
|
|
|
|
#define MAP_PRESENT (1 << 0)
|
|
#define MAP_RW (1 << 1)
|
|
#define MAP_USER (1 << 2)
|
|
#define MAP_FLAGS (MAP_PRESENT | MAP_USER)
|
|
|
|
/* Quit the current running process */
|
|
int quit (void);
|
|
|
|
/* Test syscall */
|
|
int test (char c);
|
|
|
|
/* Give the CPU to another process */
|
|
int sched (void);
|
|
|
|
/* map memory into this procgrou[ */
|
|
void* map (uintptr_t vaddr, size_t pages, uint32_t flags);
|
|
|
|
/* unmap memory from this procgrou[ */
|
|
int unmap (uintptr_t vaddr, size_t pages);
|
|
|
|
/* Clone process with argument and entry point */
|
|
int clone (uintptr_t vstack_top, void (*entry) (void), void* argument_ptr);
|
|
|
|
/* Create a mutex */
|
|
int mutex_create (int mutex_rid);
|
|
|
|
/* Delete a mutex. Will wake up waiters */
|
|
int mutex_delete (int mutex_rid);
|
|
|
|
/* Lock a mutex */
|
|
int mutex_lock (int mutex_rid);
|
|
|
|
/* Unlock a mutex */
|
|
int mutex_unlock (int mutex_rid);
|
|
|
|
/* get current process argument pointer */
|
|
void* argument_ptr (void);
|
|
|
|
/* Call a device command */
|
|
int device_do (int device_id, int cmd, void* a1, void* a2, void* a3, void* a4);
|
|
|
|
/* Run external ELF program */
|
|
int exec (const char* path);
|
|
|
|
/* Open a file */
|
|
int open (const char* path);
|
|
|
|
/* Close a file */
|
|
int close (const char* path);
|
|
|
|
/* Read a file */
|
|
int read (const char* path, size_t off, uint8_t* buffer, size_t size);
|
|
|
|
/* describe a file */
|
|
int describe (const char* path, struct desc* desc);
|
|
|
|
/* send a message to a procgroup's mail */
|
|
int mail_send (int pgid, void* mesg, size_t mesg_size);
|
|
|
|
/* receive a message from mail */
|
|
int mail_receive (void* mesg, size_t mesg_size);
|
|
|
|
/* get procgroup id of a perticular process */
|
|
int get_procgroup (int pid);
|
|
|
|
/* get PID of process, which exec'ed the current process */
|
|
int get_exec_pid (void);
|
|
|
|
#endif // _LIBMSL_M_SYSTEM_H
|