/usr/lib/mlton/include/platform.h is in mlton-basis 20130715-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | /* Copyright (C) 2010,2012 Matthew Fluet.
* Copyright (C) 1999-2008 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
* MLton is released under a BSD-style license.
* See the file MLton-LICENSE for details.
*/
#ifndef _MLTON_PLATFORM_H_
#define _MLTON_PLATFORM_H_
#include "cenv.h"
#include "util.h"
#include "ml-types.h"
#include "c-types.h"
#ifndef MLton_Platform_Arch_host
#error MLton_Platform_Arch_host not defined
#endif
#ifndef MLton_Platform_OS_host
#error MLton_Platform_OS_host not defined
#endif
#ifndef HAS_FEROUND
#error HAS_FEROUND not defined
#endif
#ifndef HAS_MSG_DONTWAIT
#error HAS_MSG_DONTWAIT not defined
#endif
#ifndef HAS_REMAP
#error HAS_REMAP not defined
#endif
#ifndef HAS_SIGALTSTACK
#error HAS_SIGALTSTACK not defined
#endif
#ifndef HAS_SPAWN
#error HAS_SPAWN not defined
#endif
#ifndef HAS_TIME_PROFILING
#error HAS_TIME_PROFILING not defined
#endif
#ifndef EXECVP
#define EXECVP execvp
#endif
#ifndef EXECVE
#define EXECVE execve
#endif
#define FE_NOSUPPORT -1
/* With HAS_FEROUND unset, the runtime will provide the implementation.
* That implementation depends on FE_* having the values we set below.
* We must therefore make sure to eliminate any existing #defines and
* then create our own defines, which will also take precedence over
* any enums we included from system headers.
*/
#if not HAS_FEROUND
#ifdef FE_TONEAREST
#undef FE_TONEAREST
#endif
#ifdef FE_DOWNWARD
#undef FE_DOWNWARD
#endif
#ifdef FE_UPWARD
#undef FE_UPWARD
#endif
#ifdef FE_TOWARDZERO
#undef FE_TOWARDZERO
#endif
#define FE_TONEAREST 0
#define FE_DOWNWARD 1
#define FE_UPWARD 2
#define FE_TOWARDZERO 3
#endif
#ifndef MLTON_CODEGEN_STATIC_INLINE
#define MLTON_CODEGEN_STATIC_INLINE PRIVATE
#endif
#ifndef MLTON_CODEGEN_MATHFN
#define MLTON_CODEGEN_MATHFN(decl)
#endif
#ifndef MLTON_CODEGEN_WORDSQUOTREM
#define MLTON_CODEGEN_WORDSQUOTREM(func) func
#endif
#ifndef MLTON_CODEGEN_WORDSQUOTREM_IMPL
#define MLTON_CODEGEN_WORDSQUOTREM_IMPL(func) func
#endif
#include "basis-ffi.h"
#include "gc.h"
/* ---------------------------------------------------------------- */
/* Runtime Init/Exit/Alloc */
/* ---------------------------------------------------------------- */
PRIVATE void MLton_init (int argc, char **argv, GC_state s);
PRIVATE __attribute__ ((noreturn)) void MLton_halt (GC_state s, C_Int_t status);
PRIVATE __attribute__ ((noreturn)) void MLton_heapCheckTooLarge (void);
/* ---------------------------------------------------------------- */
/* Utility libraries */
/* ---------------------------------------------------------------- */
/* ---------------------------------------------------------------- */
/* Garbage Collector */
/* ---------------------------------------------------------------- */
/* ------------------------------------------------- */
/* Virtual Memory */
/* ------------------------------------------------- */
/* GC_displayMem displays the virtual memory mapping to stdout.
* It is used to diagnose memory problems.
*/
PRIVATE void GC_displayMem (void);
PRIVATE void *GC_mmapAnon (void *start, size_t length);
PRIVATE void *GC_mmapAnon_safe (void *start, size_t length);
PRIVATE void *GC_mmapAnon_safe_protect (void *start, size_t length,
size_t dead_low, size_t dead_high);
PRIVATE void *GC_mremap (void *start, size_t oldLength, size_t newLength);
PRIVATE void GC_release (void *base, size_t length);
PRIVATE size_t GC_pageSize (void);
PRIVATE uintmax_t GC_physMem (void);
PRIVATE void GC_setCygwinUseMmap (bool b);
PRIVATE void GC_diskBack_close (void *data);
PRIVATE void GC_diskBack_read (void *data, pointer buf, size_t size);
PRIVATE void *GC_diskBack_write (pointer buf, size_t size);
/* ------------------------------------------------- */
/* SigProf Handler */
/* ------------------------------------------------- */
PRIVATE void GC_setSigProfHandler (struct sigaction *sa);
/* ---------------------------------------------------------------- */
/* MLton libraries */
/* ---------------------------------------------------------------- */
/* ------------------------------------------------- */
/* MLton */
/* ------------------------------------------------- */
/* ---------------------------------- */
/* MLton.Platform */
/* ---------------------------------- */
#define MLton_Platform_Arch_bigendian isBigEndian()
PRIVATE extern Bool MLton_Platform_CygwinUseMmap;
/* ------------------------------------------------- */
/* Socket */
/* ------------------------------------------------- */
#if (defined (__MSVCRT__))
PRIVATE void MLton_initSockets (void);
PRIVATE void MLton_fixSocketErrno (void);
#else
static inline void MLton_initSockets (void) {}
static inline void MLton_fixSocketErrno (void) {}
#endif
#if HAS_MSG_DONTWAIT
#define MLton_recv recv
#define MLton_recvfrom recvfrom
#else
/* Platform has no MSG_DONTWAIT flag for recv(), so these must be
defined to simulate that flag. */
PRIVATE int MLton_recv(int s, void *buf, int len, int flags);
PRIVATE int MLton_recvfrom(int s, void *buf, int len, int flags, void *from, socklen_t *fromlen);
#endif
#endif /* _MLTON_PLATFORM_H_ */
|