blob: 94ec5418217956eded8da21177177c0d55d44e41 [file] [log] [blame]
Bram Moolenaaredf3f972016-08-29 22:49:24 +02001/* vi:set ts=8 sts=4 sw=4 noet:
Bram Moolenaar071d4272004-06-13 20:20:40 +00002 *
3 * VIM - Vi IMproved by Bram Moolenaar
4 *
5 * Do ":help uganda" in Vim to read copying and usage conditions.
6 * Do ":help credits" in Vim to see a list of people who contributed.
7 */
8
9/*
10 * os_unixx.h -- include files that are only used in os_unix.c
11 */
12
ichizok378447f2023-05-11 22:25:42 +010013// Sun's sys/ioctl.h redefines symbols from termio world
Bram Moolenaara899e6e2016-12-03 16:40:51 +010014#if defined(HAVE_SYS_IOCTL_H) && !defined(SUN_SYSTEM)
Bram Moolenaar071d4272004-06-13 20:20:40 +000015# include <sys/ioctl.h>
16#endif
17
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010018#ifndef USE_SYSTEM // use fork/exec to start the shell
Bram Moolenaar071d4272004-06-13 20:20:40 +000019
20# if defined(HAVE_SYS_WAIT_H) || defined(HAVE_UNION_WAIT)
21# include <sys/wait.h>
22# endif
23
Bram Moolenaar071d4272004-06-13 20:20:40 +000024# ifndef WEXITSTATUS
25# ifdef HAVE_UNION_WAIT
26# define WEXITSTATUS(stat_val) ((stat_val).w_T.w_Retcode)
27# else
28# define WEXITSTATUS(stat_val) (((stat_val) >> 8) & 0377)
29# endif
30# endif
31
32# ifndef WIFEXITED
33# ifdef HAVE_UNION_WAIT
34# define WIFEXITED(stat_val) ((stat_val).w_T.w_Termsig == 0)
35# else
36# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
37# endif
38# endif
39
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010040#endif // !USE_SYSTEM
Bram Moolenaar071d4272004-06-13 20:20:40 +000041
42#ifdef HAVE_STROPTS_H
Bram Moolenaar14285cb2020-03-27 20:58:37 +010043# ifdef sinix
44# define buf_T __system_buf_t__
45# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000046# include <stropts.h>
Bram Moolenaar14285cb2020-03-27 20:58:37 +010047# ifdef sinix
48# undef buf_T
49# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000050#endif
51
52#ifdef HAVE_STRING_H
53# include <string.h>
54#endif
55
Bram Moolenaar071d4272004-06-13 20:20:40 +000056#ifdef HAVE_SYS_STREAM_H
57# include <sys/stream.h>
58#endif
59
60#ifdef HAVE_SYS_UTSNAME_H
61# include <sys/utsname.h>
62#endif
63
64#ifdef HAVE_SYS_SYSTEMINFO_H
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010065// <sys/systeminfo.h> uses SYS_NMLN but it may not be defined (CrayT3E).
Bram Moolenaar843ee412004-06-30 16:16:41 +000066# ifndef SYS_NMLN
67# define SYS_NMLN 32
68# endif
69
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010070# include <sys/systeminfo.h> // for sysinfo
Bram Moolenaar071d4272004-06-13 20:20:40 +000071#endif
72
73/*
74 * We use termios.h if both termios.h and termio.h are available.
75 * Termios is supposed to be a superset of termio.h. Don't include them both,
76 * it may give problems on some systems (e.g. hpux).
77 * I don't understand why we don't want termios.h for apollo.
78 */
79#if defined(HAVE_TERMIOS_H) && !defined(apollo)
80# include <termios.h>
81#else
82# ifdef HAVE_TERMIO_H
83# include <termio.h>
84# else
85# ifdef HAVE_SGTTY_H
86# include <sgtty.h>
87# endif
88# endif
89#endif
90
91#ifdef HAVE_SYS_PTEM_H
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010092# include <sys/ptem.h> // must be after termios.h for Sinix
93# ifndef _IO_PTEM_H // For UnixWare that should check for _IO_PT_PTEM_H
Bram Moolenaar071d4272004-06-13 20:20:40 +000094# define _IO_PTEM_H
95# endif
96#endif
97
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010098// shared library access
Bram Moolenaar071d4272004-06-13 20:20:40 +000099#if defined(HAVE_DLFCN_H) && defined(USE_DLOPEN)
Bram Moolenaara1fa8922017-01-12 20:06:33 +0100100# if defined(__MVS__) && !defined (__SUSV3)
Bram Moolenaar9bf703d2019-11-30 19:44:38 +0100101 // needed to define RTLD_LAZY (Anthony Giorgio)
Bram Moolenaarc17ef8e2006-03-25 21:48:58 +0000102# define __SUSV3
103# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000104# include <dlfcn.h>
105#else
106# if defined(HAVE_DL_H) && defined(HAVE_SHL_LOAD)
107# include <dl.h>
108# endif
109#endif