mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 21:58:10 +00:00
Stub out poll() syscall and LibC wrapper.
This commit is contained in:
parent
8bb18fdc56
commit
2bedabbd6c
10 changed files with 63 additions and 10 deletions
1
Kernel/.gitignore
vendored
1
Kernel/.gitignore
vendored
|
@ -4,3 +4,4 @@ Boot/boot.bin
|
||||||
kernel
|
kernel
|
||||||
kernel.map
|
kernel.map
|
||||||
_fs_contents
|
_fs_contents
|
||||||
|
sync-local.sh
|
||||||
|
|
|
@ -2002,6 +2002,13 @@ int Process::sys$select(const Syscall::SC_select_params* params)
|
||||||
return markedfds;
|
return markedfds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Process::sys$poll(pollfd* fds, int nfds, int timeout)
|
||||||
|
{
|
||||||
|
if (!validate_read_typed(fds))
|
||||||
|
return -EFAULT;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
Inode* Process::cwd_inode()
|
Inode* Process::cwd_inode()
|
||||||
{
|
{
|
||||||
// FIXME: This is retarded factoring.
|
// FIXME: This is retarded factoring.
|
||||||
|
|
|
@ -157,6 +157,7 @@ public:
|
||||||
int sys$munmap(void*, size_t size);
|
int sys$munmap(void*, size_t size);
|
||||||
int sys$set_mmap_name(void*, size_t, const char*);
|
int sys$set_mmap_name(void*, size_t, const char*);
|
||||||
int sys$select(const Syscall::SC_select_params*);
|
int sys$select(const Syscall::SC_select_params*);
|
||||||
|
int sys$poll(pollfd*, int nfds, int timeout);
|
||||||
ssize_t sys$get_dir_entries(int fd, void*, size_t);
|
ssize_t sys$get_dir_entries(int fd, void*, size_t);
|
||||||
int sys$getcwd(char*, size_t);
|
int sys$getcwd(char*, size_t);
|
||||||
int sys$chdir(const char*);
|
int sys$chdir(const char*);
|
||||||
|
|
|
@ -100,6 +100,8 @@ static dword handle(RegisterDump& regs, dword function, dword arg1, dword arg2,
|
||||||
return (dword)current->sys$mmap((const SC_mmap_params*)arg1);
|
return (dword)current->sys$mmap((const SC_mmap_params*)arg1);
|
||||||
case Syscall::SC_select:
|
case Syscall::SC_select:
|
||||||
return current->sys$select((const SC_select_params*)arg1);
|
return current->sys$select((const SC_select_params*)arg1);
|
||||||
|
case Syscall::SC_poll:
|
||||||
|
return current->sys$poll((pollfd*)arg1, (int)arg2, (int)arg3);
|
||||||
case Syscall::SC_munmap:
|
case Syscall::SC_munmap:
|
||||||
return current->sys$munmap((void*)arg1, (size_t)arg2);
|
return current->sys$munmap((void*)arg1, (size_t)arg2);
|
||||||
case Syscall::SC_gethostname:
|
case Syscall::SC_gethostname:
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
__ENUMERATE_SYSCALL(gui_get_window_parameters) \
|
__ENUMERATE_SYSCALL(gui_get_window_parameters) \
|
||||||
__ENUMERATE_SYSCALL(gui_set_window_parameters) \
|
__ENUMERATE_SYSCALL(gui_set_window_parameters) \
|
||||||
__ENUMERATE_SYSCALL(unlink) \
|
__ENUMERATE_SYSCALL(unlink) \
|
||||||
|
__ENUMERATE_SYSCALL(poll) \
|
||||||
|
|
||||||
|
|
||||||
struct fd_set;
|
struct fd_set;
|
||||||
|
|
|
@ -291,3 +291,16 @@ struct stat {
|
||||||
time_t st_mtime; /* time of last modification */
|
time_t st_mtime; /* time of last modification */
|
||||||
time_t st_ctime; /* time of last status change */
|
time_t st_ctime; /* time of last status change */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define POLLIN (1u << 0)
|
||||||
|
#define POLLPRI (1u << 2)
|
||||||
|
#define POLLOUT (1u << 3)
|
||||||
|
#define POLLERR (1u << 4)
|
||||||
|
#define POLLHUP (1u << 5)
|
||||||
|
#define POLLNVAL (1u << 6)
|
||||||
|
|
||||||
|
struct pollfd {
|
||||||
|
int fd;
|
||||||
|
short events;
|
||||||
|
short revents;
|
||||||
|
};
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
cp ../../figlet-2.2.5/figlet mnt/bin/
|
|
||||||
mkdir -p mnt/usr/local/share/figlet
|
|
||||||
FIGLET_FONTDIR=/
|
|
||||||
cp ../../figlet-2.2.5/fonts/standard.flf mnt/$FIGLET_FONTDIR
|
|
||||||
cp ../../figlet-2.2.5/fonts/big.flf mnt/$FIGLET_FONTDIR
|
|
||||||
cp ../../figlet-2.2.5/fonts/slant.flf mnt/$FIGLET_FONTDIR
|
|
||||||
cp ../../figlet-2.2.5/fonts/lean.flf mnt/$FIGLET_FONTDIR
|
|
||||||
|
|
||||||
cp ../../bash-2.05b/bash mnt/bin/bash
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ LIBC_OBJS = \
|
||||||
utime.o \
|
utime.o \
|
||||||
gui.o \
|
gui.o \
|
||||||
sys/select.o \
|
sys/select.o \
|
||||||
|
poll.o \
|
||||||
entry.o
|
entry.o
|
||||||
|
|
||||||
OBJS = $(AK_OBJS) $(WIDGETS_OBJS) $(LIBC_OBJS) $(SHAREDGRAPHICS_OBJS)
|
OBJS = $(AK_OBJS) $(WIDGETS_OBJS) $(LIBC_OBJS) $(SHAREDGRAPHICS_OBJS)
|
||||||
|
|
14
LibC/poll.cpp
Normal file
14
LibC/poll.cpp
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#include <poll.h>
|
||||||
|
#include <Kernel/Syscall.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
int poll(struct pollfd* fds, int nfds, int timeout)
|
||||||
|
{
|
||||||
|
int rc = syscall(SC_poll, fds, nfds, timeout);
|
||||||
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
23
LibC/poll.h
Normal file
23
LibC/poll.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define POLLIN (1u << 0)
|
||||||
|
#define POLLPRI (1u << 2)
|
||||||
|
#define POLLOUT (1u << 3)
|
||||||
|
#define POLLERR (1u << 4)
|
||||||
|
#define POLLHUP (1u << 5)
|
||||||
|
#define POLLNVAL (1u << 6)
|
||||||
|
|
||||||
|
struct pollfd {
|
||||||
|
int fd;
|
||||||
|
short events;
|
||||||
|
short revents;
|
||||||
|
};
|
||||||
|
|
||||||
|
int poll(struct pollfd* fds, int nfds, int timeout);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue