Usermode - Cleaning up while attempting to port dropbear/openssl
authorJohn Hodge <[email protected]>
Thu, 26 Jan 2012 03:58:35 +0000 (11:58 +0800)
committerJohn Hodge <[email protected]>
Thu, 26 Jan 2012 03:58:35 +0000 (11:58 +0800)
Usermode/include/acess/intdefs.h [new file with mode: 0644]
Usermode/include/errno.h
Usermode/include/signal.h
Usermode/include/stdint.h
Usermode/include/stdio.h
Usermode/include/sys/stat.h
Usermode/include/sys/types.h
Usermode/include/time.h

diff --git a/Usermode/include/acess/intdefs.h b/Usermode/include/acess/intdefs.h
new file mode 100644 (file)
index 0000000..c33e7d5
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ */
+#ifndef _ACESS_INTDEFS_H_
+#define _ACESS_INTDEFS_H_
+
+#define INT_MIN        -0x80000000
+#define INT_MAX        0x7FFFFFFF
+
+typedef unsigned char  __uint8_t;
+typedef unsigned short __uint16_t;
+typedef unsigned int   __uint32_t;
+typedef unsigned long long     __uint64_t;
+
+typedef signed char            __int8_t;
+typedef signed short   __int16_t;
+typedef signed int             __int32_t;
+typedef signed long long       __int64_t;
+
+#if ARCHDIR_is_x86
+typedef __int32_t      __intptr_t;
+typedef __uint32_t     __uintptr_t;
+#elif ARCHDIR_is_x86_64
+typedef __int64_t      __intptr_t;
+typedef __uint64_t     __uintptr_t;
+#elif ARCHDIR_is_armv7
+typedef __int32_t      __intptr_t;
+typedef __uint32_t     __uintptr_t;
+#else
+# error "Unknown pointer size"
+#endif
+
+//typedef uint64_t     off_t;
+
+#endif
+
index 738541d..ea352f3 100644 (file)
@@ -3,13 +3,26 @@
 
 // TODO: Fully implement errno.h, make sure it matches the kernel one
 
+extern int     _errno;
 #define        errno   _errno
 
 #define strerror(_x)   "Unimplemented"
 
 enum
 {
-       EINVAL
+       EOK,
+       EINVAL,
+       ERANGE,
+       ENODEV,
+       EBADF,
+       EINTR,
+       EAGAIN,
+       ENOMEM,
+
+       EADDRNOTAVAIL,
+       EINPROGRESS,
+
+       E_LAST
 };
 
 #endif
index f71b2e7..cc72b00 100644 (file)
@@ -8,7 +8,13 @@
 #ifndef _SIGNAL_H_
 #define _SIGNAL_H_
 
+#define SIG_DFL        ((void*)0)
+#define SIG_ERR        ((void*)-1)
 
+#define        SIGABRT 6
+
+#define SIGPIPE        1001
+#define SIGCHLD        1002
 
 #endif
 
index d0f949e..5df57ea 100644 (file)
@@ -3,31 +3,22 @@
 #ifndef _STDINT_H_
 #define _STDINT_H_
 
+#include "acess/intdefs.h"
+
 #define INT_MIN        -0x80000000
 #define INT_MAX        0x7FFFFFFF
 
-typedef unsigned char  uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int   uint32_t;
-typedef unsigned long long     uint64_t;
-
-typedef signed char            int8_t;
-typedef signed short   int16_t;
-typedef signed int             int32_t;
-typedef signed long long       int64_t;
+typedef __uint8_t      uint8_t;
+typedef __uint16_t     uint16_t;
+typedef __uint32_t     uint32_t;
+typedef __uint64_t     uint64_t;
+typedef __int8_t       int8_t;
+typedef __int16_t      int16_t;
+typedef __int32_t      int32_t;
+typedef __int64_t      int64_t;
 
-#if ARCHDIR_is_x86
-typedef int32_t        intptr_t;
-typedef uint32_t       uintptr_t;
-#elif ARCHDIR_is_x86_64
-typedef int64_t        intptr_t;
-typedef uint64_t       uintptr_t;
-#elif ARCHDIR_is_armv7
-typedef int32_t        intptr_t;
-typedef uint32_t       uintptr_t;
-#else
-# error "Unknown pointer size"
-#endif
+typedef __intptr_t     intptr_t;
+typedef __uintptr_t    uintptr_t;
 
 //typedef uint64_t     off_t;
 
index 8d95065..be4f20a 100644 (file)
@@ -13,6 +13,7 @@ typedef struct sFILE  FILE;
 
 /* === CONSTANTS === */
 #define EOF    (-1)
+#define BUFSIZ 1024
 
 /* --- Standard IO --- */
 extern int     printf(const char *format, ...);
index 10384ba..ecd0fa3 100644 (file)
@@ -5,18 +5,19 @@
 #ifndef _SYS_STAT_H_
 #define _SYS_STAT_H_
 
-#include <stdint.h>    /* Evil */
-#include <stddef.h>
+#include <acess/intdefs.h>     /* Evil */
+#include "../stddef.h"
 
+;
 typedef void   *dev_t; /* TODO: How to identify a device with Acess */
-typedef uint64_t       ino_t;
+typedef __uint64_t     ino_t;
 typedef unsigned int   blksize_t;
-typedef uint64_t       blkcnt_t;
+typedef __uint64_t     blkcnt_t;
 typedef unsigned int   nlink_t;
-typedef uint32_t       mode_t;
+typedef __uint32_t     mode_t;
 
-typedef uint32_t       uid_t;
-typedef uint32_t       gid_t;
+typedef __uint32_t     uid_t;
+typedef __uint32_t     gid_t;
 
 #define        S_IFMT          0170000 /* type of file */
 #define                S_IFDIR 0040000 /* directory */
index 0cc50d1..206211d 100644 (file)
@@ -3,6 +3,8 @@
 #ifndef _SYS_TYPES_H
 #define _SYS_TYPES_H
 
+#include <acess/intdefs.h>
+
 typedef struct stat    t_fstat;
 
 #define FD_SETSIZE     128
@@ -52,6 +54,10 @@ extern void  FD_CLR(int fd, fd_set *fdsetp);
 extern void    FD_SET(int fd, fd_set *fdsetp);
 extern int     FD_ISSET(int fd, fd_set *fdsetp);
 
+typedef __uint8_t      u_int8_t;
+typedef __uint16_t     u_int16_t;
+typedef __uint32_t     u_int32_t;
+
 #include "../sys/stat.h"
 
 #endif
index 7861255..bd7afce 100644 (file)
@@ -8,6 +8,9 @@
 #ifndef _TIME_H_
 #define _TIME_H_
 
+#include <acess/intdefs.h>
+#include <sys/types.h> // time_t
+
 struct tm
 {
         int    tm_sec;
@@ -21,5 +24,11 @@ struct tm
         int    tm_isdst;
 };
 
+#define CLOCKS_PER_SEC 1000
+
+typedef signed long long       clock_t;
+
+extern clock_t clock();
+
 #endif
 

UCC git Repository :: git.ucc.asn.au