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";
}
# 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
CFLAGS += -Wall
LDFLAGS += -lc -soname libpthread.so
-OBJ = main.o
+OBJ = main.o thread.o
BIN = libpthread.so
include ../Makefile.tpl
{
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);
--- /dev/null
+/*
+ * 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");
+}
--- /dev/null
+# 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
+
--- /dev/null
+/*
+ * 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
+
--- /dev/null
+/*
+ */
+#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
+
--- /dev/null
+/*
+ */
+
+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;
+}
+