Mercurial > hg > xemacs-beta
annotate src/sysproc.h @ 5533:11da5b828d10
shell-command and shell-command-on-region API compliant with FSF 23.3.1
| author | Mats Lidell <mats.lidell@cag.se> |
|---|---|
| date | Sun, 31 Jul 2011 01:29:09 +0200 |
| parents | 308d34e9f07d |
| children | 611a6845ebee |
| rev | line source |
|---|---|
| 428 | 1 /* |
| 2 Copyright (C) 1995 Free Software Foundation, Inc. | |
| 853 | 3 Copyright (C) 2000, 2002 Ben Wing. |
| 428 | 4 |
| 5 This file is part of XEmacs. | |
| 6 | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4759
diff
changeset
|
7 XEmacs is free software: you can redistribute it and/or modify it |
| 428 | 8 under the terms of the GNU General Public License as published by the |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4759
diff
changeset
|
9 Free Software Foundation, either version 3 of the License, or (at your |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4759
diff
changeset
|
10 option) any later version. |
| 428 | 11 |
| 12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
| 13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 15 for more details. | |
| 16 | |
| 17 You should have received a copy of the GNU General Public License | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4759
diff
changeset
|
18 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 428 | 19 |
| 20 /* Synched up with: Not really in FSF. */ | |
| 21 | |
| 440 | 22 #ifndef INCLUDED_sysproc_h_ |
| 23 #define INCLUDED_sysproc_h_ | |
| 24 | |
| 428 | 25 #include "systime.h" /* necessary for sys/resource.h; also gets the |
| 26 FD_* defines on some systems. */ | |
| 442 | 27 #ifndef WIN32_NATIVE |
| 428 | 28 #include <sys/resource.h> |
| 29 #endif | |
| 30 | |
| 771 | 31 #ifdef MINGW |
| 32 #include <../mingw/process.h> | |
| 33 #elif defined (CYGWIN) | |
| 34 #include <../include/process.h> | |
| 35 #elif defined (WIN32_NATIVE) | |
| 36 /* <process.h> should not conflict with "process.h", as per ANSI definition. | |
| 37 This is not true with visual c though. The trick below works with | |
| 38 VC4.2b, 5.0 and 6.0. It assumes that VC is installed in a kind of | |
| 39 standard way, so include path ends with /include. | |
| 40 */ | |
| 41 #include <../include/process.h> | |
| 42 #endif | |
| 43 | |
| 428 | 44 #ifdef HAVE_SOCKETS /* TCP connection support, if kernel can do it */ |
| 45 # include <sys/types.h> /* AJK */ | |
| 442 | 46 # ifndef WIN32_NATIVE |
| 47 # include <sys/socket.h> | |
| 48 # include <netdb.h> | |
| 49 # include <netinet/in.h> | |
| 50 # include <arpa/inet.h> | |
| 51 # endif | |
| 428 | 52 #endif /* HAVE_SOCKETS */ |
| 53 | |
| 442 | 54 #ifdef WIN32_NATIVE |
| 55 /* Note: winsock.h already included in systime.h above */ | |
| 56 /* map winsock error codes to standard names */ | |
| 57 #define EWOULDBLOCK WSAEWOULDBLOCK | |
| 58 #define EINPROGRESS WSAEINPROGRESS | |
| 59 #define EALREADY WSAEALREADY | |
| 60 #define ENOTSOCK WSAENOTSOCK | |
| 61 #define EDESTADDRREQ WSAEDESTADDRREQ | |
| 62 #define EMSGSIZE WSAEMSGSIZE | |
| 63 #define EPROTOTYPE WSAEPROTOTYPE | |
| 64 #define ENOPROTOOPT WSAENOPROTOOPT | |
| 65 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT | |
| 66 #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT | |
| 67 #define EOPNOTSUPP WSAEOPNOTSUPP | |
| 68 #define EPFNOSUPPORT WSAEPFNOSUPPORT | |
| 69 #define EAFNOSUPPORT WSAEAFNOSUPPORT | |
| 70 #define EADDRINUSE WSAEADDRINUSE | |
| 71 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL | |
| 72 #define ENETDOWN WSAENETDOWN | |
| 73 #define ENETUNREACH WSAENETUNREACH | |
| 74 #define ENETRESET WSAENETRESET | |
| 75 #define ECONNABORTED WSAECONNABORTED | |
| 76 #define ECONNRESET WSAECONNRESET | |
| 77 #define ENOBUFS WSAENOBUFS | |
| 78 #define EISCONN WSAEISCONN | |
| 79 #define ENOTCONN WSAENOTCONN | |
| 80 #define ESHUTDOWN WSAESHUTDOWN | |
| 81 #define ETOOMANYREFS WSAETOOMANYREFS | |
| 82 #define ETIMEDOUT WSAETIMEDOUT | |
| 83 #define ECONNREFUSED WSAECONNREFUSED | |
| 84 #define ELOOP WSAELOOP | |
| 85 /* #define ENAMETOOLONG WSAENAMETOOLONG */ | |
| 86 #define EHOSTDOWN WSAEHOSTDOWN | |
| 87 #define EHOSTUNREACH WSAEHOSTUNREACH | |
| 88 /* #define ENOTEMPTY WSAENOTEMPTY */ | |
| 89 #define EPROCLIM WSAEPROCLIM | |
| 90 #define EUSERS WSAEUSERS | |
| 91 #define EDQUOT WSAEDQUOT | |
| 92 #define ESTALE WSAESTALE | |
| 93 #define EREMOTE WSAEREMOTE | |
| 94 #endif /* WIN32_NATIVE */ | |
| 95 | |
| 3025 | 96 /* On some systems, e.g. DGUX, inet_addr returns a `struct in_addr'. */ |
| 428 | 97 #ifdef HAVE_BROKEN_INET_ADDR |
| 98 # define IN_ADDR struct in_addr | |
| 99 # define NUMERIC_ADDR_ERROR (numeric_addr.s_addr == -1) | |
| 100 #else | |
| 101 # if (LONGBITS > 32) | |
| 102 # define IN_ADDR unsigned int | |
| 103 # else | |
| 104 # define IN_ADDR unsigned long | |
| 105 # endif | |
| 106 # define NUMERIC_ADDR_ERROR (numeric_addr == (IN_ADDR) -1) | |
| 107 #endif | |
| 108 | |
| 109 /* Define first descriptor number available for subprocesses. */ | |
| 110 #define FIRST_PROC_DESC 3 | |
| 111 | |
| 112 #ifdef AIX | |
| 113 #include <sys/select.h> | |
| 114 #endif | |
| 115 | |
| 444 | 116 #ifdef HAVE_STROPTS_H |
| 117 #include <stropts.h> /* isastream(), I_PUSH */ | |
| 442 | 118 #endif |
| 119 | |
| 444 | 120 #ifdef HAVE_STRTIO_H |
| 121 #include <strtio.h> /* TIOCSIGNAL */ | |
| 442 | 122 #endif |
| 123 | |
| 124 #ifdef HAVE_PTY_H | |
| 125 #include <pty.h> /* openpty() on Tru64, Linux */ | |
| 126 #endif | |
| 127 | |
| 128 #ifdef HAVE_LIBUTIL_H | |
| 458 | 129 #include <libutil.h> /* openpty() on FreeBSD */ |
| 130 #endif | |
| 131 | |
| 132 #ifdef HAVE_UTIL_H | |
| 133 #include <util.h> /* openpty() on NetBSD */ | |
| 442 | 134 #endif |
| 135 | |
| 2286 | 136 /* The FD_* macros expand to __extension__ forms on glibc-based systems. Uno |
| 137 does not understand such forms, so let's help it out. */ | |
| 138 #ifdef UNO | |
| 139 #undef FD_SET | |
| 140 #undef FD_CLR | |
| 141 #undef FD_ISSET | |
| 142 #undef FD_ZERO | |
| 143 #undef MAXDESC | |
| 144 #undef SELECT_TYPE | |
| 145 #endif /* UNO */ | |
| 146 | |
| 428 | 147 #ifdef FD_SET |
| 148 | |
| 149 /* We could get this from param.h, but better not to depend on finding that. | |
| 150 And better not to risk that it might define other symbols used in this | |
| 151 file. */ | |
| 152 # ifdef FD_SETSIZE | |
| 153 # define MAXDESC FD_SETSIZE | |
| 154 # else | |
| 155 # define MAXDESC 64 | |
| 156 # endif /* FD_SETSIZE */ | |
| 157 # define SELECT_TYPE fd_set | |
| 158 | |
| 159 #else /* no FD_SET */ | |
| 160 | |
| 161 # define MAXDESC 32 | |
| 162 # define SELECT_TYPE int | |
| 163 | |
| 164 /* Define the macros to access a single-int bitmap of descriptors. */ | |
| 165 # define FD_SET(n, p) (*(p) |= (1 << (n))) | |
| 166 # define FD_CLR(n, p) (*(p) &= ~(1 << (n))) | |
| 167 # define FD_ISSET(n, p) (*(p) & (1 << (n))) | |
| 168 # define FD_ZERO(p) (*(p) = 0) | |
| 169 | |
| 170 #endif /* no FD_SET */ | |
| 171 | |
| 172 int poll_fds_for_input (SELECT_TYPE mask); | |
| 867 | 173 int qxe_execve (const Ibyte *filename, Ibyte * const argv[], |
| 174 Ibyte * const envp[]); | |
| 771 | 175 pid_t qxe_getpid (void); |
| 428 | 176 |
| 853 | 177 /* #### I would really like to delete the remaining synchronous code entirely. |
| 178 We are now using it only for *REALLY* old systems -- how many systems | |
| 179 nowadays | |
| 180 | |
| 181 (a) lack job control, or | |
| 182 (b) lack mkdir() or rmdir() | |
| 183 | |
| 184 ????? | |
| 185 | |
| 186 --ben | |
| 187 */ | |
| 188 | |
| 859 | 189 #include "syssignal.h" /* needed for SIGTSTP */ |
| 854 | 190 |
|
4759
aa5ed11f473b
Remove support for obsolete systems. See xemacs-patches message with ID
Jerry James <james@xemacs.org>
parents:
3025
diff
changeset
|
191 #if !defined (WIN32_NATIVE) && (!defined (SIGTSTP) || !defined (HAVE_MKDIR) || !defined (HAVE_RMDIR)) |
| 853 | 192 |
| 193 #define NEED_SYNC_PROCESS_CODE | |
| 194 | |
| 195 /* True iff we are about to fork off a synchronous process or if we | |
| 196 are waiting for it. */ | |
| 197 extern volatile int synch_process_alive; | |
| 198 | |
| 199 /* Nonzero => this is a string explaining death of synchronous subprocess. */ | |
| 200 extern const char *synch_process_death; | |
| 201 | |
| 202 /* If synch_process_death is zero, | |
| 203 this is exit code of synchronous subprocess. */ | |
| 204 extern int synch_process_retcode; | |
| 205 | |
| 206 #endif | |
| 207 | |
| 208 | |
| 440 | 209 #endif /* INCLUDED_sysproc_h_ */ |
