Skip to content
This repository has been archived by the owner on May 29, 2018. It is now read-only.

libSystem.so and system.h #68

Open
xcvista opened this issue Apr 3, 2013 · 1 comment
Open

libSystem.so and system.h #68

xcvista opened this issue Apr 3, 2013 · 1 comment

Comments

@xcvista
Copy link

xcvista commented Apr 3, 2013

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
Copy link
Author

xcvista commented Apr 3, 2013

// system.h
#include <stdbool.h>

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);
// ...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant