annotate src/os_unixx.h @ 32669:448aef880252

normalize line endings
author Christian Brabandt <cb@256bit.org>
date Mon, 26 Jun 2023 09:54:34 +0200
parents c0b3e3c7786c
children 695b50472e85
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32669
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
1 /* vi:set ts=8 sts=4 sw=4 noet:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
2 *
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
4 *
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
7 */
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
8
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
9 /*
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
10 * os_unixx.h -- include files that are only used in os_unix.c
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
11 */
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
12
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
13 // Sun's sys/ioctl.h redefines symbols from termio world
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
14 #if defined(HAVE_SYS_IOCTL_H) && !defined(SUN_SYSTEM)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
15 # include <sys/ioctl.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
16 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
17
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
18 #ifndef USE_SYSTEM // use fork/exec to start the shell
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
19
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
20 # if defined(HAVE_SYS_WAIT_H) || defined(HAVE_UNION_WAIT)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
21 # include <sys/wait.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
22 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
23
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
24 # ifndef WEXITSTATUS
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
25 # ifdef HAVE_UNION_WAIT
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
26 # define WEXITSTATUS(stat_val) ((stat_val).w_T.w_Retcode)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
27 # else
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
28 # define WEXITSTATUS(stat_val) (((stat_val) >> 8) & 0377)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
29 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
30 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
31
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
32 # ifndef WIFEXITED
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
33 # ifdef HAVE_UNION_WAIT
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
34 # define WIFEXITED(stat_val) ((stat_val).w_T.w_Termsig == 0)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
35 # else
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
36 # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
37 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
38 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
39
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
40 #endif // !USE_SYSTEM
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
41
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
42 #ifdef HAVE_STROPTS_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
43 # ifdef sinix
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
44 # define buf_T __system_buf_t__
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
45 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
46 # include <stropts.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
47 # ifdef sinix
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
48 # undef buf_T
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
49 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
50 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
51
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
52 #ifdef HAVE_STRING_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
53 # include <string.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
54 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
55
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
56 #ifdef HAVE_SYS_STREAM_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
57 # include <sys/stream.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
58 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
59
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
60 #ifdef HAVE_SYS_UTSNAME_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
61 # include <sys/utsname.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
62 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
63
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
64 #ifdef HAVE_SYS_SYSTEMINFO_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
65 // <sys/systeminfo.h> uses SYS_NMLN but it may not be defined (CrayT3E).
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
66 # ifndef SYS_NMLN
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
67 # define SYS_NMLN 32
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
68 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
69
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
70 # include <sys/systeminfo.h> // for sysinfo
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
71 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
72
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
73 /*
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
74 * We use termios.h if both termios.h and termio.h are available.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
75 * Termios is supposed to be a superset of termio.h. Don't include them both,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
76 * it may give problems on some systems (e.g. hpux).
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
77 * I don't understand why we don't want termios.h for apollo.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
78 */
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
79 #if defined(HAVE_TERMIOS_H) && !defined(apollo)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
80 # include <termios.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
81 #else
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
82 # ifdef HAVE_TERMIO_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
83 # include <termio.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
84 # else
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
85 # ifdef HAVE_SGTTY_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
86 # include <sgtty.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
87 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
88 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
89 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
90
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
91 #ifdef HAVE_SYS_PTEM_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
92 # include <sys/ptem.h> // must be after termios.h for Sinix
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
93 # ifndef _IO_PTEM_H // For UnixWare that should check for _IO_PT_PTEM_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
94 # define _IO_PTEM_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
95 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
96 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
97
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
98 // shared library access
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
99 #if defined(HAVE_DLFCN_H) && defined(USE_DLOPEN)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
100 # if defined(__MVS__) && !defined (__SUSV3)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
101 // needed to define RTLD_LAZY (Anthony Giorgio)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
102 # define __SUSV3
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
103 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
104 # include <dlfcn.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
105 #else
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
106 # if defined(HAVE_DL_H) && defined(HAVE_SHL_LOAD)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
107 # include <dl.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
108 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
109 #endif