From 5f750c175569e11a01902f5ea443fe5e9b7918e4 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 9 Mar 2014 15:14:46 +0800 Subject: [PATCH 1/1] Usermode/libposix - Stubbed functions for bochs --- Usermode/Libraries/libposix.so_src/Makefile | 2 +- .../libposix.so_src/include_exp/sys/types.h | 8 ++++++-- Usermode/Libraries/libposix.so_src/unistd.c | 6 ++++++ Usermode/Libraries/libposix.so_src/utime.c | 19 +++++++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 Usermode/Libraries/libposix.so_src/utime.c diff --git a/Usermode/Libraries/libposix.so_src/Makefile b/Usermode/Libraries/libposix.so_src/Makefile index 30c4cd2e..dcbf8f53 100644 --- a/Usermode/Libraries/libposix.so_src/Makefile +++ b/Usermode/Libraries/libposix.so_src/Makefile @@ -11,7 +11,7 @@ LDFLAGS += -soname libposix.so -Map map.txt -lc OBJ = main.o unistd.o dirent.o stat.o utmpx.o termios.o OBJ += pwd.o syslog.o sys_time.o sys_ioctl.o sys_resource.o OBJ += fcntl.o clocks.o sys_wait.o unistd_crypt.o -OBJ += grp.o pty.o mktemp.o +OBJ += grp.o pty.o mktemp.o utime.o DEPFILES := $(OBJ:%.o=%.d) BIN = libposix.so diff --git a/Usermode/Libraries/libposix.so_src/include_exp/sys/types.h b/Usermode/Libraries/libposix.so_src/include_exp/sys/types.h index 12238574..c94a65a8 100644 --- a/Usermode/Libraries/libposix.so_src/include_exp/sys/types.h +++ b/Usermode/Libraries/libposix.so_src/include_exp/sys/types.h @@ -5,10 +5,14 @@ #include +#define __USE_BSD 1 + //typedef signed int ssize_t; -//#ifdef __USE_BSD + +#ifdef __USE_BSD +typedef unsigned long u_long; typedef unsigned int u_int; -//#endif +#endif typedef struct stat t_fstat; diff --git a/Usermode/Libraries/libposix.so_src/unistd.c b/Usermode/Libraries/libposix.so_src/unistd.c index 64cb70f5..0f5bb38a 100644 --- a/Usermode/Libraries/libposix.so_src/unistd.c +++ b/Usermode/Libraries/libposix.so_src/unistd.c @@ -50,6 +50,12 @@ int open(const char *path, int openmode, ...) return ret; } +int access(const char *path, int openmode) +{ + errno = EINVAL; + return -1; +} + int creat(const char *path, mode_t mode) { // TODO: Make native call to do this cheaper diff --git a/Usermode/Libraries/libposix.so_src/utime.c b/Usermode/Libraries/libposix.so_src/utime.c new file mode 100644 index 00000000..de9483a8 --- /dev/null +++ b/Usermode/Libraries/libposix.so_src/utime.c @@ -0,0 +1,19 @@ +/* + * Acess2 POSIX Emulation Layer + * - By John Hodge + * + * utime.h + * - + */ +#include +#include + +// === CODE === +int utime(const char *filename, const struct utimbuf *times) +{ + _SysDebug("TODO: libposix utime('%s', {%lli,%lli})", + filename, times->actime, times->modtime + ); + return 0; +} + -- 2.20.1