source: trunk/libs/newlib/src/newlib/libc/include/spawn.h @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 4.0 KB
Line 
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 _SPAWN_H_
28#define _SPAWN_H_
29
30#include <_ansi.h>
31#include <sys/cdefs.h>
32#include <sys/types.h>
33#include <sys/_types.h>
34#define __need_sigset_t
35#include <signal.h>
36
37struct sched_param;
38
39typedef struct __posix_spawnattr                *posix_spawnattr_t;
40typedef struct __posix_spawn_file_actions       *posix_spawn_file_actions_t;
41
42#define POSIX_SPAWN_RESETIDS            0x01
43#define POSIX_SPAWN_SETPGROUP           0x02
44#define POSIX_SPAWN_SETSCHEDPARAM       0x04
45#define POSIX_SPAWN_SETSCHEDULER        0x08
46#define POSIX_SPAWN_SETSIGDEF           0x10
47#define POSIX_SPAWN_SETSIGMASK          0x20
48
49_BEGIN_STD_C
50/*
51 * Spawn routines
52 *
53 * XXX both arrays should be __restrict, but this does not work when GCC
54 * is invoked with -std=c99.
55 */
56int posix_spawn (pid_t *  __restrict, const char * __restrict,
57        const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict,
58        char * const [], char * const []);
59int posix_spawnp (pid_t * __restrict, const char * __restrict,
60        const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict,
61        char * const [], char * const []);
62
63/*
64 * File descriptor actions
65 */
66int posix_spawn_file_actions_init (posix_spawn_file_actions_t *);
67int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *);
68
69int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t * __restrict,
70                                      int, const char * __restrict, int, mode_t);
71int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *, int, int);
72int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *, int);
73
74/*
75 * Spawn attributes
76 */
77int posix_spawnattr_init (posix_spawnattr_t *);
78int posix_spawnattr_destroy (posix_spawnattr_t *);
79
80int posix_spawnattr_getflags (const posix_spawnattr_t * __restrict,
81                              short * __restrict);
82int posix_spawnattr_getpgroup (const posix_spawnattr_t * __restrict,
83                               pid_t * __restrict);
84int posix_spawnattr_getschedparam (const posix_spawnattr_t * __restrict,
85                                   struct sched_param * __restrict);
86int posix_spawnattr_getschedpolicy (const posix_spawnattr_t * __restrict,
87                                    int * __restrict);
88int posix_spawnattr_getsigdefault (const posix_spawnattr_t * __restrict,
89                                   sigset_t * __restrict);
90int posix_spawnattr_getsigmask (const posix_spawnattr_t * __restrict,
91                                sigset_t * __restrict);
92
93int posix_spawnattr_setflags (posix_spawnattr_t *, short);
94int posix_spawnattr_setpgroup (posix_spawnattr_t *, pid_t);
95int posix_spawnattr_setschedparam (posix_spawnattr_t * __restrict,
96                                   const struct sched_param * __restrict);
97int posix_spawnattr_setschedpolicy (posix_spawnattr_t *, int);
98int posix_spawnattr_setsigdefault (posix_spawnattr_t * __restrict,
99                                   const sigset_t * __restrict);
100int posix_spawnattr_setsigmask (posix_spawnattr_t * __restrict,
101                                const sigset_t * __restrict);
102_END_STD_C
103
104#endif /* !_SPAWN_H_ */
Note: See TracBrowser for help on using the repository browser.