diff --git a/src/api/monetary.c b/src/api/monetary.c new file mode 100644 index 0000000..b39667e --- /dev/null +++ b/src/api/monetary.c @@ -0,0 +1,10 @@ +#include +#define T(t) (t*)0; +static void f() +{ +T(locale_t) +T(size_t) +T(ssize_t) +ssize_t(*p_strfmon)(char*restrict,size_t,const char*restrict,...) = strfmon; +ssize_t(*p_strfmon_l)(char*restrict,size_t,locale_t,const char*restrict,...) = strfmon_l; +} diff --git a/src/api/mqueue.c b/src/api/mqueue.c new file mode 100644 index 0000000..cbb0401 --- /dev/null +++ b/src/api/mqueue.c @@ -0,0 +1,30 @@ +#include +#define T(t) (t*)0; +#define F(t,n) {t *y = &x.n;} +static void f() +{ +T(mqd_t) +T(pthread_attr_t) +T(size_t) +T(ssize_t) +T(struct timespec) +T(struct sigevent) +{ +struct mq_attr x; +F(long, mq_flags) +F(long, mq_maxmsg) +F(long, mq_msgsize) +F(long, mq_curmsgs) +} +int(*p_mq_close)(mqd_t) = mq_close; +int(*p_mq_getattr)(mqd_t,struct mq_attr*) = mq_getattr; +int(*p_mq_notify)(mqd_t,const struct sigevent*) = mq_notify; +mqd_t(*p_mq_open)(const char*,int,...) = mq_open; +ssize_t(*p_mq_receive)(mqd_t,char*,size_t,unsigned*) = mq_receive; +int(*p_mq_send)(mqd_t,const char*,size_t,unsigned) = mq_send; +int(*p_mq_setattr)(mqd_t,const struct mq_attr*restrict,struct mq_attr*restrict) = mq_setattr; +int(*p_mq_unlink)(const char*) = mq_unlink; +#include +ssize_t(*p_mq_timedreceive)(mqd_t,char*restrict,size_t,unsigned*restrict,const struct timespec*restrict) = mq_timedreceive; +int(*p_mq_timedsend)(mqd_t,const char*,size_t,unsigned,const struct timespec*) = mq_timedsend; +} diff --git a/src/api/ndbm.c b/src/api/ndbm.c new file mode 100644 index 0000000..8df2187 --- /dev/null +++ b/src/api/ndbm.c @@ -0,0 +1,25 @@ +#include +#define T(t) (t*)0; +#define F(t,n) {t *y = &x.n;} +#define C(n) switch(n){case n:;} +static void f() +{ +T(size_t) +T(DBM) +{ +datum x; +F(void*, dptr) +F(size_t, dsize) +} +C(DBM_INSERT) +C(DBM_REPLACE) +int(*p_dbm_clearerr)(DBM*) = dbm_clearerr; +void(*p_dbm_close)(DBM*) = dbm_close; +int(*p_dbm_delete)(DBM*,datum) = dbm_delete; +int(*p_dbm_error)(DBM*) = dbm_error; +datum(*p_dbm_fetch)(DBM*,datum) = dbm_fetch; +datum(*p_dbm_firstkey)(DBM*) = dbm_firstkey; +datum(*p_dbm_nextkey)(DBM*) = dbm_nextkey; +DBM*(*p_dbm_open)(const char*,int,mode_t) = dbm_open; +int(*p_dbm_store)(DBM*,datum,datum,int) = dbm_store; +} diff --git a/src/api/net_if.c b/src/api/net_if.c new file mode 100644 index 0000000..6886caa --- /dev/null +++ b/src/api/net_if.c @@ -0,0 +1,16 @@ +#include +#define F(t,n) {t *y = &x.n;} +#define C(n) switch(n){case n:;} +static void f() +{ +{ +struct if_nameindex x; +F(unsigned, if_index) +F(char*, if_name) +} +C(IF_NAMESIZE) +void(*p_if_freenameindex)(struct if_nameindex*) = if_freenameindex; +char*(*p_if_indextoname)(unsigned,char*) = if_indextoname; +struct if_nameindex*(*p_if_nameindex)(void) = if_nameindex; +unsigned(*p_if_nametoindex)(const char*) = if_nametoindex; +} diff --git a/src/api/netdb.c b/src/api/netdb.c new file mode 100644 index 0000000..c8b223c --- /dev/null +++ b/src/api/netdb.c @@ -0,0 +1,91 @@ +#include +#define T(t) (t*)0; +#define F(t,n) {t *y = &x.n;} +#define C(n) switch(n){case n:;} +static void f() +{ +T(uint32_t) +T(socklen_t) +C(IPPORT_RESERVED) +{ +struct hostent x; +F(char*, h_name) +F(char**, h_aliases) +F(int, h_addrtype) +F(int, h_length) +F(char**, h_addr_list) +} +{ +struct netent x; +F(char*, n_name) +F(char**, n_aliases) +F(int, n_addrtype) +F(uint32_t, n_net) +} +{ +struct protoent x; +F(char*, p_name) +F(char**, p_aliases) +F(int, p_proto) +} +{ +struct servent x; +F(char*, s_name) +F(char**, s_aliases) +F(int, s_port) +F(char*, s_proto) +} +{ +struct addrinfo x; +F(int, ai_flags) +F(int, ai_family) +F(int, ai_socktype) +F(int, ai_protocol) +F(socklen_t, ai_addrlen) +F(struct sockaddr*, ai_addr) +F(char*, ai_canonname) +F(struct addrinfo*, ai_next) +} +C(AI_PASSIVE) +C(AI_CANONNAME) +C(AI_NUMERICHOST) +C(AI_NUMERICSERV) +C(AI_V4MAPPED) +C(AI_ALL) +C(AI_ADDRCONFIG) +C(NI_NOFQDN) +C(NI_NUMERICHOST) +C(NI_NAMEREQD) +C(NI_NUMERICSERV) +C(NI_NUMERICSCOPE) +C(NI_DGRAM) +C(EAI_AGAIN) +C(EAI_BADFLAGS) +C(EAI_FAIL) +C(EAI_FAMILY) +C(EAI_MEMORY) +C(EAI_NONAME) +C(EAI_SERVICE) +C(EAI_SOCKTYPE) +C(EAI_SYSTEM) +C(EAI_OVERFLOW) +void(*p_endhostent)(void) = endhostent; +void(*p_endnetent)(void) = endnetent; +void(*p_endprotoent)(void) = endprotoent; +void(*p_endservent)(void) = endservent; +const char*(*p_gai_strerror)(int) = gai_strerror; +struct hostent*(*p_gethostent)(void) = gethostent; +struct netent*(*p_getnetbyaddr)(uint32_t,int) = getnetbyaddr; +struct netent*(*p_getnetbyname)(const char*) = getnetbyname; +struct netent*(*p_getnetent)(void) = getnetent; +struct protoent*(*p_getprotobyname)(const char*) = getprotobyname; +struct protoent*(*p_getprotobynumber)(int) = getprotobynumber; +struct protoent*(*p_getprotoent)(void) = getprotoent; +struct servent*(*p_getservbyname)(const char*,const char*) = getservbyname; +struct servent*(*p_getservbyport)(int,const char*) = getservbyport; +struct servent*(*p_getservent)(void) = getservent; +void(*p_sethostent)(int) = sethostent; +void(*p_setnetent)(int) = setnetent; +void(*p_setprotoent)(int) = setprotoent; +void(*p_setservent)(int) = setservent; +} diff --git a/src/api/netinet_in.c b/src/api/netinet_in.c new file mode 100644 index 0000000..c8b8032 --- /dev/null +++ b/src/api/netinet_in.c @@ -0,0 +1,77 @@ +#include +#define T(t) (t*)0; +#define F(t,n) {t *y = &x.n;} +#define C(n) switch(n){case n:;} +#define I(n) {int i = n;} +static void f() +{ +T(in_port_t) +T(in_addr_t) +T(sa_family_t) +T(uint8_t) +T(uint32_t) +{ +struct in_addr x; +F(in_addr_t, s_addr) +} +{ +struct sockaddr_in x; +F(sa_family_t, sin_family) +F(in_port_t, sin_port) +F(struct in_addr, sin_addr) +} +{ +struct in6_addr x; +F(uint8_t, s6_addr[16]) +} +{ +struct sockaddr_in6 x; +F(sa_family_t, sin6_family) +F(in_port_t, sin6_port) +F(uint32_t, sin6_flowinfo) +F(struct in6_addr, sin6_addr) +F(uint32_t, sin6_scope_id) +} +{const struct in6_addr *x = &in6addr_any;} +{const struct in6_addr *x = &in6addr_loopback;} +{struct in6_addr x = IN6ADDR_ANY_INIT;} +{struct in6_addr x = IN6ADDR_LOOPBACK_INIT;} +{ +struct ipv6_mreq x; +F(struct in6_addr, ipv6mr_multiaddr) +f(unsigned, ipv6mr_interface) +} +C(IPPROTO_IP) +C(IPPROTO_IPV6) +C(IPPROTO_ICMP) +C(IPPROTO_RAW) +C(IPPROTO_TCP) +C(IPPROTO_UDP) +C(INADDR_ANY) +C(INADDR_BROADCAST) +C(INET_ADDRSTRLEN) +I(htonl(0)) +I(htons(0)) +I(ntohl(0)) +I(ntohs(0)) +C(INET6_ADDRSTRLEN) +C(IPV6_JOIN_GROUP) +C(IPV6_LEAVE_GROUP) +C(IPV6_MULTICAST_HOPS) +C(IPV6_MULTICAST_IF) +C(IPV6_MULTICAST_LOOP) +C(IPV6_UNICAST_HOPS) +C(IPV6_V6ONLY) +I(IN6_IS_ADDR_UNSPECIFIED(&in6addr_any)) +I(IN6_IS_ADDR_LOOPBACK(&in6addr_any)) +I(IN6_IS_ADDR_MULTICAST(&in6addr_any)) +I(IN6_IS_ADDR_LINKLOCAL(&in6addr_any)) +I(IN6_IS_ADDR_SITELOCAL(&in6addr_any)) +I(IN6_IS_ADDR_V4MAPPED(&in6addr_any)) +I(IN6_IS_ADDR_V4COMPAT(&in6addr_any)) +I(IN6_IS_ADDR_MC_NODELOCAL(&in6addr_any)) +I(IN6_IS_ADDR_MC_LINKLOCAL(&in6addr_any)) +I(IN6_IS_ADDR_MC_SITELOCAL(&in6addr_any)) +I(IN6_IS_ADDR_MC_ORGLOCAL(&in6addr_any)) +I(IN6_IS_ADDR_MC_GLOBAL(&in6addr_any)) +} diff --git a/src/api/netinet_tcp.c b/src/api/netinet_tcp.c new file mode 100644 index 0000000..626ec7c --- /dev/null +++ b/src/api/netinet_tcp.c @@ -0,0 +1,6 @@ +#include +#define C(n) switch(n){case n:;} +static void f() +{ +C(TCP_NODELAY) +} diff --git a/src/api/nl_types.c b/src/api/nl_types.c new file mode 100644 index 0000000..922cb2b --- /dev/null +++ b/src/api/nl_types.c @@ -0,0 +1,13 @@ +#include +#define T(t) (t*)0; +#define C(n) switch(n){case n:;} +static void f() +{ +T(nl_catd) +T(nl_item) +C(NL_SETD) +C(NL_CAT_LOCALE) +int(*p_catclose)(nl_catd) = catclose; +char*(*p_catgets)(nl_catd,int,int,const char*) = catgets; +nl_catd(*p_catopen)(const char*,int) = catopen; +} diff --git a/src/api/poll.c b/src/api/poll.c new file mode 100644 index 0000000..4ed145f --- /dev/null +++ b/src/api/poll.c @@ -0,0 +1,25 @@ +#include +#define T(t) (t*)0; +#define F(t,n) {t *y = &x.n;} +#define C(n) switch(n){case n:;} +static void f() +{ +T(nfds_t) +{ +struct pollfd x; +F(int, fd) +F(short, events) +F(short, revents) +} +C(POLLIN) +C(POLLRDNORM) +C(POLLRDBAND) +C(POLLPRI) +C(POLLOUT) +C(POLLWRNORM) +C(POLLWRBAND) +C(POLLERR) +C(POLLHUP) +C(POLLNVAL) +int(*p_poll)(struct pollfd[],nfds_t,int) = poll; +} diff --git a/src/api/pthread.c b/src/api/pthread.c new file mode 100644 index 0000000..66e403e --- /dev/null +++ b/src/api/pthread.c @@ -0,0 +1,145 @@ +#include +#define T(t) (t*)0; +#define C(n) switch(n){case n:;} +static void f() +{ +T(pthread_attr_t) +T(pthread_barrier_t) +T(pthread_barrierattr_t) +T(pthread_cond_t) +T(pthread_condattr_t) +T(pthread_key_t) +T(pthread_mutex_t) +T(pthread_mutexattr_t) +T(pthread_once_t) +T(pthread_rwlock_t) +T(pthread_rwlockattr_t) +T(pthread_spinlock_t) +T(pthread_t) +C(PTHREAD_BARRIER_SERIAL_THREAD) +C(PTHREAD_CANCEL_ASYNCHRONOUS) +C(PTHREAD_CANCEL_ENABLE) +C(PTHREAD_CANCEL_DEFERRED) +C(PTHREAD_CANCEL_DISABLE) +{void *x = PTHREAD_CANCELED;} +C(PTHREAD_CREATE_DETACHED) +C(PTHREAD_CREATE_JOINABLE) +C(PTHREAD_EXPLICIT_SCHED) +C(PTHREAD_INHERIT_SCHED) +C(PTHREAD_MUTEX_DEFAULT) +C(PTHREAD_MUTEX_ERRORCHECK) +C(PTHREAD_MUTEX_NORMAL) +C(PTHREAD_MUTEX_RECURSIVE) +C(PTHREAD_MUTEX_ROBUST) +C(PTHREAD_MUTEX_STALLED) +C(PTHREAD_ONCE_INIT) +C(PTHREAD_PRIO_INHERIT) +C(PTHREAD_PRIO_NONE) +C(PTHREAD_PRIO_PROTECT) +C(PTHREAD_PROCESS_SHARED) +C(PTHREAD_PROCESS_PRIVATE) +C(PTHREAD_SCOPE_PROCESS) +C(PTHREAD_SCOPE_SYSTEM) +{pthread_cond_t x = PTHREAD_COND_INITIALIZER;} +{pthread_mutex_t x = PTHREAD_MUTEX_INITIALIZER;} +{pthread_rwlock_t x = PTHREAD_RWLOCK_INITIALIZER;} +int(*p_pthread_atfork)(void(*)(void),void(*)(void),void(*)(void)) = pthread_atfork; +int(*p_pthread_attr_destroy)(pthread_attr_t*) = pthread_attr_destroy; +int(*p_pthread_attr_getdetachstate)(const pthread_attr_t*,int*) = pthread_attr_getdetachstate; +int(*p_pthread_attr_getguardsize)(const pthread_attr_t*restrict,size_t*restrict) = pthread_attr_getguardsize; +int(*p_pthread_attr_getinheritsched)(const pthread_attr_t*restrict,int*restrict) = pthread_attr_getinheritsched; +int(*p_pthread_attr_getschedparam)(const pthread_attr_t*restrict,struct sched_param*restrict) = pthread_attr_getschedparam; +int(*p_pthread_attr_getschedpolicy)(const pthread_attr_t*restrict,int*restrict) = pthread_attr_getschedpolicy; +int(*p_pthread_attr_getscope)(const pthread_attr_t*restrict,int*restrict) = pthread_attr_getscope; +int(*p_pthread_attr_getstack)(const pthread_attr_t*restrict,void**restrict,size_t*restrict) = pthread_attr_getstack; +int(*p_pthread_attr_getstacksize)(const pthread_attr_t*restrict,size_t*restrict) = pthread_attr_getstacksize; +int(*p_pthread_attr_init)(pthread_attr_t*) = pthread_attr_init; +int(*p_pthread_attr_setdetachstate)(pthread_attr_t*,int) = pthread_attr_setdetachstate; +int(*p_pthread_attr_setguardsize)(pthread_attr_t*,size_t) = pthread_attr_setguardsize; +int(*p_pthread_attr_setinheritsched)(pthread_attr_t*,int) = pthread_attr_setinheritsched; +int(*p_pthread_attr_setschedparam)(pthread_attr_t*restrict,const struct sched_param*restrict) = pthread_attr_setschedparam; +int(*p_pthread_attr_setschedpolicy)(pthread_attr_t*,int) = pthread_attr_setschedpolicy; +int(*p_pthread_attr_setscope)(pthread_attr_t*,int) = pthread_attr_setscope; +int(*p_pthread_attr_setstack)(pthread_attr_t*,void*,size_t) = pthread_attr_setstack; +int(*p_pthread_attr_setstacksize)(pthread_attr_t*,size_t) = pthread_attr_setstacksize; +int(*p_pthread_barrier_destroy)(pthread_barrier_t*) = pthread_barrier_destroy; +int(*p_pthread_barrier_init)(pthread_barrier_t*restrict,const pthread_barrierattr_t*restrict,unsigned) = pthread_barrier_init; +int(*p_pthread_barrier_wait)(pthread_barrier_t*) = pthread_barrier_wait; +int(*p_pthread_barrierattr_destroy)(pthread_barrierattr_t*) = pthread_barrierattr_destroy; +int(*p_pthread_barrierattr_getpshared)(const pthread_barrierattr_t*restrict,int*restrict) = pthread_barrierattr_getpshared; +int(*p_pthread_barrierattr_init)(pthread_barrierattr_t*) = pthread_barrierattr_init; +int(*p_pthread_barrierattr_setpshared)(pthread_barrierattr_t*,int) = pthread_barrierattr_setpshared; +int(*p_pthread_cancel)(pthread_t) = pthread_cancel; +void(*p_pthread_cleanup_pop)(int) = pthread_cleanup_pop; +void(*p_pthread_cleanup_push)(void(*)(void*),void*) = pthread_cleanup_push; +int(*p_pthread_cond_broadcast)(pthread_cond_t*) = pthread_cond_broadcast; +int(*p_pthread_cond_destroy)(pthread_cond_t*) = pthread_cond_destroy; +int(*p_pthread_cond_init)(pthread_cond_t*restrict,const pthread_condattr_t*restrict) = pthread_cond_init; +int(*p_pthread_cond_signal)(pthread_cond_t*) = pthread_cond_signal; +int(*p_pthread_cond_timedwait)(pthread_cond_t*restrict,pthread_mutex_t*restrict,const struct timespec*restrict) = pthread_cond_timedwait; +int(*p_pthread_cond_wait)(pthread_cond_t*restrict,pthread_mutex_t*restrict) = pthread_cond_wait; +int(*p_pthread_condattr_destroy)(pthread_condattr_t*) = pthread_condattr_destroy; +int(*p_pthread_condattr_getclock)(const pthread_condattr_t*restrict,clockid_t*restrict) = pthread_condattr_getclock; +int(*p_pthread_condattr_getpshared)(const pthread_condattr_t*restrict,int*restrict) = pthread_condattr_getpshared; +int(*p_pthread_condattr_init)(pthread_condattr_t*) = pthread_condattr_init; +int(*p_pthread_condattr_setclock)(pthread_condattr_t*,clockid_t) = pthread_condattr_setclock; +int(*p_pthread_condattr_setpshared)(pthread_condattr_t*,int) = pthread_condattr_setpshared; +int(*p_pthread_create)(pthread_t*restrict,const pthread_attr_t*restrict,void*(*)(void*),void*restrict) = pthread_create; +int(*p_pthread_detach)(pthread_t) = pthread_detach; +int(*p_pthread_equal)(pthread_t,pthread_t) = pthread_equal; +void(*p_pthread_exit)(void*) = pthread_exit; +int(*p_pthread_getschedparam)(pthread_t,int*restrict,struct sched_param*restrict) = pthread_getschedparam; +void*(*p_pthread_getspecific)(pthread_key_t) = pthread_getspecific; +int(*p_pthread_join)(pthread_t,void**) = pthread_join; +int(*p_pthread_key_create)(pthread_key_t*,void(*)(void*)) = pthread_key_create; +int(*p_pthread_key_delete)(pthread_key_t) = pthread_key_delete; +int(*p_pthread_mutex_consistent)(pthread_mutex_t*) = pthread_mutex_consistent; +int(*p_pthread_mutex_destroy)(pthread_mutex_t*) = pthread_mutex_destroy; +int(*p_pthread_mutex_getprioceiling)(const pthread_mutex_t*restrict,int*restrict) = pthread_mutex_getprioceiling; +int(*p_pthread_mutex_init)(pthread_mutex_t*restrict,const pthread_mutexattr_t*restrict) = pthread_mutex_init; +int(*p_pthread_mutex_lock)(pthread_mutex_t*) = pthread_mutex_lock; +int(*p_pthread_mutex_setprioceiling)(pthread_mutex_t*restrict,int,int*restrict) = pthread_mutex_setprioceiling; +int(*p_pthread_mutex_trylock)(pthread_mutex_t*) = pthread_mutex_trylock; +int(*p_pthread_mutex_unlock)(pthread_mutex_t*) = pthread_mutex_unlock; +int(*p_pthread_mutexattr_destroy)(pthread_mutexattr_t*) = pthread_mutexattr_destroy; +int(*p_pthread_mutexattr_getprioceiling)(const pthread_mutexattr_t*restrict,int*restrict) = pthread_mutexattr_getprioceiling; +int(*p_pthread_mutexattr_getprotocol)(const pthread_mutexattr_t*restrict,int*restrict) = pthread_mutexattr_getprotocol; +int(*p_pthread_mutexattr_getpshared)(const pthread_mutexattr_t*restrict,int*restrict) = pthread_mutexattr_getpshared; +int(*p_pthread_mutexattr_getrobust)(const pthread_mutexattr_t*restrict,int*restrict) = pthread_mutexattr_getrobust; +int(*p_pthread_mutexattr_gettype)(const pthread_mutexattr_t*restrict,int*restrict) = pthread_mutexattr_gettype; +int(*p_pthread_mutexattr_init)(pthread_mutexattr_t*) = pthread_mutexattr_init; +int(*p_pthread_mutexattr_setprioceiling)(pthread_mutexattr_t*,int) = pthread_mutexattr_setprioceiling; +int(*p_pthread_mutexattr_setprotocol)(pthread_mutexattr_t*,int) = pthread_mutexattr_setprotocol; +int(*p_pthread_mutexattr_setpshared)(pthread_mutexattr_t*,int) = pthread_mutexattr_setpshared; +int(*p_pthread_mutexattr_setrobust)(pthread_mutexattr_t*,int) = pthread_mutexattr_setrobust; +int(*p_pthread_mutexattr_settype)(pthread_mutexattr_t*,int) = pthread_mutexattr_settype; +int(*p_pthread_once)(pthread_once_t*,void(*)(void)) = pthread_once; +int(*p_pthread_rwlock_destroy)(pthread_rwlock_t*) = pthread_rwlock_destroy; +int(*p_pthread_rwlock_init)(pthread_rwlock_t*restrict,const pthread_rwlockattr_t*restrict) = pthread_rwlock_init; +int(*p_pthread_rwlock_rdlock)(pthread_rwlock_t*) = pthread_rwlock_rdlock; +int(*p_pthread_rwlock_tryrdlock)(pthread_rwlock_t*) = pthread_rwlock_tryrdlock; +int(*p_pthread_rwlock_trywrlock)(pthread_rwlock_t*) = pthread_rwlock_trywrlock; +int(*p_pthread_rwlock_unlock)(pthread_rwlock_t*) = pthread_rwlock_unlock; +int(*p_pthread_rwlock_wrlock)(pthread_rwlock_t*) = pthread_rwlock_wrlock; +int(*p_pthread_rwlockattr_destroy)(pthread_rwlockattr_t*) = pthread_rwlockattr_destroy; +int(*p_pthread_rwlockattr_getpshared)(const pthread_rwlockattr_t*restrict,int*restrict) = pthread_rwlockattr_getpshared; +int(*p_pthread_rwlockattr_init)(pthread_rwlockattr_t*) = pthread_rwlockattr_init; +int(*p_pthread_rwlockattr_setpshared)(pthread_rwlockattr_t*,int) = pthread_rwlockattr_setpshared; +pthread_t(*p_pthread_self)(void) = pthread_self; +int(*p_pthread_setcancelstate)(int,int*) = pthread_setcancelstate; +int(*p_pthread_setcanceltype)(int,int*) = pthread_setcanceltype; +int(*p_pthread_setschedparam)(pthread_t,int,const struct sched_param*) = pthread_setschedparam; +int(*p_pthread_setschedprio)(pthread_t,int) = pthread_setschedprio; +int(*p_pthread_setspecific)(pthread_key_t,const void*) = pthread_setspecific; +int(*p_pthread_spin_destroy)(pthread_spinlock_t*) = pthread_spin_destroy; +int(*p_pthread_spin_init)(pthread_spinlock_t*,int) = pthread_spin_init; +int(*p_pthread_spin_lock)(pthread_spinlock_t*) = pthread_spin_lock; +int(*p_pthread_spin_trylock)(pthread_spinlock_t*) = pthread_spin_trylock; +int(*p_pthread_spin_unlock)(pthread_spinlock_t*) = pthread_spin_unlock; +void(*p_pthread_testcancel)(void) = pthread_testcancel; +#include +int(*p_pthread_getcpuclockid)(pthread_t,clockid_t*) = pthread_getcpuclockid; +int(*p_pthread_mutex_timedlock)(pthread_mutex_t*restrict,const struct timespec*restrict) = pthread_mutex_timedlock; +int(*p_pthread_rwlock_timedrdlock)(pthread_rwlock_t*restrict,const struct timespec*restrict) = pthread_rwlock_timedrdlock; +int(*p_pthread_rwlock_timedwrlock)(pthread_rwlock_t*restrict,const struct timespec*restrict) = pthread_rwlock_timedwrlock; +} diff --git a/src/api/pwd.c b/src/api/pwd.c new file mode 100644 index 0000000..f6b6dc9 --- /dev/null +++ b/src/api/pwd.c @@ -0,0 +1,26 @@ +#include +#define T(t) (t*)0; +#define F(t,n) {t *y = &x.n;} +static void f() +{ +T(gid_t) +T(uid_t) +T(size_t) +{ +struct passwd x; +F(char*,pw_name) +F(uid_t,pw_uid) +F(gid_t,pw_gid) +F(char*,pw_dir) +F(char*,pw_shell) +} +struct passwd*(*p_getpwnam)(const char*) = getpwnam; +int(*p_getpwnam_r)(const char*,struct passwd*,char*,size_t,struct passwd**) = getpwnam_r; +struct passwd*(*p_getpwuid)(uid_t) = getpwuid; +int(*p_getpwuid_r)(uid_t,struct passwd*,char*,size_t,struct passwd**) = getpwuid_r; +#ifdef _XOPEN_SOURCE +void(*p_endpwent)(void) = endpwent; +struct passwd*(*p_getpwent)(void) = getpwent; +void(*p_setpwent)(void) = setpwent; +#endif +} diff --git a/src/api/regex.c b/src/api/regex.c new file mode 100644 index 0000000..ae54928 --- /dev/null +++ b/src/api/regex.c @@ -0,0 +1,41 @@ +#include +#define T(t) (t*)0; +#define F(t,n) {t *y = &x.n;} +#define C(n) switch(n){case n:;} +static void f() +{ +T(size_t) +T(regoff_t) +{ +regex_t x; +F(size_t,re_nsub) +} +{ +regmatch_t x; +F(regoff_t,rm_so) +F(regoff_t,rm_eo) +} +C(REG_EXTENDED) +C(REG_ICASE) +C(REG_NOSUB) +C(REG_NEWLINE) +C(REG_NOTBOL) +C(REG_NOTEOL) +C(REG_NOMATCH) +C(REG_BADPAT) +C(REG_ECOLLATE) +C(REG_ECTYPE) +C(REG_EESCAPE) +C(REG_ESUBREG) +C(REG_EBRACK) +C(REG_EPAREN) +C(REG_EBRACE) +C(REG_BADBR) +C(REG_ERANGE) +C(REG_ESPACE) +C(REG_BADRPT) +int(*p_regcomp)(regex_t*restrict,const char*restrict,int) = regcomp; +size_t(*p_regerror)(int,const regex_t*restrict,char*restrict,size_t) = regerror; +int(*p_regexec)(const regex_t*restrict,const char*restrict,size_t,regmatch_t[restrict],int) = regexec; +void(*p_regfree)(regex_t*) = regfree; +}