00001
00002
00003
00004
00005 #ifndef _SPAWN_H_
00006 #define _SPAWN_H_
00007
00008 #include <signal.h>
00009 #include <sys/types.h>
00010 #include <sched.h>
00011
00012 typedef struct {
00013 short _flags;
00014 pid_t _pgrp;
00015 sigset_t _sd;
00016 sigset_t _sm;
00017 struct sched_param _sp;
00018 int _policy;
00019 } posix_spawnattr_t;
00020
00021
00022 #define POSIX_SPAWN_RESETIDS 0x01
00023 #define POSIX_SPAWN_SETPGROUP 0x02
00024 #define POSIX_SPAWN_SETSIGDEF 0x04
00025 #define POSIX_SPAWN_SETSIGMASK 0x08
00026 #define POSIX_SPAWN_SETSCHEDPARAM 0x10
00027 #define POSIX_SPAWN_SETSCHEDULER 0x20
00028
00029
00030 struct file_actions_t;
00031 typedef struct {
00032 int _cnt;
00033 struct file_actions_t* _fa;
00034 } posix_spawn_file_actions_t;
00035
00036 __BEGIN_DECLS
00037
00038 IMPORT_C int posix_spawn(pid_t* pid, const char* path,
00039 const posix_spawn_file_actions_t* file_actions,
00040 const posix_spawnattr_t* attrp, char *const argv[],
00041 char *const envp[]);
00042
00043 IMPORT_C int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t* file_actions,
00044 int fid);
00045
00046 IMPORT_C int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t* file_actions,
00047 int fid1, int fid2);
00048
00049 IMPORT_C int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t* file_actions,
00050 int fid, const char* path, int oflag, mode_t mode);
00051
00052 IMPORT_C int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t* file_actions);
00053
00054 IMPORT_C int posix_spawn_file_actions_init(posix_spawn_file_actions_t* file_actions);
00055
00056 IMPORT_C int posix_spawnattr_destroy(posix_spawnattr_t* attrp);
00057
00058 IMPORT_C int posix_spawnattr_getsigdefault(const posix_spawnattr_t* attrp,
00059 sigset_t* sigdefault);
00060
00061 IMPORT_C int posix_spawnattr_getflags(const posix_spawnattr_t* attrp, short* flags);
00062
00063 IMPORT_C int posix_spawnattr_getpgroup(const posix_spawnattr_t* attrp, pid_t* pgroup);
00064
00065 IMPORT_C int posix_spawnattr_getschedparam(const posix_spawnattr_t* attrp,
00066 struct sched_param* schedparam);
00067
00068 IMPORT_C int posix_spawnattr_getschedpolicy(const posix_spawnattr_t* attrp, int* policy);
00069
00070 IMPORT_C int posix_spawnattr_getsigmask(const posix_spawnattr_t* attrp, sigset_t* sigmask);
00071
00072 IMPORT_C int posix_spawnattr_init(posix_spawnattr_t* attrp);
00073
00074 IMPORT_C int posix_spawnattr_setsigdefault(posix_spawnattr_t* attrp,
00075 const sigset_t* sigdefault);
00076
00077 IMPORT_C int posix_spawnattr_setflags(posix_spawnattr_t* attrp, short flags);
00078
00079 IMPORT_C int posix_spawnattr_setpgroup(posix_spawnattr_t* attrp, pid_t pgroup);
00080
00081 IMPORT_C int posix_spawnattr_setschedparam(posix_spawnattr_t* attrp,
00082 const struct sched_param* schedparam);
00083
00084 IMPORT_C int posix_spawnattr_setschedpolicy(posix_spawnattr_t* attrp, int policy);
00085
00086 IMPORT_C int posix_spawnattr_setsigmask(posix_spawnattr_t* attrp, const sigset_t* sigmask);
00087
00088 __END_DECLS
00089
00090 #endif