api: add spawn, don't include headers into function scope
authornsz <nsz@port70.net>
Tue, 16 Oct 2012 22:27:02 +0000 (00:27 +0200)
committernsz <nsz@port70.net>
Tue, 16 Oct 2012 22:27:02 +0000 (00:27 +0200)
src/api/fcntl.c
src/api/inttypes.c
src/api/mqueue.c
src/api/pthread.c
src/api/semaphore.c
src/api/spawn.c [new file with mode: 0644]

index ca58523..46b7084 100644 (file)
@@ -86,9 +86,12 @@ T(pid_t)
 int(*p_fcntl)(int,int,...) = fcntl;
 int(*p_posix_fadvise)(int,off_t,off_t,int) = posix_fadvise;
 int(*p_posix_fallocate)(int,off_t,off_t) = posix_fallocate;
 int(*p_fcntl)(int,int,...) = fcntl;
 int(*p_posix_fadvise)(int,off_t,off_t,int) = posix_fadvise;
 int(*p_posix_fallocate)(int,off_t,off_t) = posix_fallocate;
+}
 #ifndef _XOPEN_SOURCE
 #include <sys/stat.h>
 #endif
 #ifndef _XOPEN_SOURCE
 #include <sys/stat.h>
 #endif
+static void g()
+{
 int(*p_creat)(const char*,mode_t) = creat;
 int(*p_open)(const char*,int,...) = open;
 int(*p_openat)(int,const char*,int,...) = openat;
 int(*p_creat)(const char*,mode_t) = creat;
 int(*p_open)(const char*,int,...) = open;
 int(*p_openat)(int,const char*,int,...) = openat;
index 0d00167..b61ffaf 100644 (file)
@@ -254,7 +254,10 @@ intmax_t(*p_imaxabs)(intmax_t) = imaxabs;
 imaxdiv_t(*p_imaxdiv)(intmax_t,intmax_t) = imaxdiv;
 intmax_t(*p_strtoimax)(const char*restrict,char**restrict,int) = strtoimax;
 uintmax_t(*p_strtoumax)(const char*restrict,char**restrict,int) = strtoumax;
 imaxdiv_t(*p_imaxdiv)(intmax_t,intmax_t) = imaxdiv;
 intmax_t(*p_strtoimax)(const char*restrict,char**restrict,int) = strtoimax;
 uintmax_t(*p_strtoumax)(const char*restrict,char**restrict,int) = strtoumax;
+}
 #include <stddef.h>
 #include <stddef.h>
+static void g()
+{
 intmax_t(*p_wcstoimax)(const wchar_t*restrict,wchar_t**restrict,int) = wcstoimax;
 uintmax_t(*p_wcstoumax)(const wchar_t*restrict,wchar_t**restrict,int) = wcstoumax;
 }
 intmax_t(*p_wcstoimax)(const wchar_t*restrict,wchar_t**restrict,int) = wcstoimax;
 uintmax_t(*p_wcstoumax)(const wchar_t*restrict,wchar_t**restrict,int) = wcstoumax;
 }
index cbb0401..4648974 100644 (file)
@@ -24,7 +24,10 @@ 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;
 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 <time.h>
 #include <time.h>
+static void g()
+{
 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;
 }
 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;
 }
index 66e403e..f28d19c 100644 (file)
@@ -137,7 +137,10 @@ 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;
 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 <time.h>
 #include <time.h>
+static void g()
+{
 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_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;
index 700002a..e37235d 100644 (file)
@@ -11,6 +11,9 @@ int(*p_sem_post)(sem_t*) = sem_post;
 int(*p_sem_trywait)(sem_t*) = sem_trywait;
 int(*p_sem_unlink)(const char*) = sem_unlink;
 int(*p_sem_wait)(sem_t*) = sem_wait;
 int(*p_sem_trywait)(sem_t*) = sem_trywait;
 int(*p_sem_unlink)(const char*) = sem_unlink;
 int(*p_sem_wait)(sem_t*) = sem_wait;
+}
 #include <time.h>
 #include <time.h>
+static void g()
+{
 int(*p_sem_timedwait)(sem_t*restrict,const struct timespec*restrict) = sem_timedwait;
 }
 int(*p_sem_timedwait)(sem_t*restrict,const struct timespec*restrict) = sem_timedwait;
 }
