17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5657b1f3dSraf * Common Development and Distribution License (the "License"). 6657b1f3dSraf * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21657b1f3dSraf 227c478bd9Sstevel@tonic-gate /* 23f9f6ed06SRoger A. Faulkner * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _SPAWN_H 287c478bd9Sstevel@tonic-gate #define _SPAWN_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 317c478bd9Sstevel@tonic-gate #include <sys/types.h> 327c478bd9Sstevel@tonic-gate #include <signal.h> 337c478bd9Sstevel@tonic-gate #include <sched.h> 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #ifdef __cplusplus 367c478bd9Sstevel@tonic-gate extern "C" { 377c478bd9Sstevel@tonic-gate #endif 387c478bd9Sstevel@tonic-gate 39657b1f3dSraf /* 40657b1f3dSraf * flags for posix_spawnattr_setflags() 41657b1f3dSraf */ 42657b1f3dSraf #define POSIX_SPAWN_RESETIDS 0x0001 43657b1f3dSraf #define POSIX_SPAWN_SETPGROUP 0x0002 44657b1f3dSraf #define POSIX_SPAWN_SETSIGDEF 0x0004 45657b1f3dSraf #define POSIX_SPAWN_SETSIGMASK 0x0008 46657b1f3dSraf #define POSIX_SPAWN_SETSCHEDPARAM 0x0010 47657b1f3dSraf #define POSIX_SPAWN_SETSCHEDULER 0x0020 48657b1f3dSraf /* 49657b1f3dSraf * non-portable Solaris extensions 50657b1f3dSraf */ 51*03bc411dSRoger A. Faulkner #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 52*03bc411dSRoger A. Faulkner #define POSIX_SPAWN_SETSIGIGN_NP 0x0800 53657b1f3dSraf #define POSIX_SPAWN_NOSIGCHLD_NP 0x1000 54657b1f3dSraf #define POSIX_SPAWN_WAITPID_NP 0x2000 55f9f6ed06SRoger A. Faulkner #define POSIX_SPAWN_NOEXECERR_NP 0x4000 56*03bc411dSRoger A. Faulkner #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate typedef struct { 597c478bd9Sstevel@tonic-gate void *__spawn_attrp; /* implementation-private */ 607c478bd9Sstevel@tonic-gate } posix_spawnattr_t; 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate typedef struct { 637c478bd9Sstevel@tonic-gate void *__file_attrp; /* implementation-private */ 647c478bd9Sstevel@tonic-gate } posix_spawn_file_actions_t; 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate #if defined(__STDC__) 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate extern int posix_spawn( 697c478bd9Sstevel@tonic-gate pid_t *_RESTRICT_KYWD pid, 707c478bd9Sstevel@tonic-gate const char *_RESTRICT_KYWD path, 717c478bd9Sstevel@tonic-gate const posix_spawn_file_actions_t *file_actions, 727c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attrp, 737c478bd9Sstevel@tonic-gate char *const argv[_RESTRICT_KYWD], 747c478bd9Sstevel@tonic-gate char *const envp[_RESTRICT_KYWD]); 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate extern int posix_spawnp( 777c478bd9Sstevel@tonic-gate pid_t *_RESTRICT_KYWD pid, 787c478bd9Sstevel@tonic-gate const char *_RESTRICT_KYWD file, 797c478bd9Sstevel@tonic-gate const posix_spawn_file_actions_t *file_actions, 807c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attrp, 817c478bd9Sstevel@tonic-gate char *const argv[_RESTRICT_KYWD], 827c478bd9Sstevel@tonic-gate char *const envp[_RESTRICT_KYWD]); 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_init( 857c478bd9Sstevel@tonic-gate posix_spawn_file_actions_t *file_actions); 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_destroy( 887c478bd9Sstevel@tonic-gate posix_spawn_file_actions_t *file_actions); 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_addopen( 917c478bd9Sstevel@tonic-gate posix_spawn_file_actions_t *_RESTRICT_KYWD file_actions, 927c478bd9Sstevel@tonic-gate int filedes, 937c478bd9Sstevel@tonic-gate const char *_RESTRICT_KYWD path, 947c478bd9Sstevel@tonic-gate int oflag, 957c478bd9Sstevel@tonic-gate mode_t mode); 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_addclose( 987c478bd9Sstevel@tonic-gate posix_spawn_file_actions_t *file_actions, 997c478bd9Sstevel@tonic-gate int filedes); 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_adddup2( 1027c478bd9Sstevel@tonic-gate posix_spawn_file_actions_t *file_actions, 1037c478bd9Sstevel@tonic-gate int filedes, 1047c478bd9Sstevel@tonic-gate int newfiledes); 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate extern int posix_spawnattr_init( 1077c478bd9Sstevel@tonic-gate posix_spawnattr_t *attr); 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate extern int posix_spawnattr_destroy( 1107c478bd9Sstevel@tonic-gate posix_spawnattr_t *attr); 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setflags( 1137c478bd9Sstevel@tonic-gate posix_spawnattr_t *attr, 1147c478bd9Sstevel@tonic-gate short flags); 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getflags( 1177c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 1187c478bd9Sstevel@tonic-gate short *_RESTRICT_KYWD flags); 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setpgroup( 1217c478bd9Sstevel@tonic-gate posix_spawnattr_t *attr, 1227c478bd9Sstevel@tonic-gate pid_t pgroup); 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getpgroup( 1257c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 1267c478bd9Sstevel@tonic-gate pid_t *_RESTRICT_KYWD pgroup); 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setschedparam( 1297c478bd9Sstevel@tonic-gate posix_spawnattr_t *_RESTRICT_KYWD attr, 1307c478bd9Sstevel@tonic-gate const struct sched_param *_RESTRICT_KYWD schedparam); 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getschedparam( 1337c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 1347c478bd9Sstevel@tonic-gate struct sched_param *_RESTRICT_KYWD schedparam); 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setschedpolicy( 1377c478bd9Sstevel@tonic-gate posix_spawnattr_t *attr, 1387c478bd9Sstevel@tonic-gate int schedpolicy); 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getschedpolicy( 1417c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 1427c478bd9Sstevel@tonic-gate int *_RESTRICT_KYWD schedpolicy); 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setsigdefault( 1457c478bd9Sstevel@tonic-gate posix_spawnattr_t *_RESTRICT_KYWD attr, 1467c478bd9Sstevel@tonic-gate const sigset_t *_RESTRICT_KYWD sigdefault); 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getsigdefault( 1497c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 1507c478bd9Sstevel@tonic-gate sigset_t *_RESTRICT_KYWD sigdefault); 1517c478bd9Sstevel@tonic-gate 152*03bc411dSRoger A. Faulkner /* 153*03bc411dSRoger A. Faulkner * non-portable Solaris extensions 154*03bc411dSRoger A. Faulkner */ 155*03bc411dSRoger A. Faulkner #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 156*03bc411dSRoger A. Faulkner 157*03bc411dSRoger A. Faulkner extern int posix_spawnattr_setsigignore_np( 158*03bc411dSRoger A. Faulkner posix_spawnattr_t *_RESTRICT_KYWD attr, 159*03bc411dSRoger A. Faulkner const sigset_t *_RESTRICT_KYWD sigignore); 160*03bc411dSRoger A. Faulkner 161*03bc411dSRoger A. Faulkner extern int posix_spawnattr_getsigignore_np( 162*03bc411dSRoger A. Faulkner const posix_spawnattr_t *_RESTRICT_KYWD attr, 163*03bc411dSRoger A. Faulkner sigset_t *_RESTRICT_KYWD sigignore); 164*03bc411dSRoger A. Faulkner 165*03bc411dSRoger A. Faulkner #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 166*03bc411dSRoger A. Faulkner 1677c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setsigmask( 1687c478bd9Sstevel@tonic-gate posix_spawnattr_t *_RESTRICT_KYWD attr, 1697c478bd9Sstevel@tonic-gate const sigset_t *_RESTRICT_KYWD sigmask); 1707c478bd9Sstevel@tonic-gate 1717c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getsigmask( 1727c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 1737c478bd9Sstevel@tonic-gate sigset_t *_RESTRICT_KYWD sigmask); 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate #else /* __STDC__ */ 1767c478bd9Sstevel@tonic-gate 1777c478bd9Sstevel@tonic-gate extern int posix_spawn(); 1787c478bd9Sstevel@tonic-gate extern int posix_spawnp(); 1797c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_init(); 1807c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_destroy(); 1817c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_addopen(); 1827c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_addclose(); 1837c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_adddup2(); 1847c478bd9Sstevel@tonic-gate extern int posix_spawnattr_init(); 1857c478bd9Sstevel@tonic-gate extern int posix_spawnattr_destroy(); 1867c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setflags(); 1877c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getflags(); 1887c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setpgroup(); 1897c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getpgroup(); 1907c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setschedparam(); 1917c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getschedparam(); 1927c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setschedpolicy(); 1937c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getschedpolicy(); 1947c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setsigdefault(); 1957c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getsigdefault(); 196*03bc411dSRoger A. Faulkner #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 197*03bc411dSRoger A. Faulkner extern int posix_spawnattr_setsigignore_np(); 198*03bc411dSRoger A. Faulkner extern int posix_spawnattr_getsigignore_np(); 199*03bc411dSRoger A. Faulkner #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 2007c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setsigmask(); 2017c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getsigmask(); 2027c478bd9Sstevel@tonic-gate 2037c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 2047c478bd9Sstevel@tonic-gate 2057c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2067c478bd9Sstevel@tonic-gate } 2077c478bd9Sstevel@tonic-gate #endif 2087c478bd9Sstevel@tonic-gate 2097c478bd9Sstevel@tonic-gate #endif /* _SPAWN_H */ 210