1 /* @(#)vfork.h 1.4 09/11/15 Copyright 2009 J. Schilling */ 2 /* 3 * Vfork abstraction 4 * 5 * Copyright (c) 2009 J. Schilling 6 */ 7 /* 8 * The contents of this file are subject to the terms of the 9 * Common Development and Distribution License, Version 1.0 only 10 * (the "License"). You may not use this file except in compliance 11 * with the License. 12 * 13 * See the file CDDL.Schily.txt in this distribution for details. 14 * A copy of the CDDL is also available via the Internet at 15 * http://www.opensource.org/licenses/cddl1.txt 16 * 17 * When distributing Covered Code, include this CDDL HEADER in each 18 * file and include the License file CDDL.Schily.txt from this distribution. 19 */ 20 21 #ifndef _SCHILY_VFORK_H 22 #define _SCHILY_VFORK_H 23 24 #ifndef _SCHILY_MCONFIG_H 25 #include <schily/mconfig.h> 26 #endif 27 #ifndef _SCHILY_UNISTD_H 28 #include <schily/unistd.h> /* vfork() definitions are here on Solaris */ 29 #endif 30 31 #ifdef HAVE_VFORK_H 32 #ifndef _INCL_VFORK_H 33 #define _INCL_VFORK_H 34 #include <vfork.h> 35 #endif 36 #endif 37 #ifdef HAVE_SYS_FORK_H 38 #ifndef _INCL_SYS_FORK_H 39 #define _INCL_SYS_FORK_H 40 #include <sys/fork.h> 41 #endif 42 #endif 43 44 #ifdef VMS 45 #ifndef VMS_VFORK_OK 46 /* 47 * vfork() on VMS implements strange deviations from the expected behavior. 48 * The child does not run correctly unless it calls exec*(). 49 * The file descriptors are not separated from the parent. 50 * 51 * decc$set_child_standard_streams() allows to work around the most important 52 * problem of having no separate space for file descriptors if the code is 53 * prepared for the deviations. 54 * 55 * As VMS silently overwrites the "vfork" #definition from mconfig.h in 56 * unistd.h, we need to reset to the definition in mconfig.h for all programs 57 * that are not prepared for the deviations. 58 */ 59 #ifndef HAVE_VFORK /* Paranoia in case VMS implements a working vfork() */ 60 #undef vfork 61 #define vfork fork 62 #endif /* HAVE_VFORK */ 63 64 #else /* VMS_VFORK_OK */ 65 66 #define set_child_standard_fds(in, out, err) \ 67 decc$set_child_standard_streams((in), (out), (err)) 68 #endif /* VMS_VFORK_OK */ 69 #endif /* VMS */ 70 71 #endif /* _SCHILY_VFORK_H */ 72