Import Upstream version 20180207
[hcoop/debian/mlton.git] / runtime / platform / hpux.h
1 #ifndef _XOPEN_SOURCE_EXTENDED
2 #define _XOPEN_SOURCE_EXTENDED
3 #endif
4
5 #include <fenv.h>
6 #include <inttypes.h>
7
8 #include <unistd.h>
9
10 #include <dirent.h>
11 #include <fcntl.h>
12 #include <grp.h>
13 #include <math.h>
14 #include <netdb.h>
15 #include <netinet/in.h>
16 #include <netinet/tcp.h>
17 #include <poll.h>
18 #include <signal.h>
19 #include <sys/poll.h>
20 #include <sys/privgrp.h>
21 #include <sys/ptrace.h>
22 #include <sys/resource.h>
23 #include <sys/socket.h>
24 #include <sys/stat.h>
25 #include <sys/time.h>
26 #include <sys/times.h>
27 #include <sys/un.h>
28 #include <sys/utsname.h>
29 #include <syslog.h>
30 #include <termios.h>
31 #include <utime.h>
32
33 #include "setenv.h"
34
35 #if defined(SO_TOE)
36 #define HPUX_VERSION 1123
37 #elif defined(PRIV_PSET)
38 #define HPUX_VERSION 1111
39 #elif defined(PRIV_SPUCTL)
40 #define HPUX_VERSION 1100
41 #else
42 #error "HP-UX 11.00 is the oldest supported version."
43 #endif
44
45 #undef UINTPTR_MAX
46 #define UINTPTR_MAX ULONG_MAX
47
48 #ifndef SIZE_MAX
49 #define SIZE_MAX ((size_t)SSIZE_MAX * 2 + 1)
50 #endif
51
52 #define HAS_FEROUND TRUE
53 #define HAS_MSG_DONTWAIT FALSE
54 #define HAS_REMAP FALSE
55 #define HAS_SIGALTSTACK TRUE
56 #define NEEDS_SIGALTSTACK_EXEC FALSE
57 #define HAS_SPAWN FALSE
58 #define HAS_TIME_PROFILING TRUE
59
60 #define MLton_Platform_OS_host "hpux"
61
62 #define LOG_PERROR 0
63 #define LOG_AUTHPRIV LOG_AUTH
64
65 /* This should not conflict with existing flags. */
66 #define MSG_DONTWAIT 0x1000000
67
68 /* fesetround() doesn't seem to be returning 0 as expected. */
69 static int MLton_fesetround (int mode)
70 {
71 fesetround (mode);
72 return 0;
73 }
74 #define fesetround MLton_fesetround
75
76 typedef long suseconds_t; // type of timeval.tv_usec in sys/time.h
77
78 #ifdef __hppa__
79 /* These do not exist on HPPA, so we implement our own. */
80 float modff(float x, float *iptr);
81 float rintf(float x);
82 float frexpf(float x, int *exp);
83 float ldexpf(float x, int exp);
84 #endif /* __hppa__ */
85
86 #define PRIxPTR "lx"
87
88 /* These are incorrectly defined in the system headers. */
89 #undef PRIu32
90 #define PRIu32 "u"
91 #undef PRIx32
92 #define PRIx32 "x"
93 #undef PRId32
94 #define PRId32 "d"