tools/llvm: Do not build with symbols
[minix3.git] / lib / libc / gen / posix_spawn_sched.c
blobd3cc341a8e003c974c2bbf7c948c1628addaddfb
1 /*-
2 * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
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
24 * SUCH DAMAGE.
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"
32 #include <errno.h>
33 #include <fcntl.h>
34 #include <sched.h>
35 #include <signal.h>
36 #include <stdlib.h>
37 #include <string.h>
38 #include <unistd.h>
39 #include <spawn.h>
42 * Spawn attributes
45 int
46 posix_spawnattr_init(posix_spawnattr_t *ret)
48 if (ret == NULL)
49 return -1;
51 memset(ret, 0, sizeof(posix_spawnattr_t));
52 return (0);
55 int
56 posix_spawnattr_destroy(posix_spawnattr_t *sa)
58 if (sa == NULL)
59 return -1;
61 return (0);
64 int
65 posix_spawnattr_getflags(const posix_spawnattr_t * __restrict sa,
66 short * __restrict flags)
68 *flags = sa->sa_flags;
69 return (0);
72 int
73 posix_spawnattr_getpgroup(const posix_spawnattr_t * __restrict sa,
74 pid_t * __restrict pgroup)
76 *pgroup = sa->sa_pgroup;
77 return (0);
80 int
81 posix_spawnattr_getschedparam(const posix_spawnattr_t * __restrict sa,
82 struct sched_param * __restrict schedparam)
84 *schedparam = sa->sa_schedparam;
85 return (0);
88 int
89 posix_spawnattr_getschedpolicy(const posix_spawnattr_t * __restrict sa,
90 int * __restrict schedpolicy)
92 *schedpolicy = sa->sa_schedpolicy;
93 return (0);
96 int
97 posix_spawnattr_getsigdefault(const posix_spawnattr_t * __restrict sa,
98 sigset_t * __restrict sigdefault)
100 *sigdefault = sa->sa_sigdefault;
101 return (0);
105 posix_spawnattr_getsigmask(const posix_spawnattr_t * __restrict sa,
106 sigset_t * __restrict sigmask)
108 *sigmask = sa->sa_sigmask;
109 return (0);
113 posix_spawnattr_setflags(posix_spawnattr_t *sa, short flags)
115 sa->sa_flags = flags;
116 return (0);
120 posix_spawnattr_setpgroup(posix_spawnattr_t *sa, pid_t pgroup)
122 sa->sa_pgroup = pgroup;
123 return (0);
127 posix_spawnattr_setschedparam(posix_spawnattr_t * __restrict sa,
128 const struct sched_param * __restrict schedparam)
130 sa->sa_schedparam = *schedparam;
131 return (0);
135 posix_spawnattr_setschedpolicy(posix_spawnattr_t *sa, int schedpolicy)
137 sa->sa_schedpolicy = schedpolicy;
138 return (0);
142 posix_spawnattr_setsigdefault(posix_spawnattr_t * __restrict sa,
143 const sigset_t * __restrict sigdefault)
145 sa->sa_sigdefault = *sigdefault;
146 return (0);
150 posix_spawnattr_setsigmask(posix_spawnattr_t * __restrict sa,
151 const sigset_t * __restrict sigmask)
153 sa->sa_sigmask = *sigmask;
154 return (0);