diff options
author | Ian McFarlane <i.mcfarlane2002@gmail.com> | 2025-05-02 02:30:43 -0400 |
---|---|---|
committer | Ian McFarlane <i.mcfarlane2002@gmail.com> | 2025-05-02 02:30:43 -0400 |
commit | 7887fb739daa278ee92db79d0192fadec8262049 (patch) | |
tree | 11fc944de71bfa53939d8327197eea917e7bd872 /user/include | |
parent | Add allocshared() and popsharedmem() syscalls (diff) | |
download | comus-7887fb739daa278ee92db79d0192fadec8262049.tar.gz comus-7887fb739daa278ee92db79d0192fadec8262049.tar.bz2 comus-7887fb739daa278ee92db79d0192fadec8262049.zip |
added keypoll syscall and synchronization for forkman
Diffstat (limited to 'user/include')
-rw-r--r-- | user/include/unistd.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/user/include/unistd.h b/user/include/unistd.h index 27b6d31..e817c84 100644 --- a/user/include/unistd.h +++ b/user/include/unistd.h @@ -14,6 +14,12 @@ /* System Call Definitions */ +// NOTE: needs to match kernel input.h +struct keycode { + char key; + char flags; +}; + typedef unsigned short pid_t; enum { @@ -195,7 +201,7 @@ extern void *sbrk(intptr_t increment); * @return pointer to the virtual address which will be accessible by both, * after popsharedmem() is called. */ -extern void* allocshared(size_t num_pages, int other_pid); +extern void *allocshared(size_t num_pages, int other_pid); /** * Checks if another process has tried to share memory with us, and return it. @@ -207,7 +213,16 @@ extern void* allocshared(size_t num_pages, int other_pid); * process has tried to share with us, or NULL if we the shared virtual address * space is already occupied in the caller's pagetable. */ -extern void* popsharedmem(void); +extern void *popsharedmem(void); + +/** + * Get the most recent key event, if there is one. + * + * @param poll the keycode to write out to + * @return 0 if there was no key event, in which case `poll` was not changed, or + * 1 if there was an event and the caller should read from `poll`. + */ +extern int keypoll(struct keycode *poll); /** * Poweroff the system. |