0x10cAtlas / AtlasOS

An operating system for DCPU-16.
109 stars 15 forks source link

libSystem.so and system.h #68

Open xcvista opened 11 years ago

xcvista commented 11 years ago

I am checking the API and found some APIs that should be slightly modified to fully support C language. And you can provide a pseudo-library called libSystem.so that contains only an export table that exposes all those system calls to C API and (dynamic) linker will be able to locate them without taking care of system version. A system.h can be provided with libSystem.so so that all functions are prototyped.

By the way, you should check POSIX for some methods you named differently as POSIX did.

xcvista commented 11 years ago

// system.h

include

typedef unsigned short pid_t; typedef unsigned short proc_flags_t; typedef unsigned short size_t; typedef void (proc_callback_t )(pid_t pid); typedef void msg_queue_t;

short os_version(short min_version); pid_t getpid(void); // pid_t proc_id(void); as in POSIX void proc_suspend(void); void proc_get_addr(void); proc_flags_t proc_get_flags(void); void exit(void); // void proc_kill_me(void); as in POSIX void kill(pid_t pid); // void proc_kill(pid_t); as in POSIX void proc_load(void *start, size_t length); // preserved void proc_callback_list(proc_callback_t callback); bool msg_queue_reg(msg_queue_t queue); // ...