diff --git a/src/api/spawn.c b/src/api/spawn.c
new file mode 100644 (file)
index 0000000..1f90e74
--- /dev/null
@@ -0,0 +1,47 @@
+#include <spawn.h>
+#define T(t) (t*)0;
+#define C(n) switch(n){case n:;}
+static void f()
+{
+T(posix_spawnattr_t)
+T(posix_spawn_file_actions_t)
+T(mode_t)
+T(pid_t)
+T(sigset_t)
+T(struct sched_param)
+C(POSIX_SPAWN_RESETIDS)
+C(POSIX_SPAWN_SETPGROUP)
+C(POSIX_SPAWN_SETSCHEDPARAM)
+C(POSIX_SPAWN_SETSCHEDULER)
+C(POSIX_SPAWN_SETSIGDEF)
+C(POSIX_SPAWN_SETSIGMASK)
+int(*p_posix_spawn)(pid_t*restrict,const char*restrict,const posix_spawn_file_actions_t*,const posix_spawnattr_t*restrict,char*const[restrict],char*const[restrict]) = posix_spawn;
+int(*p_posix_spawn_file_actions_addclose)(posix_spawn_file_actions_t*,int) = posix_spawn_file_actions_addclose;
+int(*p_posix_spawn_file_actions_adddup2)(posix_spawn_file_actions_t*,int,int) = posix_spawn_file_actions_adddup2;
+int(*p_posix_spawn_file_actions_addopen)(posix_spawn_file_actions_t*restrict,int,const char*restrict,int,mode_t) = posix_spawn_file_actions_addopen;
+int(*p_posix_spawn_file_actions_destroy)(posix_spawn_file_actions_t*) = posix_spawn_file_actions_destroy;
+int(*p_posix_spawn_file_actions_init)(posix_spawn_file_actions_t*) = posix_spawn_file_actions_init;
+int(*p_posix_spawnattr_destroy)(posix_spawnattr_t*) = posix_spawnattr_destroy;
+int(*p_posix_spawnattr_getflags)(const posix_spawnattr_t*restrict,short*restrict) = posix_spawnattr_getflags;
+int(*p_posix_spawnattr_getpgroup)(const posix_spawnattr_t*restrict,pid_t*restrict) = posix_spawnattr_getpgroup;
+int(*p_posix_spawnattr_init)(posix_spawnattr_t*) = posix_spawnattr_init;
+int(*p_posix_spawnattr_setflags)(posix_spawnattr_t*,short) = posix_spawnattr_setflags;
+int(*p_posix_spawnattr_setpgroup)(posix_spawnattr_t*,pid_t) = posix_spawnattr_setpgroup;
+int(*p_posix_spawnp)(pid_t*restrict,const char*restrict,const posix_spawn_file_actions_t*,const posix_spawnattr_t*restrict,char*const[restrict],char*const[restrict]) = posix_spawnp;
+}
+#include <signal.h>
+static void g()
+{
+int(*p_posix_spawnattr_getsigdefault)(const posix_spawnattr_t*restrict,sigset_t*restrict) = posix_spawnattr_getsigdefault;
+int(*p_posix_spawnattr_getsigmask)(const posix_spawnattr_t*restrict,sigset_t*restrict) = posix_spawnattr_getsigmask;
+int(*p_posix_spawnattr_setsigdefault)(posix_spawnattr_t*restrict,const sigset_t*restrict) = posix_spawnattr_setsigdefault;
+int(*p_posix_spawnattr_setsigmask)(posix_spawnattr_t*restrict,const sigset_t*restrict) = posix_spawnattr_setsigmask;
+}
+#include <sched.h>
+static void h()
+{
+int(*p_posix_spawnattr_getschedparam)(const posix_spawnattr_t*restrict,struct sched_param*restrict) = posix_spawnattr_getschedparam;
+int(*p_posix_spawnattr_getschedpolicy)(const posix_spawnattr_t*restrict,int*restrict) = posix_spawnattr_getschedpolicy;
+int(*p_posix_spawnattr_setschedparam)(posix_spawnattr_t*restrict,const struct sched_param*restrict) = posix_spawnattr_setschedparam;
+int(*p_posix_spawnattr_setschedpolicy)(posix_spawnattr_t*,int) = posix_spawnattr_setschedpolicy;
+}