4 #if defined(__cplusplus) 32 #if defined(__cplusplus) && defined(_MSC_VER) 35 #if !defined(_WIN64) && !defined(WIN32) 38 #if defined(_MSC_VER) && _MSC_VER <= 1200 43 #if !defined(_MSC_VER) || _MSC_VER >= 1400 46 #if defined(__cplusplus) && defined(_MSC_VER) 66 #if defined(__cplusplus) && defined(_MSC_VER) && _MSC_VER == 1200 70 #if defined(__cplusplus) && defined(_MSC_VER) && _MSC_VER == 1200 75 #include <sys/types.h> 76 #ifdef HAVE_SYS_UTIME_H 77 # include <sys/utime.h> 83 #if defined __MINGW32__ 86 # if !defined(_INTPTR_T_DEFINED) 92 # define _INTPTR_T_DEFINED 94 # if !defined(INTPTR_MAX) 96 # define INTPTR_MAX 9223372036854775807I64 98 # define INTPTR_MAX 2147483647 100 # define INTPTR_MIN (-INTPTR_MAX-1) 102 # if !defined(_UINTPTR_T_DEFINED) 108 # define _UINTPTR_T_DEFINED 110 # if !defined(UINTPTR_MAX) 112 # define UINTPTR_MAX 18446744073709551615UI64 114 # define UINTPTR_MAX 4294967295U 125 #define rb_w32_iswinnt() TRUE 126 #define rb_w32_iswin95() FALSE 130 #define O_SHARE_DELETE 0x20000000 133 #define CLOCK_REALTIME 0 134 #define CLOCK_MONOTONIC 1 141 #define utime(_p, _t) rb_w32_utime(_p, _t) 142 #define lseek(_f, _o, _w) _lseeki64(_f, _o, _w) 144 #define pipe(p) rb_w32_pipe(p) 145 #define open rb_w32_open 146 #define close(h) rb_w32_close(h) 147 #define fclose(f) rb_w32_fclose(f) 148 #define read(f, b, s) rb_w32_read(f, b, s) 149 #define write(f, b, s) rb_w32_write(f, b, s) 150 #define getpid() rb_w32_getpid() 151 #define getppid() rb_w32_getppid() 152 #define sleep(x) rb_w32_Sleep((x)*1000) 153 #define Sleep(msec) (void)rb_w32_Sleep(msec) 154 #define fstati64(fd,st) rb_w32_fstati64(fd,st) 157 #define execv(path,argv) rb_w32_aspawn(P_OVERLAY,path,argv) 159 #define isatty(h) rb_w32_isatty(h) 162 #define mkdir(p, m) rb_w32_mkdir(p, m) 164 #define rmdir(p) rb_w32_rmdir(p) 166 #define unlink(p) rb_w32_unlink(p) 169 #if SIZEOF_OFF_T == 8 170 #define off_t __int64 172 #define fstat(fd,st) fstati64(fd,st) 173 #if !defined(_MSC_VER) || RUBY_MSVCRT_VERSION < 80 174 #define stati64 _stati64 176 #define _stati64(path, st) rb_w32_stati64(path, st) 179 #define stati64 _stat64 180 #define _stat64(path, st) rb_w32_stati64(path, st) 183 #define stat(path,st) rb_w32_stat(path,st) 184 #define fstat(fd,st) rb_w32_fstat(fd,st) 188 #define lstat(path,st) rb_w32_lstati64(path,st) 189 #define access(path,mode) rb_w32_access(path,mode) 191 #define strcasecmp _stricmp 192 #define strncasecmp _strnicmp 193 #define fsync _commit 199 #define isascii __isascii 228 #define IFNAMSIZ IF_NAMESIZE 232 #ifdef IFF_POINTTOPOINT 233 #define IFF_POINTOPOINT IFF_POINTTOPOINT 238 extern rb_pid_t
rb_w32_pipe_exec(
const char *,
const char *,
int,
int *,
int *);
239 extern int flock(
int fd,
int oper);
242 extern int WSAAPI
rb_w32_accept(
int,
struct sockaddr *,
int *);
243 extern int WSAAPI
rb_w32_bind(
int,
const struct sockaddr *,
int);
244 extern int WSAAPI
rb_w32_connect(
int,
const struct sockaddr *,
int);
254 extern int WSAAPI
rb_w32_recv(
int,
char *,
int,
int);
255 extern int WSAAPI
rb_w32_recvfrom(
int,
char *,
int,
int,
struct sockaddr *,
int *);
256 extern int WSAAPI
rb_w32_send(
int,
const char *,
int,
int);
257 extern int WSAAPI
rb_w32_sendto(
int,
const char *,
int,
int,
const struct sockaddr *,
int);
286 extern int chown(
const char *,
int,
int);
288 extern int link(
const char *,
const char *);
290 extern ssize_t
readlink(
const char *,
char *,
size_t);
293 extern int symlink(
const char *src,
const char *
link);
298 extern rb_pid_t
waitpid (rb_pid_t,
int *,
int);
299 extern rb_pid_t
rb_w32_spawn(
int,
const char *,
const char*);
300 extern rb_pid_t
rb_w32_aspawn(
int,
const char *,
char *
const *);
302 extern rb_pid_t
rb_w32_uspawn(
int,
const char *,
const char*);
305 extern int kill(
int,
int);
306 extern int fcntl(
int,
int, ...);
331 #if defined _MSC_VER && _MSC_VER >= 1800 && defined INFINITY 332 #pragma warning(push) 333 #pragma warning(disable:4756) 335 rb_infinity_float(
void)
341 #define INFINITY rb_infinity_float() 344 #if !defined __MINGW32__ || defined __NO_ISOCEXT 346 #define isnan(x) _isnan(x) 354 #define copysign(a, b) _copysign(a, b) 357 scalb(
double a,
long b)
362 __declspec(dllimport)
extern int finite(
double);
365 #if !defined S_IFIFO && defined _S_IFIFO 366 #define S_IFIFO _S_IFIFO 369 #if !defined S_IRUSR && !defined __MINGW32__ 379 #if !defined S_IWUSR && !defined __MINGW32__ 389 #if !defined S_IXUSR && !defined __MINGW32__ 399 #define S_IFLNK 0xa000 411 #undef HAVE_FTRUNCATE 412 #define HAVE_FTRUNCATE 1 413 #if defined HAVE_FTRUNCATE64 414 #define ftruncate ftruncate64 416 #define ftruncate rb_w32_ftruncate 420 #define HAVE_TRUNCATE 1 421 #if defined HAVE_TRUNCATE64 422 #define truncate truncate64 424 #define truncate rb_w32_truncate 427 #if defined(_MSC_VER) && _MSC_VER >= 1400 && _MSC_VER < 1800 428 #define strtoll _strtoi64 429 #define strtoull _strtoui64 435 extern int ioctl (
int,
int, ...);
436 extern rb_uid_t
getuid (
void);
437 extern rb_uid_t
geteuid (
void);
438 extern rb_gid_t
getgid (
void);
439 extern rb_gid_t
getegid (
void);
440 extern int setuid (rb_uid_t);
441 extern int setgid (rb_gid_t);
443 extern int fstati64(
int,
struct stati64 *);
448 #define strerror(e) rb_w32_strerror(e) 451 #define PIPE_BUF 1024 474 # define EWOULDBLOCK WSAEWOULDBLOCK 477 # define EINPROGRESS WSAEINPROGRESS 480 # define EALREADY WSAEALREADY 483 # define ENOTSOCK WSAENOTSOCK 486 # define EDESTADDRREQ WSAEDESTADDRREQ 489 # define EMSGSIZE WSAEMSGSIZE 492 # define EPROTOTYPE WSAEPROTOTYPE 495 # define ENOPROTOOPT WSAENOPROTOOPT 497 #ifndef EPROTONOSUPPORT 498 # define EPROTONOSUPPORT WSAEPROTONOSUPPORT 500 #ifndef ESOCKTNOSUPPORT 501 # define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT 504 # define EOPNOTSUPP WSAEOPNOTSUPP 507 # define EPFNOSUPPORT WSAEPFNOSUPPORT 510 # define EAFNOSUPPORT WSAEAFNOSUPPORT 513 # define EADDRINUSE WSAEADDRINUSE 515 #ifndef EADDRNOTAVAIL 516 # define EADDRNOTAVAIL WSAEADDRNOTAVAIL 519 # define ENETDOWN WSAENETDOWN 522 # define ENETUNREACH WSAENETUNREACH 525 # define ENETRESET WSAENETRESET 528 # define ECONNABORTED WSAECONNABORTED 531 # define ECONNRESET WSAECONNRESET 534 # define ENOBUFS WSAENOBUFS 537 # define EISCONN WSAEISCONN 540 # define ENOTCONN WSAENOTCONN 543 # define ESHUTDOWN WSAESHUTDOWN 546 # define ETOOMANYREFS WSAETOOMANYREFS 549 # define ETIMEDOUT WSAETIMEDOUT 552 # define ECONNREFUSED WSAECONNREFUSED 555 # define ELOOP WSAELOOP 559 # define EHOSTDOWN WSAEHOSTDOWN 562 # define EHOSTUNREACH WSAEHOSTUNREACH 566 # define EPROCLIM WSAEPROCLIM 569 # define EUSERS WSAEUSERS 572 # define EDQUOT WSAEDQUOT 575 # define ESTALE WSAESTALE 578 # define EREMOTE WSAEREMOTE 588 #define F_DUPFD_CLOEXEC 67 593 #define FD_SET(fd, set) do {\ 595 SOCKET s = _get_osfhandle(fd);\ 597 for (i = 0; i < (set)->fd_count; i++) {\ 598 if ((set)->fd_array[i] == s) {\ 602 if (i == (set)->fd_count) {\ 603 if ((set)->fd_count < FD_SETSIZE) {\ 604 (set)->fd_array[i] = s;\ 611 #define FD_CLR(f, s) rb_w32_fdclr(f, s) 614 #define FD_ISSET(f, s) rb_w32_fdisset(f, s) 618 #define inet_ntop(f,a,n,l) rb_w32_inet_ntop(f,a,n,l) 621 #define inet_pton(f,s,d) rb_w32_inet_pton(f,s,d) 624 #define accept(s, a, l) rb_w32_accept(s, a, l) 627 #define bind(s, a, l) rb_w32_bind(s, a, l) 630 #define connect(s, a, l) rb_w32_connect(s, a, l) 633 #define select(n, r, w, e, t) rb_w32_select(n, r, w, e, t) 636 #define getpeername(s, a, l) rb_w32_getpeername(s, a, l) 639 #define getsockname(s, a, l) rb_w32_getsockname(s, a, l) 642 #define getsockopt(s, v, n, o, l) rb_w32_getsockopt(s, v, n, o, l) 645 #define ioctlsocket(s, c, a) rb_w32_ioctlsocket(s, c, a) 648 #define listen(s, b) rb_w32_listen(s, b) 651 #define recv(s, b, l, f) rb_w32_recv(s, b, l, f) 654 #define recvfrom(s, b, l, f, fr, frl) rb_w32_recvfrom(s, b, l, f, fr, frl) 657 #define send(s, b, l, f) rb_w32_send(s, b, l, f) 660 #define sendto(s, b, l, f, t, tl) rb_w32_sendto(s, b, l, f, t, tl) 663 #define setsockopt(s, v, n, o, l) rb_w32_setsockopt(s, v, n, o, l) 666 #define shutdown(s, h) rb_w32_shutdown(s, h) 669 #define socket(s, t, p) rb_w32_socket(s, t, p) 672 #define gethostbyaddr(a, l, t) rb_w32_gethostbyaddr(a, l, t) 675 #define gethostbyname(n) rb_w32_gethostbyname(n) 678 #define gethostname(n, l) rb_w32_gethostname(n, l) 680 #undef getprotobyname 681 #define getprotobyname(n) rb_w32_getprotobyname(n) 683 #undef getprotobynumber 684 #define getprotobynumber(n) rb_w32_getprotobynumber(n) 687 #define getservbyname(n, p) rb_w32_getservbyname(n, p) 690 #define getservbyport(p, pr) rb_w32_getservbyport(p, pr) 693 #define get_osfhandle(h) rb_w32_get_osfhandle(h) 696 #define getcwd(b, s) rb_w32_getcwd(b, s) 699 #define getenv(n) rb_w32_getenv(n) 702 #define rename(o, n) rb_w32_rename(o, n) 705 #define times(t) rb_w32_times(t) 708 #define dup2(o, n) rb_w32_dup2(o, n) 720 struct tm *
gmtime_r(
const time_t *,
struct tm *);
721 struct tm *
localtime_r(
const time_t *,
struct tm *);
756 #if (defined(__MINGW64_VERSION_MAJOR) || defined(__MINGW64__)) && !defined(__cplusplus) 757 #ifdef RUBY_MINGW64_BROKEN_FREXP_MODF 760 #define frexp(_X, _Y) __extension__ ({\ 761 int intpart_frexp_bug = intpart_frexp_bug;\ 762 double result_frexp_bug = frexp((_X), &intpart_frexp_bug);\ 763 *(_Y) = intpart_frexp_bug;\ 767 #define modf(_X, _Y) __extension__ ({\ 768 double intpart_modf_bug = intpart_modf_bug;\ 769 double result_modf_bug = modf((_X), &intpart_modf_bug);\ 770 *(_Y) = intpart_modf_bug;\ 775 #if defined(__MINGW64__) 782 rb_w32_pow(
double x,
double y)
784 return (
double)powl(x, y);
786 #elif defined(__MINGW64_VERSION_MAJOR) 787 double rb_w32_pow(
double x,
double y);
789 #define pow rb_w32_pow 792 #if defined(__cplusplus) int rb_w32_lstati64(const char *, struct stati64 *)
char * rb_w32_wstr_to_mbstr(UINT, const WCHAR *, int, long *)
char * rb_w32_ugetenv(const char *)
int gettimeofday(struct timeval *, struct timezone *)
int rb_w32_wait_events_blocking(HANDLE *events, int num, DWORD timeout)
rb_pid_t rb_w32_getppid(void)
ssize_t rb_w32_write(int, const void *, size_t)
int rb_w32_fstat(int, struct stat *)
int rb_w32_set_nonblock(int)
int sendmsg(int, const struct msghdr *, int)
int WSAAPI rb_w32_connect(int, const struct sockaddr *, int)
int WSAAPI rb_w32_bind(int, const struct sockaddr *, int)
int WSAAPI rb_w32_sendto(int, const char *, int, int, const struct sockaddr *, int)
struct sockaddr * ifa_broadaddr
ssize_t readlink(const char *, char *, size_t)
int rb_w32_dup2(int, int)
int rb_w32_ustati64(const char *, struct stati64 *)
int rb_w32_wrap_io_handle(HANDLE, int)
SOCKET rb_w32_get_osfhandle(int)
int rb_w32_umkdir(const char *, int)
rb_pid_t rb_w32_pipe_exec(const char *, const char *, int, int *, int *)
uintptr_t(* asynchronous_func_t)(uintptr_t self, int argc, uintptr_t *argv)
ssize_t rb_w32_read(int, void *, size_t)
rb_pid_t rb_w32_aspawn_flags(int, const char *, char *const *, DWORD)
rb_pid_t rb_w32_uaspawn_flags(int, const char *, char *const *, DWORD)
int WSAAPI rb_w32_getsockopt(int, int, int, char *, int *)
int rb_w32_urename(const char *, const char *)
int rb_w32_fdisset(int, fd_set *)
struct servent *WSAAPI rb_w32_getservbyname(const char *, const char *)
int rb_w32_open(const char *, int,...)
int WSAAPI rb_w32_select(int, fd_set *, fd_set *, fd_set *, struct timeval *)
void rb_w32_free_environ(char **)
int WSAAPI rb_w32_accept(int, struct sockaddr *, int *)
struct sockaddr * ifa_addr
struct protoent *WSAAPI rb_w32_getprotobynumber(int)
rb_pid_t rb_w32_getpid(void)
RUBY_EXTERN int finite(double)
int rb_w32_uaccess(const char *, int)
int rb_w32_map_errno(DWORD)
int recvmsg(int, struct msghdr *, int)
void freeifaddrs(struct ifaddrs *)
void rb_w32_fdclr(int, fd_set *)
int rb_w32_times(struct tms *)
int WSAAPI rb_w32_socket(int, int, int)
int rb_w32_is_socket(int)
int WSAAPI rb_w32_getsockname(int, struct sockaddr *, int *)
const char *WSAAPI rb_w32_inet_ntop(int, const void *, char *, size_t)
int rb_w32_utruncate(const char *path, off_t length)
struct hostent *WSAAPI rb_w32_gethostbyaddr(const char *, int, int)
struct hostent *WSAAPI rb_w32_gethostbyname(const char *)
int getifaddrs(struct ifaddrs **)
int rb_w32_wopen(const WCHAR *, int,...)
struct ifaddrs * ifa_next
int WSAAPI rb_w32_send(int, const char *, int, int)
rb_pid_t rb_w32_spawn(int, const char *, const char *)
int WINAPI rb_w32_Sleep(unsigned long msec)
int WSAAPI rb_w32_recvfrom(int, char *, int, int, struct sockaddr *, int *)
struct tm * localtime_r(const time_t *, struct tm *)
int chown(const char *, int, int)
int WSAAPI rb_w32_listen(int, int)
int rb_w32_sleep(unsigned long msec)
int rb_w32_mkdir(const char *, int)
struct sockaddr * ifa_dstaddr
int rb_w32_uutime(const char *, const struct utimbuf *)
int rb_w32_rmdir(const char *)
int link(const char *, const char *)
int rb_w32_unwrap_io_handle(int)
int rb_w32_fstati64(int, struct stati64 *)
int rb_w32_time_subtract(struct timeval *rest, const struct timeval *wait)
int rb_w32_unlink(const char *)
int rb_w32_truncate(const char *path, off_t length)
#define RUBY_SYMBOL_EXPORT_END
int rb_w32_urmdir(const char *)
int fstati64(int, struct stati64 *)
char ** rb_w32_get_environ(void)
int rb_w32_uopen(const char *, int,...)
int rb_w32_stati64(const char *, struct stati64 *)
int rb_w32_ulstati64(const char *, struct stati64 *)
int rb_w32_uchmod(const char *, int)
char * rb_w32_getenv(const char *)
rb_pid_t rb_w32_uaspawn(int, const char *, char *const *)
#define RUBY_SYMBOL_EXPORT_BEGIN
struct protoent *WSAAPI rb_w32_getprotobyname(const char *)
int clock_gettime(clockid_t, struct timespec *)
ssize_t rb_w32_wreadlink(const WCHAR *, WCHAR *, size_t)
int WSAAPI rb_w32_setsockopt(int, int, int, const char *, int)
int rb_w32_access(const char *, int)
rb_pid_t rb_w32_aspawn(int, const char *, char *const *)
int rb_w32_uchdir(const char *)
int rb_w32_ulink(const char *, const char *)
int rb_w32_usymlink(const char *src, const char *link)
long rb_w32_write_console(uintptr_t, int)
char * rb_w32_strerror(int)
int clock_getres(clockid_t, struct timespec *)
int WSAAPI rb_w32_ioctlsocket(int, long, u_long *)
struct servent *WSAAPI rb_w32_getservbyport(int, const char *)
int WSAAPI rb_w32_gethostname(char *, int)
WCHAR * rb_w32_mbstr_to_wstr(UINT, const char *, int, long *)
struct tm * gmtime_r(const time_t *, struct tm *)
int rb_w32_ftruncate(int fd, off_t length)
void rb_w32_fdset(int, fd_set *)
int WSAAPI rb_w32_shutdown(int, int)
int WSAAPI rb_w32_inet_pton(int, const char *, void *)
int flock(int fd, int oper)
struct sockaddr * ifa_netmask
int WSAAPI rb_w32_getpeername(int, struct sockaddr *, int *)
char * rb_w32_getcwd(char *, int)
int rb_w32_fclose(FILE *)
int socketpair(int, int, int, int *)
char rb_w32_fd_is_text(int)
int symlink(const char *src, const char *link)
rb_pid_t rb_w32_uspawn(int, const char *, const char *)
ssize_t rb_w32_ureadlink(const char *, char *, size_t)
int WSAAPI rb_w32_recv(int, char *, int, int)
int rb_w32_io_cancelable_p(int)
uintptr_t rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self, int argc, uintptr_t *argv, uintptr_t intrval)
int rb_w32_uunlink(const char *)
int rb_w32_stat(const char *, struct stat *)
int rb_w32_utime(const char *, const struct utimbuf *)
rb_pid_t waitpid(rb_pid_t, int *, int)
void rb_w32_sysinit(int *, char ***)
int rb_w32_uchown(const char *, int, int)
int rb_w32_rename(const char *, const char *)