xref: /netbsd-src/include/spawn.h (revision 1c052966329e857098263b940f45dd4a9856a0c9)
1*1c052966Schristos /*	$NetBSD: spawn.h,v 1.5 2021/11/07 14:34:30 christos Exp $	*/
219f52532Smartin 
319f52532Smartin /*-
419f52532Smartin  * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
519f52532Smartin  * All rights reserved.
619f52532Smartin  *
719f52532Smartin  * Redistribution and use in source and binary forms, with or without
819f52532Smartin  * modification, are permitted provided that the following conditions
919f52532Smartin  * are met:
1019f52532Smartin  * 1. Redistributions of source code must retain the above copyright
1119f52532Smartin  *    notice, this list of conditions and the following disclaimer.
1219f52532Smartin  * 2. Redistributions in binary form must reproduce the above copyright
1319f52532Smartin  *    notice, this list of conditions and the following disclaimer in the
1419f52532Smartin  *    documentation and/or other materials provided with the distribution.
1519f52532Smartin  *
1619f52532Smartin  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1719f52532Smartin  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1819f52532Smartin  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1919f52532Smartin  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2019f52532Smartin  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2119f52532Smartin  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2219f52532Smartin  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2319f52532Smartin  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2419f52532Smartin  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2519f52532Smartin  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2619f52532Smartin  * SUCH DAMAGE.
2719f52532Smartin  *
2819f52532Smartin  * $FreeBSD: src/include/spawn.h,v 1.3.2.1.4.1 2010/06/14 02:09:06 kensmith Exp $
2919f52532Smartin  */
3019f52532Smartin 
3119f52532Smartin #ifndef _SPAWN_H
3219f52532Smartin #define _SPAWN_H
3319f52532Smartin 
3419f52532Smartin #include <sys/spawn.h>
3519f52532Smartin 
362b8e910cSmartin __BEGIN_DECLS
3719f52532Smartin /*
3819f52532Smartin  * Spawn routines
3919f52532Smartin  *
4019f52532Smartin  */
4119f52532Smartin int posix_spawn(pid_t * __restrict, const char * __restrict,
4219f52532Smartin     const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict,
43136a5cd5Smartin     char * const *__restrict, char * const *__restrict);
4419f52532Smartin int posix_spawnp(pid_t * __restrict, const char * __restrict,
4519f52532Smartin     const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict,
46136a5cd5Smartin     char * const *__restrict, char * const *__restrict);
4719f52532Smartin 
4819f52532Smartin /*
4919f52532Smartin  * File descriptor actions
5019f52532Smartin  */
5119f52532Smartin int posix_spawn_file_actions_init(posix_spawn_file_actions_t *);
5219f52532Smartin int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);
5319f52532Smartin 
5419f52532Smartin int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t * __restrict,
5519f52532Smartin     int, const char * __restrict, int, mode_t);
5619f52532Smartin int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
5719f52532Smartin int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
5819f52532Smartin 
59*1c052966Schristos int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t * __restrict,
60*1c052966Schristos         const char * __restrict);
61*1c052966Schristos int posix_spawn_file_actions_addfchdir(posix_spawn_file_actions_t *, int);
62*1c052966Schristos 
6319f52532Smartin /*
6419f52532Smartin  * Spawn attributes
6519f52532Smartin  */
6619f52532Smartin int posix_spawnattr_init(posix_spawnattr_t *);
6719f52532Smartin int posix_spawnattr_destroy(posix_spawnattr_t *);
6819f52532Smartin 
6919f52532Smartin int posix_spawnattr_getflags(const posix_spawnattr_t * __restrict,
7019f52532Smartin     short * __restrict);
7119f52532Smartin int posix_spawnattr_getpgroup(const posix_spawnattr_t * __restrict,
7219f52532Smartin     pid_t * __restrict);
7319f52532Smartin int posix_spawnattr_getschedparam(const posix_spawnattr_t * __restrict,
7419f52532Smartin     struct sched_param * __restrict);
7519f52532Smartin int posix_spawnattr_getschedpolicy(const posix_spawnattr_t * __restrict,
7619f52532Smartin     int * __restrict);
7719f52532Smartin int posix_spawnattr_getsigdefault(const posix_spawnattr_t * __restrict,
7819f52532Smartin     sigset_t * __restrict);
7919f52532Smartin int posix_spawnattr_getsigmask(const posix_spawnattr_t * __restrict,
8019f52532Smartin     sigset_t * __restrict sigmask);
8119f52532Smartin 
8219f52532Smartin int posix_spawnattr_setflags(posix_spawnattr_t *, short);
8319f52532Smartin int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t);
8419f52532Smartin int posix_spawnattr_setschedparam(posix_spawnattr_t * __restrict,
8519f52532Smartin     const struct sched_param * __restrict);
8619f52532Smartin int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int);
8719f52532Smartin int posix_spawnattr_setsigdefault(posix_spawnattr_t * __restrict,
8819f52532Smartin     const sigset_t * __restrict);
8919f52532Smartin int posix_spawnattr_setsigmask(posix_spawnattr_t * __restrict,
9019f52532Smartin     const sigset_t * __restrict);
9119f52532Smartin __END_DECLS
9219f52532Smartin 
9319f52532Smartin #endif /* _SPAWN_H */
94