| 1 |
|
| 2 |
#ifndef _WIN32_WINNT |
| 3 |
#define _WIN32_WINNT 0x0500 |
| 4 |
#endif |
| 5 |
|
| 6 |
#include <inttypes.h> |
| 7 |
#include <stdint.h> |
| 8 |
|
| 9 |
#include <unistd.h> |
| 10 |
#include <winsock2.h> |
| 11 |
#include <windows.h> |
| 12 |
|
| 13 |
#include <dirent.h> |
| 14 |
#include <fcntl.h> |
| 15 |
#include <sys/stat.h> |
| 16 |
#include <sys/stat.h> |
| 17 |
#include <sys/time.h> |
| 18 |
#include <sys/timeb.h> |
| 19 |
#include <sys/types.h> |
| 20 |
#include <utime.h> |
| 21 |
#include <time.h> |
| 22 |
|
| 23 |
#include <io.h> |
| 24 |
#include <lm.h> |
| 25 |
#include <process.h> |
| 26 |
|
| 27 |
#include <ws2tcpip.h> |
| 28 |
#include <psapi.h> |
| 29 |
|
| 30 |
#undef max |
| 31 |
|
| 32 |
|
| 33 |
#define HAS_FEROUND FALSE |
| 34 |
#define HAS_MSG_DONTWAIT FALSE |
| 35 |
#define HAS_REMAP TRUE |
| 36 |
#define HAS_SHRINK_HEAP TRUE |
| 37 |
#define HAS_SIGALTSTACK FALSE |
| 38 |
#define NEEDS_SIGALTSTACK_EXEC FALSE |
| 39 |
#define HAS_SPAWN TRUE |
| 40 |
#define HAS_TIME_PROFILING TRUE |
| 41 |
|
| 42 |
#define MLton_Platform_OS_host "mingw" |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
#define MLTON_WRAPPER |
| 56 |
|
| 57 |
typedef unsigned short MLton_gid_t; |
| 58 |
typedef unsigned short MLton_uid_t; |
| 59 |
typedef long MLton_suseconds_t; |
| 60 |
typedef short MLton_nlink_t; |
| 61 |
typedef unsigned int MLton_nfds_t; |
| 62 |
|
| 63 |
#undef gid_t |
| 64 |
#undef uid_t |
| 65 |
#undef suseconds_t |
| 66 |
#undef nlink_t |
| 67 |
#undef nfds_t |
| 68 |
|
| 69 |
#define gid_t MLton_gid_t |
| 70 |
#define uid_t MLton_uid_t |
| 71 |
#define suseconds_t MLton_suseconds_t |
| 72 |
#define nlink_t MLton_nlink_t |
| 73 |
#define nfds_t MLton_nfds_t |
| 74 |
|
| 75 |
MLTON_WRAPPER int MLton_getpagesize (void); |
| 76 |
MLTON_WRAPPER int MLton_mkstemp (char *template); |
| 77 |
|
| 78 |
#undef getpagesize |
| 79 |
#undef mkstemp |
| 80 |
|
| 81 |
#define getpagesize MLton_getpagesize |
| 82 |
#define mkstemp MLton_mkstemp |
| 83 |
|
| 84 |
#ifndef POLLIN |
| 85 |
#define POLLIN 1 |
| 86 |
#endif |
| 87 |
|
| 88 |
#ifndef POLLPRI |
| 89 |
#define POLLPRI 2 |
| 90 |
#endif |
| 91 |
|
| 92 |
#ifndef POLLOUT |
| 93 |
#define POLLOUT 4 |
| 94 |
#endif |
| 95 |
|
| 96 |
#ifndef _PC_CHOWN_RESTRICTED |
| 97 |
#define _PC_CHOWN_RESTRICTED 6 |
| 98 |
#endif |
| 99 |
|
| 100 |
#ifndef _PC_LINK_MAX |
| 101 |
#define _PC_LINK_MAX 0 |
| 102 |
#endif |
| 103 |
|
| 104 |
#ifndef _PC_MAX_CANON |
| 105 |
#define _PC_MAX_CANON 1 |
| 106 |
#endif |
| 107 |
|
| 108 |
#ifndef _PC_MAX_INPUT |
| 109 |
#define _PC_MAX_INPUT 2 |
| 110 |
#endif |
| 111 |
|
| 112 |
#ifndef _PC_NAME_MAX |
| 113 |
#define _PC_NAME_MAX 3 |
| 114 |
#endif |
| 115 |
|
| 116 |
#ifndef _PC_NO_TRUNC |
| 117 |
#define _PC_NO_TRUNC 7 |
| 118 |
#endif |
| 119 |
|
| 120 |
#ifndef _PC_PATH_MAX |
| 121 |
#define _PC_PATH_MAX 4 |
| 122 |
#endif |
| 123 |
|
| 124 |
#ifndef _PC_PIPE_BUF |
| 125 |
#define _PC_PIPE_BUF 5 |
| 126 |
#endif |
| 127 |
|
| 128 |
#ifndef _PC_VDISABLE |
| 129 |
#define _PC_VDISABLE 8 |
| 130 |
#endif |
| 131 |
|
| 132 |
#ifndef F_DUPFD |
| 133 |
#define F_DUPFD 0 |
| 134 |
#endif |
| 135 |
|
| 136 |
#ifndef F_GETFD |
| 137 |
#define F_GETFD 1 |
| 138 |
#endif |
| 139 |
|
| 140 |
#ifndef F_SETFD |
| 141 |
#define F_SETFD 2 |
| 142 |
#endif |
| 143 |
|
| 144 |
#ifndef F_GETFL |
| 145 |
#define F_GETFL 3 |
| 146 |
#endif |
| 147 |
|
| 148 |
#ifndef F_SETFL |
| 149 |
#define F_SETFL 4 |
| 150 |
#endif |
| 151 |
|
| 152 |
#ifndef F_GETOWN |
| 153 |
#define F_GETOWN 5 |
| 154 |
#endif |
| 155 |
|
| 156 |
#ifndef F_SETOWN |
| 157 |
#define F_SETOWN 6 |
| 158 |
#endif |
| 159 |
|
| 160 |
#ifndef F_GETLK |
| 161 |
#define F_GETLK 7 |
| 162 |
#endif |
| 163 |
|
| 164 |
#ifndef F_SETLK |
| 165 |
#define F_SETLK 8 |
| 166 |
#endif |
| 167 |
|
| 168 |
#ifndef F_RDLCK |
| 169 |
#define F_RDLCK 1 |
| 170 |
#endif |
| 171 |
|
| 172 |
#ifndef F_WRLCK |
| 173 |
#define F_WRLCK 2 |
| 174 |
#endif |
| 175 |
|
| 176 |
#ifndef F_UNLCK |
| 177 |
#define F_UNLCK 3 |
| 178 |
#endif |
| 179 |
|
| 180 |
#ifndef F_SETLKW |
| 181 |
#define F_SETLKW 9 |
| 182 |
#endif |
| 183 |
|
| 184 |
#ifndef FD_CLOEXEC |
| 185 |
#define FD_CLOEXEC 1 |
| 186 |
#endif |
| 187 |
|
| 188 |
#ifndef SHUT_RD |
| 189 |
#define SHUT_RD SD_RECEIVE |
| 190 |
#endif |
| 191 |
|
| 192 |
#ifndef SHUT_WR |
| 193 |
#define SHUT_WR SD_SEND |
| 194 |
#endif |
| 195 |
|
| 196 |
#ifndef SHUT_RDWR |
| 197 |
#define SHUT_RDWR SD_BOTH |
| 198 |
#endif |
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
struct MLton_timezone { |
| 208 |
int unused; |
| 209 |
}; |
| 210 |
#undef timezone |
| 211 |
#define timezone MLton_timezone |
| 212 |
|
| 213 |
MLTON_WRAPPER int MLton_gettimeofday (struct timeval *tv, struct timezone *tz); |
| 214 |
#undef gettimeofday |
| 215 |
#define gettimeofday MLton_gettimeofday |
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
#ifndef ITIMER_REAL |
| 222 |
#define ITIMER_REAL 0 |
| 223 |
#endif |
| 224 |
|
| 225 |
#ifndef ITIMER_VIRTUAL |
| 226 |
#define ITIMER_VIRTUAL 1 |
| 227 |
#endif |
| 228 |
|
| 229 |
#ifndef ITIMER_VIRT |
| 230 |
#define ITIMER_VIRT 1 |
| 231 |
#endif |
| 232 |
|
| 233 |
#ifndef ITIMER_PROF |
| 234 |
#define ITIMER_PROF 2 |
| 235 |
#endif |
| 236 |
|
| 237 |
struct MLton_itimerval { |
| 238 |
struct timeval it_interval; |
| 239 |
struct timeval it_value; |
| 240 |
}; |
| 241 |
#undef itimerval |
| 242 |
#define itimerval MLton_itimerval |
| 243 |
|
| 244 |
MLTON_WRAPPER int MLton_setitimer (int which, |
| 245 |
const struct itimerval *value, |
| 246 |
struct itimerval *ovalue); |
| 247 |
#undef setitimer |
| 248 |
#define setitimer MLton_setitimer |
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
#ifndef RLIMIT_CPU |
| 255 |
#define RLIMIT_CPU 0 |
| 256 |
#endif |
| 257 |
|
| 258 |
#ifndef RLIMIT_FSIZE |
| 259 |
#define RLIMIT_FSIZE 1 |
| 260 |
#endif |
| 261 |
|
| 262 |
#ifndef RLIMIT_DATA |
| 263 |
#define RLIMIT_DATA 2 |
| 264 |
#endif |
| 265 |
|
| 266 |
#ifndef RLIMIT_STACK |
| 267 |
#define RLIMIT_STACK 3 |
| 268 |
#endif |
| 269 |
|
| 270 |
#ifndef RLIMIT_CORE |
| 271 |
#define RLIMIT_CORE 4 |
| 272 |
#endif |
| 273 |
|
| 274 |
#ifndef RLIMIT_NOFILE |
| 275 |
#define RLIMIT_NOFILE 5 |
| 276 |
#endif |
| 277 |
|
| 278 |
#ifndef RLIMIT_OFILE |
| 279 |
#define RLIMIT_OFILE RLIMIT_NOFILE |
| 280 |
#endif |
| 281 |
|
| 282 |
#ifndef RLIMIT_AS |
| 283 |
#define RLIMIT_AS 6 |
| 284 |
#endif |
| 285 |
|
| 286 |
#define RLIMIT_NLIMITS 7 |
| 287 |
#define RLIM_NLIMITS RLIMIT_NLIMITS |
| 288 |
|
| 289 |
#ifndef RLIM_INFINITY |
| 290 |
#define RLIM_INFINITY (0xffffffffUL) |
| 291 |
#endif |
| 292 |
|
| 293 |
#ifndef RLIM_SAVED_MAX |
| 294 |
#define RLIM_SAVED_MAX RLIM_INFINITY |
| 295 |
#endif |
| 296 |
|
| 297 |
#ifndef RLIM_SAVED_CUR |
| 298 |
#define RLIM_SAVED_CUR RLIM_INFINITY |
| 299 |
#endif |
| 300 |
|
| 301 |
typedef unsigned long MLton_rlim_t; |
| 302 |
#undef rlim_t |
| 303 |
#define rlim_t MLton_rlim_t |
| 304 |
|
| 305 |
struct MLton_rlimit { |
| 306 |
rlim_t rlim_cur; |
| 307 |
rlim_t rlim_max; |
| 308 |
}; |
| 309 |
#undef rlimit |
| 310 |
#define rlimit MLton_rlimit |
| 311 |
|
| 312 |
MLTON_WRAPPER int MLton_getrlimit (int resource, struct rlimit *rlim); |
| 313 |
MLTON_WRAPPER int MLton_setrlimit (int resource, const struct rlimit *rlim); |
| 314 |
#undef getrlimit |
| 315 |
#undef setrlimit |
| 316 |
#define getrlimit MLton_getrlimit |
| 317 |
#define setrlimit MLton_setrlimit |
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
#ifndef RUSAGE_SELF |
| 324 |
#define RUSAGE_SELF 0 |
| 325 |
#endif |
| 326 |
|
| 327 |
#ifndef RUSAGE_CHILDREN |
| 328 |
#define RUSAGE_CHILDREN -1 |
| 329 |
#endif |
| 330 |
|
| 331 |
struct MLton_rusage { |
| 332 |
struct timeval ru_utime; |
| 333 |
struct timeval ru_stime; |
| 334 |
}; |
| 335 |
#undef rusage |
| 336 |
#define rusage MLton_rusage |
| 337 |
|
| 338 |
MLTON_WRAPPER int MLton_getrusage (int who, struct rusage *usage); |
| 339 |
#undef getrusage |
| 340 |
#define getrusage MLton_getrusage |
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
struct MLton_pollfd { |
| 347 |
short events; |
| 348 |
int fd; |
| 349 |
short revents; |
| 350 |
}; |
| 351 |
#undef pollfd |
| 352 |
#define pollfd MLton_pollfd |
| 353 |
|
| 354 |
MLTON_WRAPPER int MLton_poll (struct pollfd *ufds, nfds_t nfds, int timeout); |
| 355 |
#undef poll |
| 356 |
#define poll MLton_poll |
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
#ifndef MLTON_UTIL |
| 364 |
MLTON_WRAPPER char *MLton_strerror(int code); |
| 365 |
#undef strerror |
| 366 |
#define strerror MLton_strerror |
| 367 |
#endif |
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
#ifndef EINTR |
| 374 |
#define EINTR WSAEINTR |
| 375 |
#endif |
| 376 |
|
| 377 |
#ifndef EBADF |
| 378 |
#define EBADF WSAEBADF |
| 379 |
#endif |
| 380 |
|
| 381 |
#ifndef EACCES |
| 382 |
#define EACCES WSAEACCES |
| 383 |
#endif |
| 384 |
|
| 385 |
#ifndef EFAULT |
| 386 |
#define EFAULT WSAEFAULT |
| 387 |
#endif |
| 388 |
|
| 389 |
#ifndef EINVAL |
| 390 |
#define EINVAL WSAEINVAL |
| 391 |
#endif |
| 392 |
|
| 393 |
#ifndef EMFILE |
| 394 |
#define EMFILE WSAEMFILE |
| 395 |
#endif |
| 396 |
|
| 397 |
#ifndef EAGAIN |
| 398 |
#define EAGAIN WSAEWOULDBLOCK |
| 399 |
#endif |
| 400 |
|
| 401 |
#ifndef EWOULDBLOCK |
| 402 |
#define EWOULDBLOCK EAGAIN |
| 403 |
#endif |
| 404 |
|
| 405 |
#ifndef EINPROGRESS |
| 406 |
#define EINPROGRESS WSAEINPROGRESS |
| 407 |
#endif |
| 408 |
|
| 409 |
#ifndef EALREADY |
| 410 |
#define EALREADY WSAEALREADY |
| 411 |
#endif |
| 412 |
|
| 413 |
#ifndef ENOTSOCK |
| 414 |
#define ENOTSOCK WSAENOTSOCK |
| 415 |
#endif |
| 416 |
|
| 417 |
#ifndef EDESTADDRREQ |
| 418 |
#define EDESTADDRREQ WSAEDESTADDRREQ |
| 419 |
#endif |
| 420 |
|
| 421 |
#ifndef EMSGSIZE |
| 422 |
#define EMSGSIZE WSAEMSGSIZE |
| 423 |
#endif |
| 424 |
|
| 425 |
#ifndef EPROTOTYPE |
| 426 |
#define EPROTOTYPE WSAEPROTOTYPE |
| 427 |
#endif |
| 428 |
|
| 429 |
#ifndef ENOPROTOOPT |
| 430 |
#define ENOPROTOOPT WSAENOPROTOOPT |
| 431 |
#endif |
| 432 |
|
| 433 |
#ifndef EPROTONOSUPPORT |
| 434 |
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT |
| 435 |
#endif |
| 436 |
|
| 437 |
#ifndef ESOCKTNOSUPPORT |
| 438 |
#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT |
| 439 |
#endif |
| 440 |
|
| 441 |
#ifndef EOPNOTSUPP |
| 442 |
#define EOPNOTSUPP WSAEOPNOTSUPP |
| 443 |
#endif |
| 444 |
|
| 445 |
#ifndef EPFNOSUPPORT |
| 446 |
#define EPFNOSUPPORT WSAEPFNOSUPPORT |
| 447 |
#endif |
| 448 |
|
| 449 |
#ifndef EAFNOSUPPORT |
| 450 |
#define EAFNOSUPPORT WSAEAFNOSUPPORT |
| 451 |
#endif |
| 452 |
|
| 453 |
#ifndef EADDRINUSE |
| 454 |
#define EADDRINUSE WSAEADDRINUSE |
| 455 |
#endif |
| 456 |
|
| 457 |
#ifndef EADDRNOTAVAIL |
| 458 |
#define EADDRNOTAVAIL WSAEADDRNOTAVAIL |
| 459 |
#endif |
| 460 |
|
| 461 |
#ifndef ENETDOWN |
| 462 |
#define ENETDOWN WSAENETDOWN |
| 463 |
#endif |
| 464 |
|
| 465 |
#ifndef ENETUNREACH |
| 466 |
#define ENETUNREACH WSAENETUNREACH |
| 467 |
#endif |
| 468 |
|
| 469 |
#ifndef ENETRESET |
| 470 |
#define ENETRESET WSAENETRESET |
| 471 |
#endif |
| 472 |
|
| 473 |
#ifndef ECONNABORTED |
| 474 |
#define ECONNABORTED WSAECONNABORTED |
| 475 |
#endif |
| 476 |
|
| 477 |
#ifndef ECONNRESET |
| 478 |
#define ECONNRESET WSAECONNRESET |
| 479 |
#endif |
| 480 |
|
| 481 |
#ifndef ENOBUFS |
| 482 |
#define ENOBUFS WSAENOBUFS |
| 483 |
#endif |
| 484 |
|
| 485 |
#ifndef EISCONN |
| 486 |
#define EISCONN WSAEISCONN |
| 487 |
#endif |
| 488 |
|
| 489 |
#ifndef ENOTCONN |
| 490 |
#define ENOTCONN WSAENOTCONN |
| 491 |
#endif |
| 492 |
|
| 493 |
#ifndef ESHUTDOWN |
| 494 |
#define ESHUTDOWN WSAESHUTDOWN |
| 495 |
#endif |
| 496 |
|
| 497 |
#ifndef ETIMEDOUT |
| 498 |
#define ETIMEDOUT WSAETIMEDOUT |
| 499 |
#endif |
| 500 |
|
| 501 |
#ifndef ECONNREFUSED |
| 502 |
#define ECONNREFUSED WSAECONNREFUSED |
| 503 |
#endif |
| 504 |
|
| 505 |
#ifndef ELOOP |
| 506 |
#define ELOOP WSAELOOP |
| 507 |
#endif |
| 508 |
|
| 509 |
#ifndef ENAMETOOLONG |
| 510 |
#define ENAMETOOLONG WSAENAMETOOLONG |
| 511 |
#endif |
| 512 |
|
| 513 |
#ifndef EHOSTDOWN |
| 514 |
#define EHOSTDOWN WSAEHOSTDOWN |
| 515 |
#endif |
| 516 |
|
| 517 |
#ifndef EHOSTUNREACH |
| 518 |
#define EHOSTUNREACH WSAEHOSTUNREACH |
| 519 |
#endif |
| 520 |
|
| 521 |
#ifndef ENOTEMPTY |
| 522 |
#define ENOTEMPTY WSAENOTEMPTY |
| 523 |
#endif |
| 524 |
|
| 525 |
#ifndef EDQUOT |
| 526 |
#define EDQUOT WSAEDQUOT |
| 527 |
#endif |
| 528 |
|
| 529 |
#ifndef ESTALE |
| 530 |
#define ESTALE WSAESTALE |
| 531 |
#endif |
| 532 |
|
| 533 |
#ifndef ERMOTE |
| 534 |
#define EREMOTE WSAEREMOTE |
| 535 |
#endif |
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
#ifndef EUSERS |
| 540 |
#define EUSERS WSAEUSERS |
| 541 |
#endif |
| 542 |
|
| 543 |
#ifndef ECANCELED |
| 544 |
#define ECANCELED WSAECANCELLED |
| 545 |
#endif |
| 546 |
|
| 547 |
#ifndef EBADMSG |
| 548 |
#define EBADMSG 77 |
| 549 |
#endif |
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
#ifndef S_IRGRP |
| 556 |
#define S_IRGRP 0000040 |
| 557 |
#endif |
| 558 |
|
| 559 |
#ifndef S_IROTH |
| 560 |
#define S_IROTH 0000004 |
| 561 |
#endif |
| 562 |
|
| 563 |
#ifndef S_IRWXG |
| 564 |
#define S_IRWXG 0000070 |
| 565 |
#endif |
| 566 |
|
| 567 |
#ifndef S_IRWXO |
| 568 |
#define S_IRWXO 0000007 |
| 569 |
#endif |
| 570 |
|
| 571 |
#ifndef S_ISGID |
| 572 |
#define S_ISGID 0002000 |
| 573 |
#endif |
| 574 |
|
| 575 |
#ifndef S_ISUID |
| 576 |
#define S_ISUID 0004000 |
| 577 |
#endif |
| 578 |
|
| 579 |
#ifndef S_IWGRP |
| 580 |
#define S_IWGRP 0000020 |
| 581 |
#endif |
| 582 |
|
| 583 |
#ifndef S_IWOTH |
| 584 |
#define S_IWOTH 0000002 |
| 585 |
#endif |
| 586 |
|
| 587 |
#ifndef S_IXGRP |
| 588 |
#define S_IXGRP 0000010 |
| 589 |
#endif |
| 590 |
|
| 591 |
#ifndef S_IXOTH |
| 592 |
#define S_IXOTH 0000001 |
| 593 |
#endif |
| 594 |
|
| 595 |
|
| 596 |
#ifndef S_IFLNK |
| 597 |
#define S_IFLNK 0 |
| 598 |
#endif |
| 599 |
|
| 600 |
#ifndef S_IFSOCK |
| 601 |
#define S_IFSOCK 0 |
| 602 |
#endif |
| 603 |
|
| 604 |
#ifndef S_ISVTX |
| 605 |
#define S_ISVTX 0 |
| 606 |
#endif |
| 607 |
|
| 608 |
#ifndef O_NOCTTY |
| 609 |
#define O_NOCTTY 0x8000 |
| 610 |
#endif |
| 611 |
|
| 612 |
#ifndef O_NONBLOCK |
| 613 |
#define O_NONBLOCK 0x4000 |
| 614 |
#endif |
| 615 |
|
| 616 |
|
| 617 |
#ifndef O_SYNC |
| 618 |
#define O_SYNC 0 |
| 619 |
#endif |
| 620 |
|
| 621 |
|
| 622 |
#undef S_ISLNK |
| 623 |
#undef S_ISSOCK |
| 624 |
#define S_ISLNK(m) (m?FALSE:FALSE) |
| 625 |
#define S_ISSOCK(m) (m?FALSE:FALSE) |
| 626 |
|
| 627 |
#ifndef O_ACCMODE |
| 628 |
#define O_ACCMODE O_RDONLY|O_WRONLY|O_RDWR |
| 629 |
#endif |
| 630 |
|
| 631 |
MLTON_WRAPPER int MLton_chown (const char *path, uid_t owner, gid_t group); |
| 632 |
MLTON_WRAPPER int MLton_fchmod (int filedes, mode_t mode); |
| 633 |
MLTON_WRAPPER int MLton_fchdir (int filedes); |
| 634 |
MLTON_WRAPPER int MLton_fchown (int fd, uid_t owner, gid_t group); |
| 635 |
MLTON_WRAPPER long MLton_fpathconf (int filedes, int name); |
| 636 |
MLTON_WRAPPER int MLton_link (const char *oldpath, const char *newpath); |
| 637 |
MLTON_WRAPPER int MLton_lstat (const char *file_name, struct stat *buf); |
| 638 |
MLTON_WRAPPER int MLton_mkfifo (const char *pathname, mode_t mode); |
| 639 |
MLTON_WRAPPER long MLton_pathconf (const char *path, int name); |
| 640 |
MLTON_WRAPPER int MLton_readlink (const char *path, char *buf, size_t bufsiz); |
| 641 |
MLTON_WRAPPER int MLton_symlink (const char *oldpath, const char *newpath); |
| 642 |
MLTON_WRAPPER int MLton_truncate (const char *path, off_t len); |
| 643 |
|
| 644 |
#undef chown |
| 645 |
#undef fchmod |
| 646 |
#undef fchdir |
| 647 |
#undef fchown |
| 648 |
#undef fpathconf |
| 649 |
#undef link |
| 650 |
#undef lstat |
| 651 |
#undef mkfifo |
| 652 |
#undef pathconf |
| 653 |
#undef readlink |
| 654 |
#undef symlink |
| 655 |
#undef truncate |
| 656 |
|
| 657 |
#define chown MLton_chown |
| 658 |
#define fchmod MLton_fchmod |
| 659 |
#define fchdir MLton_fchdir |
| 660 |
#define fchown MLton_fchown |
| 661 |
#define fpathconf MLton_fpathconf |
| 662 |
#define link MLton_link |
| 663 |
#define lstat MLton_lstat |
| 664 |
#define mkfifo MLton_mkfifo |
| 665 |
#define pathconf MLton_pathconf |
| 666 |
#define readlink MLton_readlink |
| 667 |
#define symlink MLton_symlink |
| 668 |
#define truncate MLton_truncate |
| 669 |
|
| 670 |
#undef mkdir |
| 671 |
#define mkdir(f, m) mkdir(f); chmod(f, m) |
| 672 |
|
| 673 |
|
| 674 |
|
| 675 |
|
| 676 |
|
| 677 |
struct MLton_flock { |
| 678 |
off_t l_len; |
| 679 |
pid_t l_pid; |
| 680 |
off_t l_start; |
| 681 |
short l_type; |
| 682 |
short l_whence; |
| 683 |
}; |
| 684 |
#undef flock |
| 685 |
#define flock MLton_flock |
| 686 |
|
| 687 |
MLTON_WRAPPER int MLton_fcntl (int fd, int cmd, ...); |
| 688 |
MLTON_WRAPPER int MLton_fsync (int fd); |
| 689 |
MLTON_WRAPPER int MLton_pipe (int filedes[2]); |
| 690 |
|
| 691 |
#undef fcntl |
| 692 |
#undef fsync |
| 693 |
#undef pipe |
| 694 |
|
| 695 |
#define fcntl MLton_fcntl |
| 696 |
#define fsync MLton_fsync |
| 697 |
#define pipe MLton_pipe |
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
#ifndef _SC_ARG_MAX |
| 704 |
#define _SC_ARG_MAX 0 |
| 705 |
#endif |
| 706 |
|
| 707 |
#ifndef _SC_CHILD_MAX |
| 708 |
#define _SC_CHILD_MAX 1 |
| 709 |
#endif |
| 710 |
|
| 711 |
#ifndef _SC_CLK_TCK |
| 712 |
#define _SC_CLK_TCK 2 |
| 713 |
#endif |
| 714 |
|
| 715 |
#ifndef _SC_JOB_CONTROL |
| 716 |
#define _SC_JOB_CONTROL 5 |
| 717 |
#endif |
| 718 |
|
| 719 |
#ifndef _SC_NGROUPS_MAX |
| 720 |
#define _SC_NGROUPS_MAX 3 |
| 721 |
#endif |
| 722 |
|
| 723 |
#ifndef _SC_OPEN_MAX |
| 724 |
#define _SC_OPEN_MAX 4 |
| 725 |
#endif |
| 726 |
|
| 727 |
#ifndef _SC_SAVED_IDS |
| 728 |
#define _SC_SAVED_IDS 6 |
| 729 |
#endif |
| 730 |
|
| 731 |
#ifndef _SC_VERSION |
| 732 |
#define _SC_VERSION 7 |
| 733 |
#endif |
| 734 |
|
| 735 |
struct MLton_tms { |
| 736 |
int tms_utime; |
| 737 |
int tms_stime; |
| 738 |
int tms_cutime; |
| 739 |
int tms_cstime; |
| 740 |
}; |
| 741 |
|
| 742 |
struct MLton_utsname { |
| 743 |
char machine[20]; |
| 744 |
char nodename[256]; |
| 745 |
char release[20]; |
| 746 |
char sysname[30]; |
| 747 |
char version[20]; |
| 748 |
}; |
| 749 |
|
| 750 |
#undef tms |
| 751 |
#undef utsname |
| 752 |
|
| 753 |
#define tms MLton_tms |
| 754 |
#define utsname MLton_utsname |
| 755 |
|
| 756 |
MLTON_WRAPPER char *MLton_getlogin (void); |
| 757 |
MLTON_WRAPPER char *MLton_ctermid (char *s); |
| 758 |
MLTON_WRAPPER gid_t MLton_getegid (void); |
| 759 |
MLTON_WRAPPER uid_t MLton_geteuid (void); |
| 760 |
MLTON_WRAPPER gid_t MLton_getgid (void); |
| 761 |
MLTON_WRAPPER int MLton_getgroups (int size, gid_t list[]); |
| 762 |
MLTON_WRAPPER pid_t MLton_getpgid(pid_t pid); |
| 763 |
MLTON_WRAPPER pid_t MLton_getpgrp(void); |
| 764 |
MLTON_WRAPPER pid_t MLton_getppid (void); |
| 765 |
MLTON_WRAPPER uid_t MLton_getuid (void); |
| 766 |
MLTON_WRAPPER int MLton_setenv (const char *name, const char *value, int overwrite); |
| 767 |
MLTON_WRAPPER int MLton_setgid (gid_t gid); |
| 768 |
MLTON_WRAPPER int MLton_setgroups (size_t size, const gid_t *list); |
| 769 |
MLTON_WRAPPER int MLton_setpgid (pid_t pid, pid_t pgid); |
| 770 |
MLTON_WRAPPER pid_t MLton_setsid (void); |
| 771 |
MLTON_WRAPPER int MLton_setuid (uid_t uid); |
| 772 |
MLTON_WRAPPER long MLton_sysconf (int name); |
| 773 |
MLTON_WRAPPER clock_t MLton_times (struct tms *buf); |
| 774 |
MLTON_WRAPPER char *MLton_ttyname (int desc); |
| 775 |
MLTON_WRAPPER int MLton_uname (struct utsname *buf); |
| 776 |
|
| 777 |
#undef getlogin |
| 778 |
#undef ctermid |
| 779 |
#undef getegid |
| 780 |
#undef geteuid |
| 781 |
#undef getgid |
| 782 |
#undef getgroups |
| 783 |
#undef getpgid |
| 784 |
#undef getpgrp |
| 785 |
#undef getppid |
| 786 |
#undef getuid |
| 787 |
#undef setenv |
| 788 |
#undef setgid |
| 789 |
#undef setgroups |
| 790 |
#undef setpgid |
| 791 |
#undef setsid |
| 792 |
#undef setuid |
| 793 |
#undef sysconf |
| 794 |
#undef times |
| 795 |
#undef ttyname |
| 796 |
#undef uname |
| 797 |
|
| 798 |
#define getlogin MLton_getlogin |
| 799 |
#define ctermid MLton_ctermid |
| 800 |
#define getegid MLton_getegid |
| 801 |
#define geteuid MLton_geteuid |
| 802 |
#define getgid MLton_getgid |
| 803 |
#define getgroups MLton_getgroups |
| 804 |
#define getpgid MLton_getpgid |
| 805 |
#define getpgrp MLton_getpgrp |
| 806 |
#define getppid MLton_getppid |
| 807 |
#define getuid MLton_getuid |
| 808 |
#define setenv MLton_setenv |
| 809 |
#define setgid MLton_setgid |
| 810 |
#define setgroups MLton_setgroups |
| 811 |
#define setpgid MLton_setpgid |
| 812 |
#define setsid MLton_setsid |
| 813 |
#define setuid MLton_setuid |
| 814 |
#define sysconf MLton_sysconf |
| 815 |
#define times MLton_times |
| 816 |
#define ttyname MLton_ttyname |
| 817 |
#define uname MLton_uname |
| 818 |
|
| 819 |
|
| 820 |
|
| 821 |
|
| 822 |
|
| 823 |
|
| 824 |
#define SPAWN_MODE _P_NOWAIT |
| 825 |
|
| 826 |
|
| 827 |
|
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
#ifndef WNOHANG |
| 837 |
#define WNOHANG 1 |
| 838 |
#endif |
| 839 |
|
| 840 |
#ifndef WUNTRACED |
| 841 |
#define WUNTRACED 2 |
| 842 |
#endif |
| 843 |
|
| 844 |
#define SIGNALLED_BIT 0x80000000UL |
| 845 |
|
| 846 |
#ifndef WIFEXITED |
| 847 |
#define WIFEXITED(w) (((w) & SIGNALLED_BIT) == 0) |
| 848 |
#endif |
| 849 |
|
| 850 |
#ifndef WIFSIGNALED |
| 851 |
#define WIFSIGNALED(w) (((w) & SIGNALLED_BIT) != 0) |
| 852 |
#endif |
| 853 |
|
| 854 |
#ifndef WIFSTOPPED |
| 855 |
#define WIFSTOPPED(w) 0 |
| 856 |
#endif |
| 857 |
|
| 858 |
#ifndef WEXITSTATUS |
| 859 |
#define WEXITSTATUS(w) ((w) & 0xff) |
| 860 |
#endif |
| 861 |
|
| 862 |
#ifndef WTERMSIG |
| 863 |
#define WTERMSIG(w) ((w) & 0xff) |
| 864 |
#endif |
| 865 |
|
| 866 |
#ifndef WSTOPSIG |
| 867 |
#define WSTOPSIG WEXITSTATUS |
| 868 |
#endif |
| 869 |
|
| 870 |
|
| 871 |
#if !defined(TIMESPEC_DEFINED) && !defined(_TIMESPEC_DEFINED) |
| 872 |
struct timespec { |
| 873 |
time_t tv_sec; |
| 874 |
long tv_nsec; |
| 875 |
}; |
| 876 |
#endif |
| 877 |
|
| 878 |
MLTON_WRAPPER int MLton_alarm(int); |
| 879 |
MLTON_WRAPPER int MLton_fork(void); |
| 880 |
MLTON_WRAPPER int MLton_kill (pid_t pid, int sig); |
| 881 |
MLTON_WRAPPER int MLton_pause (void); |
| 882 |
MLTON_WRAPPER int MLton_nanosleep (const struct timespec *req, struct timespec *rem); |
| 883 |
MLTON_WRAPPER unsigned int MLton_sleep (unsigned int seconds); |
| 884 |
MLTON_WRAPPER pid_t MLton_wait (int *status); |
| 885 |
MLTON_WRAPPER pid_t MLton_waitpid (pid_t pid, int *status, int options); |
| 886 |
|
| 887 |
#undef alarm |
| 888 |
#undef fork |
| 889 |
#undef kill |
| 890 |
#undef pause |
| 891 |
#undef nanosleep |
| 892 |
#undef sleep |
| 893 |
#undef wait |
| 894 |
#undef waitpid |
| 895 |
|
| 896 |
#define alarm MLton_alarm |
| 897 |
#define fork MLton_fork |
| 898 |
#define kill MLton_kill |
| 899 |
#define pause MLton_pause |
| 900 |
#define nanosleep MLton_nanosleep |
| 901 |
#define sleep MLton_sleep |
| 902 |
#define wait MLton_wait |
| 903 |
#define waitpid MLton_waitpid |
| 904 |
|
| 905 |
|
| 906 |
|
| 907 |
|
| 908 |
|
| 909 |
|
| 910 |
|
| 911 |
#ifndef SIG_BLOCK |
| 912 |
#define SIG_BLOCK 1 |
| 913 |
#endif |
| 914 |
|
| 915 |
#ifndef SIG_SETMASK |
| 916 |
#define SIG_SETMASK 0 |
| 917 |
#endif |
| 918 |
|
| 919 |
#ifndef SIG_UNBLOCK |
| 920 |
#define SIG_UNBLOCK 2 |
| 921 |
#endif |
| 922 |
|
| 923 |
#ifndef SIGHUP |
| 924 |
#define SIGHUP 1 |
| 925 |
#endif |
| 926 |
|
| 927 |
|
| 928 |
|
| 929 |
#ifndef SIGQUIT |
| 930 |
#define SIGQUIT 3 |
| 931 |
#endif |
| 932 |
|
| 933 |
|
| 934 |
|
| 935 |
|
| 936 |
|
| 937 |
|
| 938 |
|
| 939 |
|
| 940 |
#ifndef SIGKILL |
| 941 |
#define SIGKILL 9 |
| 942 |
#endif |
| 943 |
|
| 944 |
#ifndef SIGBUS |
| 945 |
#define SIGBUS 10 |
| 946 |
#endif |
| 947 |
|
| 948 |
|
| 949 |
|
| 950 |
|
| 951 |
#ifndef SIGPIPE |
| 952 |
#define SIGPIPE 13 |
| 953 |
#endif |
| 954 |
|
| 955 |
#ifndef SIGALRM |
| 956 |
#define SIGALRM 14 |
| 957 |
#endif |
| 958 |
|
| 959 |
|
| 960 |
|
| 961 |
|
| 962 |
|
| 963 |
|
| 964 |
|
| 965 |
#ifndef SIGSTOP |
| 966 |
#define SIGSTOP 16 |
| 967 |
#endif |
| 968 |
|
| 969 |
#ifndef SIGTSTP |
| 970 |
#define SIGTSTP 18 |
| 971 |
#endif |
| 972 |
|
| 973 |
#ifndef SIGCHLD |
| 974 |
#define SIGCHLD 23 |
| 975 |
#endif |
| 976 |
|
| 977 |
#ifndef SIGTTIN |
| 978 |
#define SIGTTIN 24 |
| 979 |
#endif |
| 980 |
|
| 981 |
#ifndef SIGTTOU |
| 982 |
#define SIGTTOU 25 |
| 983 |
#endif |
| 984 |
|
| 985 |
#ifndef SIGCONT |
| 986 |
#define SIGCONT 26 |
| 987 |
#endif |
| 988 |
|
| 989 |
#ifndef SIGUSR1 |
| 990 |
#define SIGUSR1 27 |
| 991 |
#endif |
| 992 |
|
| 993 |
#ifndef SIGUSR2 |
| 994 |
#define SIGUSR2 28 |
| 995 |
#endif |
| 996 |
|
| 997 |
#ifndef SIGVTALRM |
| 998 |
#define SIGVTALRM 29 |
| 999 |
#endif |
| 1000 |
|
| 1001 |
#ifndef SIGPROF |
| 1002 |
#define SIGPROF 30 |
| 1003 |
#endif |
| 1004 |
|
| 1005 |
|
| 1006 |
#ifdef NSIG |
| 1007 |
#undef NSIG |
| 1008 |
#endif |
| 1009 |
#define NSIG 32 |
| 1010 |
|
| 1011 |
typedef __p_sig_fn_t MLton__sig_func_ptr; |
| 1012 |
typedef int MLton_sigset_t; |
| 1013 |
|
| 1014 |
#undef _sig_func_ptr |
| 1015 |
#undef sigset_t |
| 1016 |
|
| 1017 |
#define _sig_func_ptr MLton__sig_func_ptr |
| 1018 |
#define sigset_t MLton_sigset_t |
| 1019 |
|
| 1020 |
struct MLton_sigaction { |
| 1021 |
int sa_flags; |
| 1022 |
sigset_t sa_mask; |
| 1023 |
_sig_func_ptr sa_handler; |
| 1024 |
}; |
| 1025 |
|
| 1026 |
#undef sigaction |
| 1027 |
#define sigaction MLton_sigaction |
| 1028 |
|
| 1029 |
#ifndef SIGTOMASK |
| 1030 |
#define SIGTOMASK(sn) (1 << ((sn)-1)) |
| 1031 |
#endif |
| 1032 |
|
| 1033 |
MLTON_WRAPPER int MLton_sigaction (int signum, |
| 1034 |
const struct sigaction *act, |
| 1035 |
struct sigaction *oldact); |
| 1036 |
MLTON_WRAPPER int MLton_sigaddset (sigset_t *set, int signum); |
| 1037 |
MLTON_WRAPPER int MLton_sigdelset (sigset_t *set, int signum); |
| 1038 |
MLTON_WRAPPER int MLton_sigemptyset (sigset_t *set); |
| 1039 |
MLTON_WRAPPER int MLton_sigfillset (sigset_t *set); |
| 1040 |
MLTON_WRAPPER int MLton_sigismember (const sigset_t *set, int signum); |
| 1041 |
MLTON_WRAPPER int MLton_sigpending (sigset_t *set); |
| 1042 |
MLTON_WRAPPER int MLton_sigprocmask (int how, const sigset_t *set, sigset_t *oldset); |
| 1043 |
MLTON_WRAPPER int MLton_sigsuspend (const sigset_t *mask); |
| 1044 |
|
| 1045 |
#undef sigaction |
| 1046 |
#undef sigaddset |
| 1047 |
#undef sigdelset |
| 1048 |
#undef sigemptyset |
| 1049 |
#undef sigfillset |
| 1050 |
#undef sigismember |
| 1051 |
#undef sigpending |
| 1052 |
#undef sigprocmask |
| 1053 |
#undef sigsuspend |
| 1054 |
|
| 1055 |
#define sigaction MLton_sigaction |
| 1056 |
#define sigaddset MLton_sigaddset |
| 1057 |
#define sigdelset MLton_sigdelset |
| 1058 |
#define sigemptyset MLton_sigemptyset |
| 1059 |
#define sigfillset MLton_sigfillset |
| 1060 |
#define sigismember MLton_sigismember |
| 1061 |
#define sigpending MLton_sigpending |
| 1062 |
#define sigprocmask MLton_sigprocmask |
| 1063 |
#define sigsuspend MLton_sigsuspend |
| 1064 |
|
| 1065 |
|
| 1066 |
|
| 1067 |
|
| 1068 |
|
| 1069 |
struct MLton_group { |
| 1070 |
gid_t gr_gid; |
| 1071 |
char **gr_mem; |
| 1072 |
char *gr_name; |
| 1073 |
char *gr_passwd; |
| 1074 |
}; |
| 1075 |
|
| 1076 |
struct MLton_passwd { |
| 1077 |
char *pw_dir; |
| 1078 |
gid_t pw_gid; |
| 1079 |
char *pw_name; |
| 1080 |
char *pw_shell; |
| 1081 |
uid_t pw_uid; |
| 1082 |
}; |
| 1083 |
|
| 1084 |
#undef group |
| 1085 |
#undef passwd |
| 1086 |
#define group MLton_group |
| 1087 |
#define passwd MLton_passwd |
| 1088 |
|
| 1089 |
MLTON_WRAPPER struct group *MLton_getgrgid (gid_t gid); |
| 1090 |
MLTON_WRAPPER struct group *MLton_getgrnam (const char *name); |
| 1091 |
MLTON_WRAPPER struct passwd *MLton_getpwnam (const char *name); |
| 1092 |
MLTON_WRAPPER struct passwd *MLton_getpwuid (uid_t uid); |
| 1093 |
|
| 1094 |
#undef getgrgid |
| 1095 |
#undef getgrnam |
| 1096 |
#undef getpwnam |
| 1097 |
#undef getpwuid |
| 1098 |
|
| 1099 |
#define getgrgid MLton_getgrgid |
| 1100 |
#define getgrnam MLton_getgrnam |
| 1101 |
#define getpwnam MLton_getpwnam |
| 1102 |
#define getpwuid MLton_getpwuid |
| 1103 |
|
| 1104 |
|
| 1105 |
|
| 1106 |
|
| 1107 |
|
| 1108 |
#ifndef B0 |
| 1109 |
#define B0 0x00000 |
| 1110 |
#endif |
| 1111 |
|
| 1112 |
#ifndef B50 |
| 1113 |
#define B50 0x00001 |
| 1114 |
#endif |
| 1115 |
|
| 1116 |
#ifndef B75 |
| 1117 |
#define B75 0x00002 |
| 1118 |
#endif |
| 1119 |
|
| 1120 |
#ifndef B110 |
| 1121 |
#define B110 0x00003 |
| 1122 |
#endif |
| 1123 |
|
| 1124 |
#ifndef B134 |
| 1125 |
#define B134 0x00004 |
| 1126 |
#endif |
| 1127 |
|
| 1128 |
#ifndef B150 |
| 1129 |
#define B150 0x00005 |
| 1130 |
#endif |
| 1131 |
|
| 1132 |
#ifndef B200 |
| 1133 |
#define B200 0x00006 |
| 1134 |
#endif |
| 1135 |
|
| 1136 |
#ifndef B300 |
| 1137 |
#define B300 0x00007 |
| 1138 |
#endif |
| 1139 |
|
| 1140 |
#ifndef B600 |
| 1141 |
#define B600 0x00008 |
| 1142 |
#endif |
| 1143 |
|
| 1144 |
#ifndef B1200 |
| 1145 |
#define B1200 0x00009 |
| 1146 |
#endif |
| 1147 |
|
| 1148 |
#ifndef B1800 |
| 1149 |
#define B1800 0x0000a |
| 1150 |
#endif |
| 1151 |
|
| 1152 |
#ifndef B2400 |
| 1153 |
#define B2400 0x0000b |
| 1154 |
#endif |
| 1155 |
|
| 1156 |
#ifndef B4800 |
| 1157 |
#define B4800 0x0000c |
| 1158 |
#endif |
| 1159 |
|
| 1160 |
#ifndef B9600 |
| 1161 |
#define B9600 0x0000d |
| 1162 |
#endif |
| 1163 |
|
| 1164 |
#ifndef B19200 |
| 1165 |
#define B19200 0x0000e |
| 1166 |
#endif |
| 1167 |
|
| 1168 |
#ifndef B38400 |
| 1169 |
#define B38400 0x0000f |
| 1170 |
#endif |
| 1171 |
|
| 1172 |
#ifndef VEOL |
| 1173 |
#define VEOL 2 |
| 1174 |
#endif |
| 1175 |
|
| 1176 |
#ifndef VEOL2 |
| 1177 |
#define VEOL2 3 |
| 1178 |
#endif |
| 1179 |
|
| 1180 |
#ifndef VEOF |
| 1181 |
#define VEOF 4 |
| 1182 |
#endif |
| 1183 |
|
| 1184 |
#ifndef VERASE |
| 1185 |
#define VERASE 5 |
| 1186 |
#endif |
| 1187 |
|
| 1188 |
#ifndef VINTER |
| 1189 |
#define VINTR 6 |
| 1190 |
#endif |
| 1191 |
|
| 1192 |
#ifndef VKILL |
| 1193 |
#define VKILL 7 |
| 1194 |
#endif |
| 1195 |
|
| 1196 |
#ifndef VLNEXT |
| 1197 |
#define VLNEXT 8 |
| 1198 |
#endif |
| 1199 |
|
| 1200 |
#ifndef VMIN |
| 1201 |
#define VMIN 9 |
| 1202 |
#endif |
| 1203 |
|
| 1204 |
#ifndef VQUIT |
| 1205 |
#define VQUIT 10 |
| 1206 |
#endif |
| 1207 |
|
| 1208 |
#ifndef VREPRINT |
| 1209 |
#define VREPRINT 11 |
| 1210 |
#endif |
| 1211 |
|
| 1212 |
#ifndef VSTART |
| 1213 |
#define VSTART 12 |
| 1214 |
#endif |
| 1215 |
|
| 1216 |
#ifndef VSTOP |
| 1217 |
#define VSTOP 13 |
| 1218 |
#endif |
| 1219 |
|
| 1220 |
#ifndef VSUSP |
| 1221 |
#define VSUSP 14 |
| 1222 |
#endif |
| 1223 |
|
| 1224 |
#ifndef VSWTC |
| 1225 |
#define VSWTC 15 |
| 1226 |
#endif |
| 1227 |
|
| 1228 |
#ifndef VTIME |
| 1229 |
#define VTIME 16 |
| 1230 |
#endif |
| 1231 |
|
| 1232 |
#ifndef VWERASE |
| 1233 |
#define VWERASE 17 |
| 1234 |
#endif |
| 1235 |
|
| 1236 |
#ifndef NCCS |
| 1237 |
#define NCCS 18 |
| 1238 |
#endif |
| 1239 |
|
| 1240 |
#ifndef IGNBRK |
| 1241 |
#define IGNBRK 0x00001 |
| 1242 |
#endif |
| 1243 |
|
| 1244 |
#ifndef BRKINT |
| 1245 |
#define BRKINT 0x00002 |
| 1246 |
#endif |
| 1247 |
|
| 1248 |
#ifndef IGNPAR |
| 1249 |
#define IGNPAR 0x00004 |
| 1250 |
#endif |
| 1251 |
|
| 1252 |
#ifndef IMAXBEL |
| 1253 |
#define IMAXBEL 0x00008 |
| 1254 |
#endif |
| 1255 |
|
| 1256 |
#ifndef INPCK |
| 1257 |
#define INPCK 0x00010 |
| 1258 |
#endif |
| 1259 |
|
| 1260 |
#ifndef ISTRIP |
| 1261 |
#define ISTRIP 0x00020 |
| 1262 |
#endif |
| 1263 |
|
| 1264 |
#ifndef INLCR |
| 1265 |
#define INLCR 0x00040 |
| 1266 |
#endif |
| 1267 |
|
| 1268 |
#ifndef IGNCR |
| 1269 |
#define IGNCR 0x00080 |
| 1270 |
#endif |
| 1271 |
|
| 1272 |
#ifndef ICRNL |
| 1273 |
#define ICRNL 0x00100 |
| 1274 |
#endif |
| 1275 |
|
| 1276 |
#ifndef IXON |
| 1277 |
#define IXON 0x00400 |
| 1278 |
#endif |
| 1279 |
|
| 1280 |
#ifndef IXOFF |
| 1281 |
#define IXOFF 0x01000 |
| 1282 |
#endif |
| 1283 |
|
| 1284 |
#ifndef IUCLC |
| 1285 |
#define IUCLC 0x04000 |
| 1286 |
#endif |
| 1287 |
|
| 1288 |
#ifndef IXANY |
| 1289 |
#define IXANY 0x08000 |
| 1290 |
#endif |
| 1291 |
|
| 1292 |
#ifndef PARMRK |
| 1293 |
#define PARMRK 0x10000 |
| 1294 |
#endif |
| 1295 |
|
| 1296 |
#ifndef OPOST |
| 1297 |
#define OPOST 0x00001 |
| 1298 |
#endif |
| 1299 |
|
| 1300 |
#ifndef CSIZE |
| 1301 |
#define CSIZE 0x00030 |
| 1302 |
#endif |
| 1303 |
|
| 1304 |
#ifndef CS5 |
| 1305 |
#define CS5 0x00000 |
| 1306 |
#endif |
| 1307 |
|
| 1308 |
#ifndef CS6 |
| 1309 |
#define CS6 0x00010 |
| 1310 |
#endif |
| 1311 |
|
| 1312 |
#ifndef CS7 |
| 1313 |
#define CS7 0x00020 |
| 1314 |
#endif |
| 1315 |
|
| 1316 |
#ifndef CS8 |
| 1317 |
#define CS8 0x00030 |
| 1318 |
#endif |
| 1319 |
|
| 1320 |
#ifndef CSTOPB |
| 1321 |
#define CSTOPB 0x00040 |
| 1322 |
#endif |
| 1323 |
|
| 1324 |
#ifndef CREAD |
| 1325 |
#define CREAD 0x00080 |
| 1326 |
#endif |
| 1327 |
|
| 1328 |
#ifndef PARENB |
| 1329 |
#define PARENB 0x00100 |
| 1330 |
#endif |
| 1331 |
|
| 1332 |
#ifndef PARODD |
| 1333 |
#define PARODD 0x00200 |
| 1334 |
#endif |
| 1335 |
|
| 1336 |
#ifndef HPUCL |
| 1337 |
#define HUPCL 0x00400 |
| 1338 |
#endif |
| 1339 |
|
| 1340 |
#ifndef CLOCAL |
| 1341 |
#define CLOCAL 0x00800 |
| 1342 |
#endif |
| 1343 |
|
| 1344 |
#ifndef CBAUDEX |
| 1345 |
#define CBAUDEX 0x0100f |
| 1346 |
#endif |
| 1347 |
|
| 1348 |
#ifndef B57600 |
| 1349 |
#define B57600 0x01001 |
| 1350 |
#endif |
| 1351 |
|
| 1352 |
#ifndef B115200 |
| 1353 |
#define B115200 0x01002 |
| 1354 |
#endif |
| 1355 |
|
| 1356 |
#ifndef B128000 |
| 1357 |
#define B128000 0x01003 |
| 1358 |
#endif |
| 1359 |
|
| 1360 |
#ifndef B230400 |
| 1361 |
#define B230400 0x01004 |
| 1362 |
#endif |
| 1363 |
|
| 1364 |
#ifndef B256000 |
| 1365 |
#define B256000 0x01005 |
| 1366 |
#endif |
| 1367 |
|
| 1368 |
#ifndef CRTSXOFF |
| 1369 |
#define CRTSXOFF 0x04000 |
| 1370 |
#endif |
| 1371 |
|
| 1372 |
#ifndef CRTSCTS |
| 1373 |
#define CRTSCTS 0x08000 |
| 1374 |
#endif |
| 1375 |
|
| 1376 |
#ifndef ISIG |
| 1377 |
#define ISIG 0x0001 |
| 1378 |
#endif |
| 1379 |
|
| 1380 |
#ifndef ICANON |
| 1381 |
#define ICANON 0x0002 |
| 1382 |
#endif |
| 1383 |
|
| 1384 |
#ifndef ECHO |
| 1385 |
#define ECHO 0x0004 |
| 1386 |
#endif |
| 1387 |
|
| 1388 |
#ifndef ECHOE |
| 1389 |
#define ECHOE 0x0008 |
| 1390 |
#endif |
| 1391 |
|
| 1392 |
#ifndef ECHOK |
| 1393 |
#define ECHOK 0x0010 |
| 1394 |
#endif |
| 1395 |
|
| 1396 |
#ifndef ECHONL |
| 1397 |
#define ECHONL 0x0020 |
| 1398 |
#endif |
| 1399 |
|
| 1400 |
#ifndef NOFLSH |
| 1401 |
#define NOFLSH 0x0040 |
| 1402 |
#endif |
| 1403 |
|
| 1404 |
#ifndef TOSTOP |
| 1405 |
#define TOSTOP 0x0080 |
| 1406 |
#endif |
| 1407 |
|
| 1408 |
#ifndef IEXTEN |
| 1409 |
#define IEXTEN 0x0100 |
| 1410 |
#endif |
| 1411 |
|
| 1412 |
#ifndef FLUSHO |
| 1413 |
#define FLUSHO 0x0200 |
| 1414 |
#endif |
| 1415 |
|
| 1416 |
#ifndef ECHOKE |
| 1417 |
#define ECHOKE 0x0400 |
| 1418 |
#endif |
| 1419 |
|
| 1420 |
#ifndef ECHOCTL |
| 1421 |
#define ECHOCTL 0x0800 |
| 1422 |
#endif |
| 1423 |
|
| 1424 |
#ifndef TCOOFF |
| 1425 |
#define TCOOFF 0 |
| 1426 |
#endif |
| 1427 |
|
| 1428 |
#ifndef TCOON |
| 1429 |
#define TCOON 1 |
| 1430 |
#endif |
| 1431 |
|
| 1432 |
#ifndef TCIOFF |
| 1433 |
#define TCIOFF 2 |
| 1434 |
#endif |
| 1435 |
|
| 1436 |
#ifndef TCION |
| 1437 |
#define TCION 3 |
| 1438 |
#endif |
| 1439 |
|
| 1440 |
#ifndef TCIFLUSH |
| 1441 |
#define TCIFLUSH 0 |
| 1442 |
#endif |
| 1443 |
|
| 1444 |
#ifndef TCOFLUSH |
| 1445 |
#define TCOFLUSH 1 |
| 1446 |
#endif |
| 1447 |
|
| 1448 |
#ifndef TCIOFLUSH |
| 1449 |
#define TCIOFLUSH 2 |
| 1450 |
#endif |
| 1451 |
|
| 1452 |
#ifndef TCFLSH |
| 1453 |
#define TCFLSH 3 |
| 1454 |
#endif |
| 1455 |
|
| 1456 |
#ifndef TCSAFLUSH |
| 1457 |
#define TCSAFLUSH 1 |
| 1458 |
#endif |
| 1459 |
|
| 1460 |
#ifndef TCSANOW |
| 1461 |
#define TCSANOW 2 |
| 1462 |
#endif |
| 1463 |
|
| 1464 |
#ifndef TCSADRAIN |
| 1465 |
#define TCSADRAIN 3 |
| 1466 |
#endif |
| 1467 |
|
| 1468 |
#ifndef TCSADFLUSH |
| 1469 |
#define TCSADFLUSH 4 |
| 1470 |
#endif |
| 1471 |
|
| 1472 |
typedef unsigned char MLton_cc_t; |
| 1473 |
typedef unsigned int MLton_speed_t; |
| 1474 |
typedef unsigned int MLton_tcflag_t; |
| 1475 |
|
| 1476 |
#undef cc_t |
| 1477 |
#undef speed_t |
| 1478 |
#undef tcflag_t |
| 1479 |
|
| 1480 |
#define cc_t MLton_cc_t |
| 1481 |
#define speed_t MLton_speed_t |
| 1482 |
#define tcflag_t MLton_tcflag_t |
| 1483 |
|
| 1484 |
struct MLton_termios { |
| 1485 |
cc_t c_cc[NCCS]; |
| 1486 |
tcflag_t c_cflag; |
| 1487 |
tcflag_t c_iflag; |
| 1488 |
tcflag_t c_lflag; |
| 1489 |
tcflag_t c_oflag; |
| 1490 |
}; |
| 1491 |
#undef termios |
| 1492 |
#define termios MLton_termios |
| 1493 |
|
| 1494 |
MLTON_WRAPPER speed_t MLton_cfgetispeed (struct termios *termios_p); |
| 1495 |
MLTON_WRAPPER speed_t MLton_cfgetospeed (struct termios *termios_p); |
| 1496 |
MLTON_WRAPPER int MLton_cfsetispeed (struct termios *termios_p, speed_t speed); |
| 1497 |
MLTON_WRAPPER int MLton_cfsetospeed (struct termios *termios_p, speed_t speed); |
| 1498 |
MLTON_WRAPPER int MLton_tcdrain (int fd); |
| 1499 |
MLTON_WRAPPER int MLton_tcflow (int fd, int action); |
| 1500 |
MLTON_WRAPPER int MLton_tcflush (int fd, int queue_selector); |
| 1501 |
MLTON_WRAPPER int MLton_tcgetattr (int fd, struct termios *termios_p); |
| 1502 |
MLTON_WRAPPER pid_t MLton_tcgetpgrp (int fd); |
| 1503 |
MLTON_WRAPPER int MLton_tcsendbreak (int fd, int duration); |
| 1504 |
MLTON_WRAPPER int MLton_tcsetattr (int fd, int optional_actions, struct termios *termios_p); |
| 1505 |
MLTON_WRAPPER int MLton_tcsetpgrp (int fd, pid_t pgrpid); |
| 1506 |
|
| 1507 |
#undef cfgetispeed |
| 1508 |
#undef cfgetospeed |
| 1509 |
#undef cfsetispeed |
| 1510 |
#undef cfsetospeed |
| 1511 |
#undef tcdrain |
| 1512 |
#undef tcflow |
| 1513 |
#undef tcflush |
| 1514 |
#undef tcgetattr |
| 1515 |
#undef tcgetpgrp |
| 1516 |
#undef tcsendbreak |
| 1517 |
#undef tcsetattr |
| 1518 |
#undef tcsetpgrp |
| 1519 |
|
| 1520 |
#define cfgetispeed MLton_cfgetispeed |
| 1521 |
#define cfgetospeed MLton_cfgetospeed |
| 1522 |
#define cfsetispeed MLton_cfsetispeed |
| 1523 |
#define cfsetospeed MLton_cfsetospeed |
| 1524 |
#define tcdrain MLton_tcdrain |
| 1525 |
#define tcflow MLton_tcflow |
| 1526 |
#define tcflush MLton_tcflush |
| 1527 |
#define tcgetattr MLton_tcgetattr |
| 1528 |
#define tcgetpgrp MLton_tcgetpgrp |
| 1529 |
#define tcsendbreak MLton_tcsendbreak |
| 1530 |
#define tcsetattr MLton_tcsetattr |
| 1531 |
#define tcsetpgrp MLton_tcsetpgrp |
| 1532 |
|
| 1533 |
|
| 1534 |
|
| 1535 |
|
| 1536 |
|
| 1537 |
|
| 1538 |
#ifndef MSG_WAITALL |
| 1539 |
#define MSG_WAITALL 0x8 |
| 1540 |
#endif |
| 1541 |
|
| 1542 |
#ifndef MSG_DONTWAIT |
| 1543 |
#define MSG_DONTWAIT 0x1000000 |
| 1544 |
#endif |
| 1545 |
|
| 1546 |
#ifndef MSG_EOR |
| 1547 |
#define MSG_EOR 0 |
| 1548 |
#endif |
| 1549 |
|
| 1550 |
#ifndef MSG_CTRUNC |
| 1551 |
#define MSG_CTRUNC 0 |
| 1552 |
#endif |
| 1553 |
|
| 1554 |
#ifndef MSG_TRUNC |
| 1555 |
#define MSG_TRUNC MSG_PARTIAL |
| 1556 |
#endif |
| 1557 |
|
| 1558 |
#ifndef UNIX_PATH_MAX |
| 1559 |
#define UNIX_PATH_MAX 108 |
| 1560 |
#endif |
| 1561 |
|
| 1562 |
typedef unsigned short MLton_sa_family_t; |
| 1563 |
#undef sa_family_t |
| 1564 |
#define sa_family_t MLton_sa_family_t |
| 1565 |
|
| 1566 |
struct MLton_sockaddr_un { |
| 1567 |
sa_family_t sun_family; |
| 1568 |
char sun_path[UNIX_PATH_MAX]; |
| 1569 |
}; |
| 1570 |
#undef sockaddr_un |
| 1571 |
#define sockaddr_un MLton_sockaddr_un |
| 1572 |
|
| 1573 |
MLTON_WRAPPER int MLton_ioctl (int d, int request, ...); |
| 1574 |
MLTON_WRAPPER int MLton_socketpair (int d, int type, int protocol, int sv[2]); |
| 1575 |
|
| 1576 |
#undef ioctl |
| 1577 |
#undef socketpair |
| 1578 |
|
| 1579 |
#define ioctl MLton_ioctl |
| 1580 |
#define socketpair MLton_socketpair |
| 1581 |
|
| 1582 |
|
| 1583 |
|
| 1584 |
|
| 1585 |
|
| 1586 |
#ifndef LOG_EMERG |
| 1587 |
#define LOG_EMERG 7 |
| 1588 |
#endif |
| 1589 |
|
| 1590 |
#ifndef LOG_ALERT |
| 1591 |
#define LOG_ALERT 6 |
| 1592 |
#endif |
| 1593 |
|
| 1594 |
#ifndef LOG_CRIT |
| 1595 |
#define LOG_CRIT 5 |
| 1596 |
#endif |
| 1597 |
|
| 1598 |
#ifndef LOG_ERR |
| 1599 |
#define LOG_ERR 4 |
| 1600 |
#endif |
| 1601 |
|
| 1602 |
#ifndef LOG_WARNING |
| 1603 |
#define LOG_WARNING 3 |
| 1604 |
#endif |
| 1605 |
|
| 1606 |
#ifndef LOG_NOTICE |
| 1607 |
#define LOG_NOTICE 2 |
| 1608 |
#endif |
| 1609 |
|
| 1610 |
#ifndef LOG_INFO |
| 1611 |
#define LOG_INFO 1 |
| 1612 |
#endif |
| 1613 |
|
| 1614 |
#ifndef LOG_DEBUG |
| 1615 |
#define LOG_DEBUG 0 |
| 1616 |
#endif |
| 1617 |
|
| 1618 |
#ifndef LOG_PID |
| 1619 |
#define LOG_PID 0x01 |
| 1620 |
#endif |
| 1621 |
|
| 1622 |
#ifndef LOG_CONS |
| 1623 |
#define LOG_CONS 0x02 |
| 1624 |
#endif |
| 1625 |
|
| 1626 |
#ifndef LOG_ODELAY |
| 1627 |
#define LOG_ODELAY 0x04 |
| 1628 |
#endif |
| 1629 |
|
| 1630 |
#ifndef LOG_NDELAY |
| 1631 |
#define LOG_NDELAY 0x08 |
| 1632 |
#endif |
| 1633 |
|
| 1634 |
#ifndef LOG_NOWAIT |
| 1635 |
#define LOG_NOWAIT 0x10 |
| 1636 |
#endif |
| 1637 |
|
| 1638 |
#ifndef LOG_PERROR |
| 1639 |
#define LOG_PERROR 0x20 |
| 1640 |
#endif |
| 1641 |
|
| 1642 |
#ifndef LOG_AUTH |
| 1643 |
#define LOG_AUTH 1 |
| 1644 |
#endif |
| 1645 |
|
| 1646 |
#ifndef LOG_CRON |
| 1647 |
#define LOG_CRON 2 |
| 1648 |
#endif |
| 1649 |
|
| 1650 |
#ifndef LOG_DAEMON |
| 1651 |
#define LOG_DAEMON 3 |
| 1652 |
#endif |
| 1653 |
|
| 1654 |
#ifndef LOG_KERN |
| 1655 |
#define LOG_KERN 4 |
| 1656 |
#endif |
| 1657 |
|
| 1658 |
#ifndef LOG_LOCAL0 |
| 1659 |
#define LOG_LOCAL0 5 |
| 1660 |
#endif |
| 1661 |
|
| 1662 |
#ifndef LOG_LOCAL1 |
| 1663 |
#define LOG_LOCAL1 6 |
| 1664 |
#endif |
| 1665 |
|
| 1666 |
#ifndef LOG_LOCAL2 |
| 1667 |
#define LOG_LOCAL2 7 |
| 1668 |
#endif |
| 1669 |
|
| 1670 |
#ifndef LOG_LOCAL3 |
| 1671 |
#define LOG_LOCAL3 8 |
| 1672 |
#endif |
| 1673 |
|
| 1674 |
#ifndef LOG_LOCAL4 |
| 1675 |
#define LOG_LOCAL4 9 |
| 1676 |
#endif |
| 1677 |
|
| 1678 |
#ifndef LOG_LOCAL5 |
| 1679 |
#define LOG_LOCAL5 10 |
| 1680 |
#endif |
| 1681 |
|
| 1682 |
#ifndef LOG_LOCAL6 |
| 1683 |
#define LOG_LOCAL6 11 |
| 1684 |
#endif |
| 1685 |
|
| 1686 |
#ifndef LOG_LOCAL7 |
| 1687 |
#define LOG_LOCAL7 12 |
| 1688 |
#endif |
| 1689 |
|
| 1690 |
#ifndef LOG_LPR |
| 1691 |
#define LOG_LPR 13 |
| 1692 |
#endif |
| 1693 |
|
| 1694 |
#ifndef LOG_MAIL |
| 1695 |
#define LOG_MAIL 14 |
| 1696 |
#endif |
| 1697 |
|
| 1698 |
#ifndef LOG_NEWS |
| 1699 |
#define LOG_NEWS 15 |
| 1700 |
#endif |
| 1701 |
|
| 1702 |
#ifndef LOG_SYSLOG |
| 1703 |
#define LOG_SYSLOG 16 |
| 1704 |
#endif |
| 1705 |
|
| 1706 |
#ifndef LOG_USER |
| 1707 |
#define LOG_USER 17 |
| 1708 |
#endif |
| 1709 |
|
| 1710 |
#ifndef LOG_UUCP |
| 1711 |
#define LOG_UUCP 18 |
| 1712 |
#endif |
| 1713 |
|
| 1714 |
MLTON_WRAPPER void MLton_openlog(const char* ident, int logopt, int facility); |
| 1715 |
MLTON_WRAPPER void MLton_closelog(void); |
| 1716 |
MLTON_WRAPPER void MLton_syslog(int priority, const char* fmt, const char* msg); |
| 1717 |
|
| 1718 |
#undef openlog |
| 1719 |
#undef closelog |
| 1720 |
#undef syslog |
| 1721 |
|
| 1722 |
#define openlog MLton_openlog |
| 1723 |
#define closelog MLton_closelog |
| 1724 |
#define syslog MLton_syslog |