Usermode - More hackery to get glib compiling
authorJohn Hodge <[email protected]>
Thu, 11 Dec 2014 09:33:53 +0000 (17:33 +0800)
committerJohn Hodge <[email protected]>
Thu, 11 Dec 2014 09:33:53 +0000 (17:33 +0800)
Usermode/Libraries/libc.so_src/errno.c
Usermode/Libraries/libc.so_src/include_exp/stdlib.h
Usermode/Libraries/libpthread.so_src/Makefile
Usermode/Libraries/libpthread.so_src/include_exp/pthread.h
Usermode/Libraries/libpthread.so_src/thread.c [new file with mode: 0644]
Usermode/Libraries/libresolv.so_src/Makefile [new file with mode: 0644]
Usermode/Libraries/libresolv.so_src/include_exp/arpa/nameser.h [new file with mode: 0644]
Usermode/Libraries/libresolv.so_src/include_exp/resolv.h [new file with mode: 0644]
Usermode/Libraries/libresolv.so_src/resolv.c [new file with mode: 0644]

index f5a142a..295183c 100644 (file)
@@ -56,6 +56,7 @@ EXPORT char *strerror(int errnum)
        case EAFNOSUPPORT:      return "Address family not supported";
        case EADDRINUSE:        return "Address already in use";
        case ETIMEDOUT: return "Operation timed out";
+       case EOPNOTSUPP:        return "Operation not supported on socket";
 
        case EINTERNAL: return "Internal error";
        }
index 07fc81f..fa923ee 100644 (file)
@@ -112,6 +112,8 @@ extern int  rand_p(unsigned int *seedp);
 # define SEEK_END      (-1)\r
 #endif\r
 \r
+#define MB_CUR_MAX     5       // (C99) Max number of bytes in a single multibyte character (UTF8=5)\r
+\r
 #ifdef __cplusplus\r
 }\r
 #endif\r
index fe3fc8c..0870c0c 100644 (file)
@@ -6,7 +6,7 @@ CPPFLAGS +=
 CFLAGS   += -Wall
 LDFLAGS  += -lc -soname libpthread.so
 
-OBJ = main.o
+OBJ = main.o thread.o
 BIN = libpthread.so
 
 include ../Makefile.tpl
index 8f4f779..376fb0e 100644 (file)
@@ -60,7 +60,7 @@ struct pthread_mutex_s
 {
        void*   futex;
 };
-#define PTHREAD_MUTEX_INITIALIZER      ((struct pthread_mutex_s){NULL})
+#define PTHREAD_MUTEX_INITIALIZER      ((struct pthread_mutex_s){0})
 typedef struct pthread_mutex_s pthread_mutex_t;
 extern int pthread_mutex_init(pthread_mutex_t * mutex, const pthread_mutexattr_t *attrs);
 extern int pthread_mutex_lock(pthread_mutex_t *lock);
diff --git a/Usermode/Libraries/libpthread.so_src/thread.c b/Usermode/Libraries/libpthread.so_src/thread.c
new file mode 100644 (file)
index 0000000..4b5f51f
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Acess2 libpthread
+ * - By John Hodge (thePowersGang)
+ *
+ * thread.c
+ * - Thread management for pthreads
+ */
+#include <pthread.h>
+#include <assert.h>
+
+int pthread_create(pthread_t *threadptr, const pthread_attr_t * attrs, void* (*fcn)(void*), void* arg)
+{
+       assert(!"TODO: pthread_create");
+       return 0;
+}
+int pthread_detach(pthread_t thread)
+{
+       assert(!"TODO: pthread_detach");
+       return 0;
+}
+int pthread_join(pthread_t thread, void **retvalptr)
+{
+       assert(!"TODO: pthread_join");
+       return 0;
+}
+int pthread_cancel(pthread_t thread)
+{
+       assert(!"TODO: pthread_cancel");
+       return 0;
+}
+int pthread_equal(pthread_t t1, pthread_t t2)
+{
+       assert(!"TODO: pthread_equal");
+       return 0;
+}
+pthread_t pthread_self(void)
+{
+       assert(!"TODO: pthread_self");
+       return (pthread_t){0};
+}
+void pthread_exit(void* retval)
+{
+       assert(!"TODO: pthread_create");
+}
diff --git a/Usermode/Libraries/libresolv.so_src/Makefile b/Usermode/Libraries/libresolv.so_src/Makefile
new file mode 100644 (file)
index 0000000..21eb942
--- /dev/null
@@ -0,0 +1,16 @@
+# Acess2 BSD "resolv" library
+# Makefile
+
+-include ../Makefile.cfg
+
+CPPFLAGS += 
+CFLAGS   += -Wextra
+ASFLAGS  +=
+LDFLAGS  += 
+LIBS     += -lnet -lpsocket
+
+OBJ  = resolv.o
+BIN = libresolv.so
+
+include ../Makefile.tpl
+
diff --git a/Usermode/Libraries/libresolv.so_src/include_exp/arpa/nameser.h b/Usermode/Libraries/libresolv.so_src/include_exp/arpa/nameser.h
new file mode 100644 (file)
index 0000000..5f2532b
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Acess2 POSIX Sockets Emulation
+ * - By John Hodge (thePowersGang)
+ *
+ * arpa/nameser.h
+ * - BSD name resolution (TODO: move to libresolv)
+ *
+ * NOTE: I have no fucking idea who/what defines this header, it's wanted by glib
+ */
+#ifndef _LIBPSOCKET__ARPA_NAMESER_H_
+#define _LIBPSOCKET__ARPA_NAMESER_H_
+
+#define C_IN   0x1
+
+#endif
+
diff --git a/Usermode/Libraries/libresolv.so_src/include_exp/resolv.h b/Usermode/Libraries/libresolv.so_src/include_exp/resolv.h
new file mode 100644 (file)
index 0000000..66d9657
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ */
+#ifndef _LIBRESOLV__RESOLV_H_
+#define _LIBRESOLV__RESOLV_H_
+
+extern int res_init(void);
+
+extern int res_query(const char *dname, int class, int type, unsigned char *answer, int anslen);
+
+extern int res_search(const char *dname, int class, int type, unsigned char *answer, int anslen);
+
+extern int res_querydomain(const char *name, const char *domain, int class, int type, unsigned char *answer, int anslen);
+
+extern int res_mkquery(int op, const char *dname, int class, int type, char *data, int datalen, struct rrec *newrr, char *buf, int buflen);
+
+extern int res_send(const char *msg, int msglen, char *answer, int anslen);
+
+
+#endif
+
diff --git a/Usermode/Libraries/libresolv.so_src/resolv.c b/Usermode/Libraries/libresolv.so_src/resolv.c
new file mode 100644 (file)
index 0000000..e8d121b
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ */
+
+int res_init(void)
+{
+       return 1;
+}
+
+int res_query(const char *dname, int class, int type, unsigned char *answer, int anslen)
+{
+       return 1;
+}
+
+int res_search(const char *dname, int class, int type, unsigned char *answer, int anslen)
+{
+       return 1;
+}
+
+int res_querydomain(const char *name, const char *domain, int class, int type, unsigned char *answer, int anslen)
+{
+       return 1;
+}
+
+int res_mkquery(int op, const char *dname, int class, int type, char *data, int datalen, struct rrec *newrr, char *buf, int buflen)
+{
+       return 1;
+}
+
+int res_send(const char *msg, int msglen, char *answer, int anslen)
+{
+       return 1;
+}
+

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