2 * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * $FreeBSD: src/include/spawn.h,v 1.3 2008/06/19 07:30:32 ed Exp $
32 #include <sys/cdefs.h>
33 #include <sys/_sigset.h>
34 #include <machine/stdint.h>
36 #ifndef _MODE_T_DECLARED
37 typedef __uint16_t mode_t
;
38 #define _MODE_T_DECLARED
41 #ifndef _PID_T_DECLARED
42 typedef __pid_t pid_t
;
43 #define _PID_T_DECLARED
46 #ifndef _SIGSET_T_DECLARED
47 typedef struct __sigset sigset_t
;
48 #define _SIGSET_T_DECLARED
53 typedef struct __posix_spawnattr
*posix_spawnattr_t
;
54 typedef struct __posix_spawn_file_actions
*posix_spawn_file_actions_t
;
56 #define POSIX_SPAWN_RESETIDS 0x01
57 #define POSIX_SPAWN_SETPGROUP 0x02
58 #define POSIX_SPAWN_SETSCHEDPARAM 0x04
59 #define POSIX_SPAWN_SETSCHEDULER 0x08
60 #define POSIX_SPAWN_SETSIGDEF 0x10
61 #define POSIX_SPAWN_SETSIGMASK 0x20
67 int posix_spawn(pid_t
* __restrict
, const char * __restrict
,
68 const posix_spawn_file_actions_t
*,
69 const posix_spawnattr_t
* __restrict
,
70 char * const [__restrict_arr
], char * const [__restrict_arr
]);
71 int posix_spawnp(pid_t
* __restrict
, const char * __restrict
,
72 const posix_spawn_file_actions_t
*,
73 const posix_spawnattr_t
* __restrict
,
74 char * const [__restrict_arr
], char * const [__restrict_arr
]);
77 * File descriptor actions
79 int posix_spawn_file_actions_init(posix_spawn_file_actions_t
*);
80 int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t
*);
82 int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t
* __restrict
,
83 int, const char * __restrict
, int, mode_t
);
84 int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t
*, int, int);
85 int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t
*, int);
90 int posix_spawnattr_init(posix_spawnattr_t
*);
91 int posix_spawnattr_destroy(posix_spawnattr_t
*);
93 int posix_spawnattr_getflags(const posix_spawnattr_t
* __restrict
,
95 int posix_spawnattr_getpgroup(const posix_spawnattr_t
* __restrict
,
97 int posix_spawnattr_getschedparam(const posix_spawnattr_t
* __restrict
,
98 struct sched_param
* __restrict
);
99 int posix_spawnattr_getschedpolicy(const posix_spawnattr_t
* __restrict
,
101 int posix_spawnattr_getsigdefault(const posix_spawnattr_t
* __restrict
,
102 sigset_t
* __restrict
);
103 int posix_spawnattr_getsigmask(const posix_spawnattr_t
* __restrict
,
104 sigset_t
* __restrict
);
106 int posix_spawnattr_setflags(posix_spawnattr_t
*, short);
107 int posix_spawnattr_setpgroup(posix_spawnattr_t
*, pid_t
);
108 int posix_spawnattr_setschedparam(posix_spawnattr_t
* __restrict
,
109 const struct sched_param
* __restrict
);
110 int posix_spawnattr_setschedpolicy(posix_spawnattr_t
*, int);
111 int posix_spawnattr_setsigdefault(posix_spawnattr_t
* __restrict
,
112 const sigset_t
* __restrict
);
113 int posix_spawnattr_setsigmask(posix_spawnattr_t
* __restrict
,
114 const sigset_t
* __restrict
);
117 #endif /* !_SPAWN_H_ */