libc: initial implementation of posix_spawn
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
#ifndef SPAWN_H_
|
||||
#define SPAWN_H_
|
||||
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define __POSIX_SPAWN_FILE_ACTIONS_SIZE__ 32
|
||||
#define __POSIX_SPAWNATTR_SIZE__ 32
|
||||
|
||||
struct sched_param;
|
||||
|
||||
typedef struct posix_spawn_file_actions {
|
||||
char __opaque[__POSIX_SPAWN_FILE_ACTIONS_SIZE__];
|
||||
} posix_spawn_file_actions_t;
|
||||
|
||||
typedef struct posix_spawnattr {
|
||||
char __opaque[__POSIX_SPAWN_FILE_ACTIONS_SIZE__];
|
||||
} posix_spawnattr_t;
|
||||
|
||||
extern int posix_spawn_file_actions_init(
|
||||
posix_spawn_file_actions_t *restrict file_actions);
|
||||
extern int posix_spawn_file_actions_destroy(
|
||||
posix_spawn_file_actions_t *restrict file_actions);
|
||||
extern int posix_spawn_file_actions_addopen(
|
||||
posix_spawn_file_actions_t *restrict file_actions,
|
||||
int fildes,
|
||||
const char *path,
|
||||
int oflag,
|
||||
mode_t mode);
|
||||
extern int posix_spawn_file_actions_addclose(
|
||||
posix_spawn_file_actions_t *restrict file_actions,
|
||||
int fildes);
|
||||
extern int posix_spawn_file_actions_adddup2(
|
||||
posix_spawn_file_actions_t *restrict file_actions,
|
||||
int fildes,
|
||||
int newfildes);
|
||||
|
||||
extern int posix_spawnattr_init(posix_spawnattr_t *restrict attrp);
|
||||
extern int posix_spawnattr_destroy(posix_spawnattr_t *restrict attrp);
|
||||
extern int posix_spawnattr_getflags(
|
||||
const posix_spawnattr_t *restrict attrp,
|
||||
short *restrict flags);
|
||||
extern int posix_spawnattr_setflags(
|
||||
posix_spawnattr_t *restrict attrp,
|
||||
short flags);
|
||||
extern int posix_spawnattr_getschedpolicy(
|
||||
const posix_spawnattr_t *restrict attrp,
|
||||
int *restrict schedpolicy);
|
||||
extern int posix_spawnattr_setschedpolicy(
|
||||
posix_spawnattr_t *restrict attrp,
|
||||
int schedpolicy);
|
||||
extern int posix_spawnattr_getschedparam(
|
||||
const posix_spawnattr_t *restrict attrp,
|
||||
struct sched_param *restrict schedparam);
|
||||
extern int posix_spawnattr_setschedparam(
|
||||
posix_spawnattr_t *restrict attrp,
|
||||
const struct sched_param *restrict schedparam);
|
||||
extern int posix_spawnattr_getpgroup(
|
||||
const posix_spawnattr_t *restrict attrp,
|
||||
pid_t *restrict pgroup);
|
||||
extern int posix_spawnattr_setpgroup(
|
||||
posix_spawnattr_t *restrict attrp,
|
||||
pid_t pgroup);
|
||||
extern int posix_spawnattr_getsigmask(
|
||||
const posix_spawnattr_t *restrict attrp,
|
||||
sigset_t *restrict sigmask);
|
||||
extern int posix_spawnattr_setsigmask(
|
||||
posix_spawnattr_t *restrict attrp,
|
||||
sigset_t sigmask);
|
||||
|
||||
extern int posix_spawn(
|
||||
pid_t *restrict pid,
|
||||
const char *restrict path,
|
||||
const posix_spawn_file_actions_t *restrict file_actions,
|
||||
const posix_spawnattr_t *restrict attrp,
|
||||
char *const argv[],
|
||||
char *const envp[]);
|
||||
extern int posix_spawnp(
|
||||
pid_t *restrict pid,
|
||||
const char *restrict file,
|
||||
const posix_spawn_file_actions_t *restrict file_actions,
|
||||
const posix_spawnattr_t *restrict attrp,
|
||||
char *const argv[],
|
||||
char *const envp[]);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user