Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1136)

Side by Side Diff: newlib/libc/posix/posix_spawnattr.c

Issue 650343002: Split posix_spawn.c into 3 different files (Closed) Base URL: http://git.chromium.org/native_client/nacl-newlib.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « newlib/libc/posix/posix_spawn_file_actions.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*-
2 * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
3 * All rights reserved.
4 *
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.
13 *
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.
25 */
26
27 #ifndef _NO_POSIX_SPAWN
28
29 #include <errno.h>
30 #include <spawn.h>
31 #include <stdlib.h>
32
33 /*
34 * Spawn attributes
35 */
36
37 int
38 _DEFUN(posix_spawnattr_init, (ret),
39 posix_spawnattr_t *ret)
40 {
41 posix_spawnattr_t* sa;
42
43 sa = calloc(1, sizeof(posix_spawnattr_t));
44 if (sa == NULL)
45 return (errno);
46
47 /* Set defaults as specified by POSIX, cleared above */
48 ret = sa;
49 return (0);
50 }
51
52 int
53 _DEFUN(posix_spawnattr_destroy, (sa),
54 posix_spawnattr_t *sa)
55 {
56 free(sa);
57 return (0);
58 }
59
60 int
61 _DEFUN(posix_spawnattr_getflags, (sa, flags),
62 _CONST posix_spawnattr_t * __restrict sa _AND
63 short * __restrict flags)
64 {
65 *flags = sa->sa_flags;
66 return (0);
67 }
68
69 int
70 _DEFUN(posix_spawnattr_getpgroup, (sa, pgroup),
71 _CONST posix_spawnattr_t * __restrict sa _AND
72 pid_t * __restrict pgroup)
73 {
74 *pgroup = sa->sa_pgroup;
75 return (0);
76 }
77
78 int
79 _DEFUN(posix_spawnattr_getschedparam, (sa, schedparam),
80 _CONST posix_spawnattr_t * __restrict sa _AND
81 struct sched_param * __restrict schedparam)
82 {
83 *schedparam = sa->sa_schedparam;
84 return (0);
85 }
86
87 int
88 _DEFUN(posix_spawnattr_getschedpolicy, (sa, schedpolicy),
89 _CONST posix_spawnattr_t * __restrict sa _AND
90 int * __restrict schedpolicy)
91 {
92 *schedpolicy = sa->sa_schedpolicy;
93 return (0);
94 }
95
96 int
97 _DEFUN(posix_spawnattr_getsigdefault, (sa, sigdefault),
98 _CONST posix_spawnattr_t * __restrict sa _AND
99 sigset_t * __restrict sigdefault)
100 {
101 *sigdefault = sa->sa_sigdefault;
102 return (0);
103 }
104
105 int
106 _DEFUN(posix_spawnattr_getsigmask, (sa, sigmask),
107 _CONST posix_spawnattr_t * __restrict sa _AND
108 sigset_t * __restrict sigmask)
109 {
110 *sigmask = sa->sa_sigmask;
111 return (0);
112 }
113
114 int
115 _DEFUN(posix_spawnattr_setflags, (sa, flags),
116 posix_spawnattr_t *sa _AND
117 short flags)
118 {
119 sa->sa_flags = flags;
120 return (0);
121 }
122
123 int
124 _DEFUN(posix_spawnattr_setpgroup, (sa, pgroup),
125 posix_spawnattr_t *sa _AND
126 pid_t pgroup)
127 {
128 sa->sa_pgroup = pgroup;
129 return (0);
130 }
131
132 int
133 _DEFUN(posix_spawnattr_setschedparam, (sa, schedparam),
134 posix_spawnattr_t * __restrict sa _AND
135 _CONST struct sched_param * __restrict schedparam)
136 {
137 sa->sa_schedparam = *schedparam;
138 return (0);
139 }
140
141 int
142 _DEFUN(posix_spawnattr_setschedpolicy, (sa, schedpolicy),
143 posix_spawnattr_t *sa _AND
144 int schedpolicy)
145 {
146 sa->sa_schedpolicy = schedpolicy;
147 return (0);
148 }
149
150 int
151 _DEFUN(posix_spawnattr_setsigdefault, (sa, sigdefault),
152 posix_spawnattr_t * __restrict sa _AND
153 _CONST sigset_t * __restrict sigdefault)
154 {
155 sa->sa_sigdefault = *sigdefault;
156 return (0);
157 }
158
159 int
160 _DEFUN(posix_spawnattr_setsigmask, (sa, sigmask),
161 posix_spawnattr_t * __restrict sa _AND
162 _CONST sigset_t * __restrict sigmask)
163 {
164 sa->sa_sigmask = *sigmask;
165 return (0);
166 }
167
168 #endif /* !_NO_POSIX_SPAWN */
OLDNEW
« no previous file with comments | « newlib/libc/posix/posix_spawn_file_actions.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698