1 /* @(#)bshconf.h 1.20 13/09/25 Copyright 1991-2013 J. Schilling */ 2 /* 3 * Copyright (c) 1991-2013 J. Schilling 4 */ 5 /* 6 * The contents of this file are subject to the terms of the 7 * Common Development and Distribution License, Version 1.0 only 8 * (the "License"). You may not use this file except in compliance 9 * with the License. 10 * 11 * See the file CDDL.Schily.txt in this distribution for details. 12 * A copy of the CDDL is also available via the Internet at 13 * http://www.opensource.org/licenses/cddl1.txt 14 * 15 * When distributing Covered Code, include this CDDL HEADER in each 16 * file and include the License file CDDL.Schily.txt from this distribution. 17 */ 18 19 #ifdef RETSIGTYPE /* From schily/mconfig.h */ 20 21 typedef RETSIGTYPE (*sigtype) __PR((int)); 22 typedef RETSIGTYPE sigret; 23 24 #else 25 26 #define VOID_SIGS 27 28 #ifdef VOID_SIGS 29 typedef void (*sigtype) __PR((int)); 30 typedef void sigret; 31 #else 32 typedef int (*sigtype) __PR((int)); 33 typedef int sigret; 34 #endif 35 36 #endif 37 38 39 #if defined(HAVE_GETPGID) || defined(HAVE_SETPGID) 40 #define POSIXJOBS 41 #endif 42 43 #if !defined(HAVE_GETPGID) && defined(HAVE_BSD_GETPGRP) 44 #define getpgid getpgrp 45 #endif 46 47 #if !defined(HAVE_GETSID) && defined(HAVE_BSD_GETPGRP) 48 #define getsid getpgrp 49 #else 50 #if !defined(HAVE_GETSID) && !defined(HAVE_BSD_GETPGRP) 51 #define getsid getpgid 52 #endif 53 #endif 54 55 #if !defined(HAVE_SETPGID) && defined(HAVE_BSD_SETPGRP) 56 #define setpgid setpgrp 57 #endif 58 59 #if !defined(HAVE_SETSID) && defined(HAVE_BSD_GETPGRP) 60 #define setsid setpgrp(getpid()) 61 #endif 62 63 #if !defined(HAVE_GETPGID) && !defined(HAVE_BSD_GETPGRP) 64 /* 65 * FreeBSD (anything that is BSD-4.4 derived) 66 * does not conform to POSIX and is not old BSD conforming either. 67 * Note that this seems to have been changed between 1995 and 2000 68 * 69 * getpgrp()/setpgrp() are not POSIX on BSD-4.4 70 * 71 * setpgrp() is old BSD compliant, 72 * getpgrp() is not BSD compliant but it is POSIX compliant 73 * 74 * setpgid() is OK (POSIX compliant) 75 * getpgid() is missing! 76 * 77 * The builtin command 'pgrp' will not work correctly for this reason. 78 * 79 * BSD: 80 * 81 * getpgrp(pid) -> pgid for pid 82 * setpgrp(pid, pgid) -> set pgid of pid 83 * 84 * POSIX: 85 * 86 * getpgid(pid) -> pgid for pid 87 * setpgid(pid, pgid) -> set pgid of pid 88 * getpgrp(void) -> pgid for $$ 89 * setpgrp(void) -> setpgid(0,0) 90 * 91 * 4.4-BSD: 92 * 93 * getpgid(pid) -> is missing! 94 * setpgid(pid, pgid) -> set pgid of pid 95 * getpgrp(void) -> ???? 96 * setpgrp(pid, pgid) -> set pgid of pid 97 */ 98 #define getpgid(a) getpgrp() 99 #endif 100 101 #if !defined(HAVE_GETPGID) && !defined(HAVE_BSD_GETPGRP) && \ 102 !defined(HAVE_GETPGRP) 103 #undef getpgid 104 #define getpgid(a) getpid() 105 #endif 106 107 #if !defined(HAVE_SETPGID) && !defined(HAVE_BSD_SETPGRP) && \ 108 !defined(HAVE_SETPGRP) 109 #undef setpgid 110 #define setpgid(pid, pgid) (0) 111 #endif 112 113 #ifdef HAVE_SIGSET 114 /* 115 * Try to by default use the function that sets up signal handlers in a way 116 * that does not reset the handler after it has been called. 117 */ 118 #define signal sigset 119 #endif 120 121 #ifdef __linux__ 122 #define __USE_BSD_SIGNAL /* needed for Linux */ 123 #endif 124 125 #if defined(__CYGWIN32__) || defined(__CYGWIN__) 126 #undef DO_SUID 127 #endif 128 129 #ifndef HAVE_CRYPT 130 #undef DO_SUID 131 #endif 132 133 #ifdef DO_PFEXEC 134 #ifdef HAVE_EXEC_ATTR_H 135 #include <exec_attr.h> 136 #endif 137 #endif 138 139 #ifndef DO_PFEXEC 140 #undef EXECATTR_FILENAME 141 #endif 142 143 #ifdef LIB_SHEDIT 144 #define freetree shell_freetree 145 #endif 146