1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _SPAWN_H 28*7c478bd9Sstevel@tonic-gate #define _SPAWN_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 33*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 34*7c478bd9Sstevel@tonic-gate #include <signal.h> 35*7c478bd9Sstevel@tonic-gate #include <sched.h> 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 38*7c478bd9Sstevel@tonic-gate extern "C" { 39*7c478bd9Sstevel@tonic-gate #endif 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate #define POSIX_SPAWN_RESETIDS 0x01 42*7c478bd9Sstevel@tonic-gate #define POSIX_SPAWN_SETPGROUP 0x02 43*7c478bd9Sstevel@tonic-gate #define POSIX_SPAWN_SETSIGDEF 0x04 44*7c478bd9Sstevel@tonic-gate #define POSIX_SPAWN_SETSIGMASK 0x08 45*7c478bd9Sstevel@tonic-gate #define POSIX_SPAWN_SETSCHEDPARAM 0x10 46*7c478bd9Sstevel@tonic-gate #define POSIX_SPAWN_SETSCHEDULER 0x20 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate typedef struct { 49*7c478bd9Sstevel@tonic-gate void *__spawn_attrp; /* implementation-private */ 50*7c478bd9Sstevel@tonic-gate } posix_spawnattr_t; 51*7c478bd9Sstevel@tonic-gate 52*7c478bd9Sstevel@tonic-gate typedef struct { 53*7c478bd9Sstevel@tonic-gate void *__file_attrp; /* implementation-private */ 54*7c478bd9Sstevel@tonic-gate } posix_spawn_file_actions_t; 55*7c478bd9Sstevel@tonic-gate 56*7c478bd9Sstevel@tonic-gate #if defined(__STDC__) 57*7c478bd9Sstevel@tonic-gate 58*7c478bd9Sstevel@tonic-gate extern int posix_spawn( 59*7c478bd9Sstevel@tonic-gate pid_t *_RESTRICT_KYWD pid, 60*7c478bd9Sstevel@tonic-gate const char *_RESTRICT_KYWD path, 61*7c478bd9Sstevel@tonic-gate const posix_spawn_file_actions_t *file_actions, 62*7c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attrp, 63*7c478bd9Sstevel@tonic-gate char *const argv[_RESTRICT_KYWD], 64*7c478bd9Sstevel@tonic-gate char *const envp[_RESTRICT_KYWD]); 65*7c478bd9Sstevel@tonic-gate 66*7c478bd9Sstevel@tonic-gate extern int posix_spawnp( 67*7c478bd9Sstevel@tonic-gate pid_t *_RESTRICT_KYWD pid, 68*7c478bd9Sstevel@tonic-gate const char *_RESTRICT_KYWD file, 69*7c478bd9Sstevel@tonic-gate const posix_spawn_file_actions_t *file_actions, 70*7c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attrp, 71*7c478bd9Sstevel@tonic-gate char *const argv[_RESTRICT_KYWD], 72*7c478bd9Sstevel@tonic-gate char *const envp[_RESTRICT_KYWD]); 73*7c478bd9Sstevel@tonic-gate 74*7c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_init( 75*7c478bd9Sstevel@tonic-gate posix_spawn_file_actions_t *file_actions); 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_destroy( 78*7c478bd9Sstevel@tonic-gate posix_spawn_file_actions_t *file_actions); 79*7c478bd9Sstevel@tonic-gate 80*7c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_addopen( 81*7c478bd9Sstevel@tonic-gate posix_spawn_file_actions_t *_RESTRICT_KYWD file_actions, 82*7c478bd9Sstevel@tonic-gate int filedes, 83*7c478bd9Sstevel@tonic-gate const char *_RESTRICT_KYWD path, 84*7c478bd9Sstevel@tonic-gate int oflag, 85*7c478bd9Sstevel@tonic-gate mode_t mode); 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_addclose( 88*7c478bd9Sstevel@tonic-gate posix_spawn_file_actions_t *file_actions, 89*7c478bd9Sstevel@tonic-gate int filedes); 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_adddup2( 92*7c478bd9Sstevel@tonic-gate posix_spawn_file_actions_t *file_actions, 93*7c478bd9Sstevel@tonic-gate int filedes, 94*7c478bd9Sstevel@tonic-gate int newfiledes); 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_init( 97*7c478bd9Sstevel@tonic-gate posix_spawnattr_t *attr); 98*7c478bd9Sstevel@tonic-gate 99*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_destroy( 100*7c478bd9Sstevel@tonic-gate posix_spawnattr_t *attr); 101*7c478bd9Sstevel@tonic-gate 102*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setflags( 103*7c478bd9Sstevel@tonic-gate posix_spawnattr_t *attr, 104*7c478bd9Sstevel@tonic-gate short flags); 105*7c478bd9Sstevel@tonic-gate 106*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getflags( 107*7c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 108*7c478bd9Sstevel@tonic-gate short *_RESTRICT_KYWD flags); 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setpgroup( 111*7c478bd9Sstevel@tonic-gate posix_spawnattr_t *attr, 112*7c478bd9Sstevel@tonic-gate pid_t pgroup); 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getpgroup( 115*7c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 116*7c478bd9Sstevel@tonic-gate pid_t *_RESTRICT_KYWD pgroup); 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setschedparam( 119*7c478bd9Sstevel@tonic-gate posix_spawnattr_t *_RESTRICT_KYWD attr, 120*7c478bd9Sstevel@tonic-gate const struct sched_param *_RESTRICT_KYWD schedparam); 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getschedparam( 123*7c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 124*7c478bd9Sstevel@tonic-gate struct sched_param *_RESTRICT_KYWD schedparam); 125*7c478bd9Sstevel@tonic-gate 126*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setschedpolicy( 127*7c478bd9Sstevel@tonic-gate posix_spawnattr_t *attr, 128*7c478bd9Sstevel@tonic-gate int schedpolicy); 129*7c478bd9Sstevel@tonic-gate 130*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getschedpolicy( 131*7c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 132*7c478bd9Sstevel@tonic-gate int *_RESTRICT_KYWD schedpolicy); 133*7c478bd9Sstevel@tonic-gate 134*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setsigdefault( 135*7c478bd9Sstevel@tonic-gate posix_spawnattr_t *_RESTRICT_KYWD attr, 136*7c478bd9Sstevel@tonic-gate const sigset_t *_RESTRICT_KYWD sigdefault); 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getsigdefault( 139*7c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 140*7c478bd9Sstevel@tonic-gate sigset_t *_RESTRICT_KYWD sigdefault); 141*7c478bd9Sstevel@tonic-gate 142*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setsigmask( 143*7c478bd9Sstevel@tonic-gate posix_spawnattr_t *_RESTRICT_KYWD attr, 144*7c478bd9Sstevel@tonic-gate const sigset_t *_RESTRICT_KYWD sigmask); 145*7c478bd9Sstevel@tonic-gate 146*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getsigmask( 147*7c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 148*7c478bd9Sstevel@tonic-gate sigset_t *_RESTRICT_KYWD sigmask); 149*7c478bd9Sstevel@tonic-gate 150*7c478bd9Sstevel@tonic-gate #else /* __STDC__ */ 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate extern int posix_spawn(); 153*7c478bd9Sstevel@tonic-gate extern int posix_spawnp(); 154*7c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_init(); 155*7c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_destroy(); 156*7c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_addopen(); 157*7c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_addclose(); 158*7c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_adddup2(); 159*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_init(); 160*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_destroy(); 161*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setflags(); 162*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getflags(); 163*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setpgroup(); 164*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getpgroup(); 165*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setschedparam(); 166*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getschedparam(); 167*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setschedpolicy(); 168*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getschedpolicy(); 169*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setsigdefault(); 170*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getsigdefault(); 171*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setsigmask(); 172*7c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getsigmask(); 173*7c478bd9Sstevel@tonic-gate 174*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 175*7c478bd9Sstevel@tonic-gate 176*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 177*7c478bd9Sstevel@tonic-gate } 178*7c478bd9Sstevel@tonic-gate #endif 179*7c478bd9Sstevel@tonic-gate 180*7c478bd9Sstevel@tonic-gate #endif /* _SPAWN_H */ 181