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
27 #include <sys/cdefs.h>
28 __RCSID("$NetBSD: posix_spawn_sched.c,v 1.1 2012/02/11 23:31:24 martin Exp $");
30 #include "namespace.h"
46 posix_spawnattr_init(posix_spawnattr_t
*ret
)
51 memset(ret
, 0, sizeof(posix_spawnattr_t
));
56 posix_spawnattr_destroy(posix_spawnattr_t
*sa
)
65 posix_spawnattr_getflags(const posix_spawnattr_t
* __restrict sa
,
66 short * __restrict flags
)
68 *flags
= sa
->sa_flags
;
73 posix_spawnattr_getpgroup(const posix_spawnattr_t
* __restrict sa
,
74 pid_t
* __restrict pgroup
)
76 *pgroup
= sa
->sa_pgroup
;
81 posix_spawnattr_getschedparam(const posix_spawnattr_t
* __restrict sa
,
82 struct sched_param
* __restrict schedparam
)
84 *schedparam
= sa
->sa_schedparam
;
89 posix_spawnattr_getschedpolicy(const posix_spawnattr_t
* __restrict sa
,
90 int * __restrict schedpolicy
)
92 *schedpolicy
= sa
->sa_schedpolicy
;
97 posix_spawnattr_getsigdefault(const posix_spawnattr_t
* __restrict sa
,
98 sigset_t
* __restrict sigdefault
)
100 *sigdefault
= sa
->sa_sigdefault
;
105 posix_spawnattr_getsigmask(const posix_spawnattr_t
* __restrict sa
,
106 sigset_t
* __restrict sigmask
)
108 *sigmask
= sa
->sa_sigmask
;
113 posix_spawnattr_setflags(posix_spawnattr_t
*sa
, short flags
)
115 sa
->sa_flags
= flags
;
120 posix_spawnattr_setpgroup(posix_spawnattr_t
*sa
, pid_t pgroup
)
122 sa
->sa_pgroup
= pgroup
;
127 posix_spawnattr_setschedparam(posix_spawnattr_t
* __restrict sa
,
128 const struct sched_param
* __restrict schedparam
)
130 sa
->sa_schedparam
= *schedparam
;
135 posix_spawnattr_setschedpolicy(posix_spawnattr_t
*sa
, int schedpolicy
)
137 sa
->sa_schedpolicy
= schedpolicy
;
142 posix_spawnattr_setsigdefault(posix_spawnattr_t
* __restrict sa
,
143 const sigset_t
* __restrict sigdefault
)
145 sa
->sa_sigdefault
= *sigdefault
;
150 posix_spawnattr_setsigmask(posix_spawnattr_t
* __restrict sa
,
151 const sigset_t
* __restrict sigmask
)
153 sa
->sa_sigmask
= *sigmask
;