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 /* 23*f9f6ed06SRoger 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 */ 51657b1f3dSraf #define POSIX_SPAWN_NOSIGCHLD_NP 0x1000 52657b1f3dSraf #define POSIX_SPAWN_WAITPID_NP 0x2000 53*f9f6ed06SRoger A. Faulkner #define POSIX_SPAWN_NOEXECERR_NP 0x4000 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate typedef struct { 567c478bd9Sstevel@tonic-gate void *__spawn_attrp; /* implementation-private */ 577c478bd9Sstevel@tonic-gate } posix_spawnattr_t; 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate typedef struct { 607c478bd9Sstevel@tonic-gate void *__file_attrp; /* implementation-private */ 617c478bd9Sstevel@tonic-gate } posix_spawn_file_actions_t; 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate #if defined(__STDC__) 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate extern int posix_spawn( 667c478bd9Sstevel@tonic-gate pid_t *_RESTRICT_KYWD pid, 677c478bd9Sstevel@tonic-gate const char *_RESTRICT_KYWD path, 687c478bd9Sstevel@tonic-gate const posix_spawn_file_actions_t *file_actions, 697c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attrp, 707c478bd9Sstevel@tonic-gate char *const argv[_RESTRICT_KYWD], 717c478bd9Sstevel@tonic-gate char *const envp[_RESTRICT_KYWD]); 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate extern int posix_spawnp( 747c478bd9Sstevel@tonic-gate pid_t *_RESTRICT_KYWD pid, 757c478bd9Sstevel@tonic-gate const char *_RESTRICT_KYWD file, 767c478bd9Sstevel@tonic-gate const posix_spawn_file_actions_t *file_actions, 777c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attrp, 787c478bd9Sstevel@tonic-gate char *const argv[_RESTRICT_KYWD], 797c478bd9Sstevel@tonic-gate char *const envp[_RESTRICT_KYWD]); 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_init( 827c478bd9Sstevel@tonic-gate posix_spawn_file_actions_t *file_actions); 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_destroy( 857c478bd9Sstevel@tonic-gate posix_spawn_file_actions_t *file_actions); 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_addopen( 887c478bd9Sstevel@tonic-gate posix_spawn_file_actions_t *_RESTRICT_KYWD file_actions, 897c478bd9Sstevel@tonic-gate int filedes, 907c478bd9Sstevel@tonic-gate const char *_RESTRICT_KYWD path, 917c478bd9Sstevel@tonic-gate int oflag, 927c478bd9Sstevel@tonic-gate mode_t mode); 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_addclose( 957c478bd9Sstevel@tonic-gate posix_spawn_file_actions_t *file_actions, 967c478bd9Sstevel@tonic-gate int filedes); 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_adddup2( 997c478bd9Sstevel@tonic-gate posix_spawn_file_actions_t *file_actions, 1007c478bd9Sstevel@tonic-gate int filedes, 1017c478bd9Sstevel@tonic-gate int newfiledes); 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate extern int posix_spawnattr_init( 1047c478bd9Sstevel@tonic-gate posix_spawnattr_t *attr); 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate extern int posix_spawnattr_destroy( 1077c478bd9Sstevel@tonic-gate posix_spawnattr_t *attr); 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setflags( 1107c478bd9Sstevel@tonic-gate posix_spawnattr_t *attr, 1117c478bd9Sstevel@tonic-gate short flags); 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getflags( 1147c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 1157c478bd9Sstevel@tonic-gate short *_RESTRICT_KYWD flags); 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setpgroup( 1187c478bd9Sstevel@tonic-gate posix_spawnattr_t *attr, 1197c478bd9Sstevel@tonic-gate pid_t pgroup); 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getpgroup( 1227c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 1237c478bd9Sstevel@tonic-gate pid_t *_RESTRICT_KYWD pgroup); 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setschedparam( 1267c478bd9Sstevel@tonic-gate posix_spawnattr_t *_RESTRICT_KYWD attr, 1277c478bd9Sstevel@tonic-gate const struct sched_param *_RESTRICT_KYWD schedparam); 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getschedparam( 1307c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 1317c478bd9Sstevel@tonic-gate struct sched_param *_RESTRICT_KYWD schedparam); 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setschedpolicy( 1347c478bd9Sstevel@tonic-gate posix_spawnattr_t *attr, 1357c478bd9Sstevel@tonic-gate int schedpolicy); 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getschedpolicy( 1387c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 1397c478bd9Sstevel@tonic-gate int *_RESTRICT_KYWD schedpolicy); 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setsigdefault( 1427c478bd9Sstevel@tonic-gate posix_spawnattr_t *_RESTRICT_KYWD attr, 1437c478bd9Sstevel@tonic-gate const sigset_t *_RESTRICT_KYWD sigdefault); 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getsigdefault( 1467c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 1477c478bd9Sstevel@tonic-gate sigset_t *_RESTRICT_KYWD sigdefault); 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setsigmask( 1507c478bd9Sstevel@tonic-gate posix_spawnattr_t *_RESTRICT_KYWD attr, 1517c478bd9Sstevel@tonic-gate const sigset_t *_RESTRICT_KYWD sigmask); 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getsigmask( 1547c478bd9Sstevel@tonic-gate const posix_spawnattr_t *_RESTRICT_KYWD attr, 1557c478bd9Sstevel@tonic-gate sigset_t *_RESTRICT_KYWD sigmask); 1567c478bd9Sstevel@tonic-gate 1577c478bd9Sstevel@tonic-gate #else /* __STDC__ */ 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate extern int posix_spawn(); 1607c478bd9Sstevel@tonic-gate extern int posix_spawnp(); 1617c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_init(); 1627c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_destroy(); 1637c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_addopen(); 1647c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_addclose(); 1657c478bd9Sstevel@tonic-gate extern int posix_spawn_file_actions_adddup2(); 1667c478bd9Sstevel@tonic-gate extern int posix_spawnattr_init(); 1677c478bd9Sstevel@tonic-gate extern int posix_spawnattr_destroy(); 1687c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setflags(); 1697c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getflags(); 1707c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setpgroup(); 1717c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getpgroup(); 1727c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setschedparam(); 1737c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getschedparam(); 1747c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setschedpolicy(); 1757c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getschedpolicy(); 1767c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setsigdefault(); 1777c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getsigdefault(); 1787c478bd9Sstevel@tonic-gate extern int posix_spawnattr_setsigmask(); 1797c478bd9Sstevel@tonic-gate extern int posix_spawnattr_getsigmask(); 1807c478bd9Sstevel@tonic-gate 1817c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1847c478bd9Sstevel@tonic-gate } 1857c478bd9Sstevel@tonic-gate #endif 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate #endif /* _SPAWN_H */ 188