4 #include <fpu_control.h>
15 #include <netinet/in.h>
16 #include <netinet/tcp.h>
19 #include <sys/ioctl.h>
21 #include <sys/resource.h>
22 #include <sys/socket.h>
25 #include <sys/times.h>
27 #include <sys/utsname.h>
29 #include <sys/sysinfo.h>
35 #define HAS_FEROUND FALSE
37 #define HAS_FEROUND TRUE
39 #define HAS_MSG_DONTWAIT TRUE
40 #define HAS_REMAP TRUE
41 #define HAS_SIGALTSTACK TRUE
42 #if (defined (__hppa__))
43 #define NEEDS_SIGALTSTACK_EXEC TRUE
45 #define NEEDS_SIGALTSTACK_EXEC FALSE
47 #define HAS_SPAWN FALSE
48 #define HAS_TIME_PROFILING TRUE
50 #define MLton_Platform_OS_host "linux"
52 // environ is already defined if _GNU_SOURCE is.
53 #if !defined(_GNU_SOURCE) && !defined(__ANDROID__)
54 extern char **environ
; /* for Posix_ProcEnv_environ */
57 /* The following is compatibility code with older glibc and kernel
60 #ifndef __suseconds_t_defined
61 #include <linux/types.h>
62 typedef __kernel_suseconds_t suseconds_t
;
63 #define __suseconds_t_defined
67 #if __GLIBC__ == 2 && __GLIBC_MINOR__ <= 1
68 typedef unsigned long int nfds_t
;
73 /* Work around buggy android system libraries */
77 /* Needed for fetching program counter */
78 #include <platform/android_ucontext.h>
80 /* Android is missing these methods: */
83 #define tcdrain MLton_tcdrain
84 #define ctermid MLton_ctermid
86 static inline int tcdrain(int fd
) {
87 return ioctl(fd
, TCSBRK
, 1);
90 static inline char* ctermid(char* x
) {
91 static char buf
[] = "/dev/tty";
102 #ifndef SO_ACCEPTCONN
103 #define SO_ACCEPTCONN 30
107 #define FE_DOWNWARD _FPU_RC_DOWN
108 #define FE_TONEAREST _FPU_RC_NEAREST
109 #define FE_TOWARDZERO _FPU_RC_ZERO
110 #define FE_UPWARD _FPU_RC_UP