2002-10-10 17:07:16 -04:00
|
|
|
#ifndef RUBY_WIN32_H
|
2007-06-09 23:06:15 -04:00
|
|
|
#define RUBY_WIN32_H 1
|
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#if 0
|
|
|
|
} /* satisfy cc-mode */
|
|
|
|
#endif
|
|
|
|
#endif
|
1999-01-19 23:45:32 -05:00
|
|
|
|
2013-04-05 06:29:38 -04:00
|
|
|
RUBY_SYMBOL_EXPORT_BEGIN
|
2010-07-21 17:38:25 -04:00
|
|
|
|
1999-01-19 23:45:32 -05:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1993, Intergraph Corporation
|
|
|
|
*
|
|
|
|
* You may distribute under the terms of either the GNU General Public
|
|
|
|
* License or the Artistic License, as specified in the perl README file.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2012-06-13 00:39:25 -04:00
|
|
|
/*
|
|
|
|
* Definitions for NT port of Perl
|
|
|
|
*/
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
|
2012-06-13 00:39:25 -04:00
|
|
|
/*
|
|
|
|
* Ok now we can include the normal include files.
|
|
|
|
*/
|
1999-01-19 23:45:32 -05:00
|
|
|
|
2012-06-13 00:39:25 -04:00
|
|
|
/* #include <stdarg.h> conflict with varargs.h? */
|
2005-11-04 23:43:46 -05:00
|
|
|
#if !defined(WSAAPI)
|
2009-07-17 17:33:05 -04:00
|
|
|
#if defined(__cplusplus) && defined(_MSC_VER)
|
|
|
|
extern "C++" { /* template without extern "C++" */
|
|
|
|
#endif
|
2011-02-28 10:15:32 -05:00
|
|
|
#if !defined(_WIN64) && !defined(WIN32)
|
|
|
|
#define WIN32
|
|
|
|
#endif
|
2015-07-21 06:51:14 -04:00
|
|
|
#if defined(_MSC_VER) && _MSC_VER <= 1200
|
|
|
|
#include <windows.h>
|
|
|
|
#endif
|
2005-02-09 23:55:34 -05:00
|
|
|
#include <winsock2.h>
|
2008-06-06 03:43:45 -04:00
|
|
|
#include <ws2tcpip.h>
|
2013-05-14 04:24:58 -04:00
|
|
|
#if !defined(_MSC_VER) || _MSC_VER >= 1400
|
2013-05-13 07:29:32 -04:00
|
|
|
#include <iphlpapi.h>
|
2013-05-14 04:24:58 -04:00
|
|
|
#endif
|
2009-07-17 17:33:05 -04:00
|
|
|
#if defined(__cplusplus) && defined(_MSC_VER)
|
|
|
|
}
|
|
|
|
#endif
|
1999-01-19 23:45:32 -05:00
|
|
|
#endif
|
* configure.in, defines.h, dir.c, dir.h, dln.c, error.c,
eval.c, file.c, hash.c, io.c, main.c, missing.c,
process.c, ruby.c, rubysig.h, signal.c, st.c, util.c, util.h,
bcc/Makefile.sub, win32/Makefile.sub, win32/win32.h,
ext/Win32API/Win32API.c, ext/socket/getaddrinfo.c,
ext/socket/getnameinfo.c, ext/socket/socket.c,
ext/tcltklib/stubs.c
: replace "NT" with "_WIN32", add DOSISH_DRIVE_LETTER
* wince/exe.mak : delete \r at the end of lines.
* wince/mswince-ruby17.def : delete rb_obj_become
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-14 22:18:08 -05:00
|
|
|
|
2012-06-13 00:39:25 -04:00
|
|
|
/*
|
|
|
|
* We're not using Microsoft's "extensions" to C for
|
|
|
|
* Structured Exception Handling (SEH) so we can nuke these
|
|
|
|
*/
|
1999-01-19 23:45:32 -05:00
|
|
|
#undef try
|
|
|
|
#undef except
|
|
|
|
#undef finally
|
|
|
|
#undef leave
|
1999-08-13 01:45:20 -04:00
|
|
|
|
1999-01-19 23:45:32 -05:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <direct.h>
|
|
|
|
#include <process.h>
|
|
|
|
#include <time.h>
|
2008-01-03 11:20:29 -05:00
|
|
|
#if defined(__cplusplus) && defined(_MSC_VER) && _MSC_VER == 1200
|
|
|
|
extern "C++" { /* template without extern "C++" */
|
|
|
|
#endif
|
1999-01-19 23:45:32 -05:00
|
|
|
#include <math.h>
|
2008-01-03 11:20:29 -05:00
|
|
|
#if defined(__cplusplus) && defined(_MSC_VER) && _MSC_VER == 1200
|
|
|
|
}
|
|
|
|
#endif
|
2002-08-27 22:39:29 -04:00
|
|
|
#include <signal.h>
|
2001-03-20 18:10:05 -05:00
|
|
|
#include <sys/stat.h>
|
1999-01-19 23:45:32 -05:00
|
|
|
#include <sys/types.h>
|
2004-01-19 07:28:14 -05:00
|
|
|
#ifdef HAVE_SYS_UTIME_H
|
2001-08-06 20:21:40 -04:00
|
|
|
# include <sys/utime.h>
|
|
|
|
#else
|
|
|
|
# include <utime.h>
|
|
|
|
#endif
|
1999-08-13 01:45:20 -04:00
|
|
|
#include <io.h>
|
|
|
|
#include <malloc.h>
|
2015-04-23 19:41:16 -04:00
|
|
|
#if defined __MINGW32__
|
2007-06-27 07:47:53 -04:00
|
|
|
# include <stdint.h>
|
|
|
|
#else
|
|
|
|
# if !defined(_INTPTR_T_DEFINED)
|
|
|
|
# ifdef _WIN64
|
|
|
|
typedef __int64 intptr_t;
|
|
|
|
# else
|
|
|
|
typedef int intptr_t;
|
2013-05-14 01:52:06 -04:00
|
|
|
# endif
|
|
|
|
# define _INTPTR_T_DEFINED
|
|
|
|
# endif
|
|
|
|
# if !defined(INTPTR_MAX)
|
|
|
|
# ifdef _WIN64
|
|
|
|
# define INTPTR_MAX 9223372036854775807I64
|
|
|
|
# else
|
2013-05-03 00:29:18 -04:00
|
|
|
# define INTPTR_MAX 2147483647
|
2007-06-27 07:47:53 -04:00
|
|
|
# endif
|
2013-05-03 00:29:18 -04:00
|
|
|
# define INTPTR_MIN (-INTPTR_MAX-1)
|
2007-06-27 07:47:53 -04:00
|
|
|
# endif
|
|
|
|
# if !defined(_UINTPTR_T_DEFINED)
|
|
|
|
# ifdef _WIN64
|
|
|
|
typedef unsigned __int64 uintptr_t;
|
|
|
|
# else
|
|
|
|
typedef unsigned int uintptr_t;
|
|
|
|
# endif
|
|
|
|
# define _UINTPTR_T_DEFINED
|
|
|
|
# endif
|
2013-05-14 01:52:06 -04:00
|
|
|
# if !defined(UINTPTR_MAX)
|
|
|
|
# ifdef _WIN64
|
|
|
|
# define UINTPTR_MAX 18446744073709551615UI64
|
|
|
|
# else
|
|
|
|
# define UINTPTR_MAX 4294967295U
|
|
|
|
# endif
|
|
|
|
# endif
|
2007-06-27 07:47:53 -04:00
|
|
|
#endif
|
2008-04-24 21:55:22 -04:00
|
|
|
#ifndef __MINGW32__
|
|
|
|
# define mode_t int
|
|
|
|
#endif
|
2011-04-26 11:50:09 -04:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
1999-01-19 23:45:32 -05:00
|
|
|
|
2012-07-09 04:33:47 -04:00
|
|
|
#define rb_w32_iswinnt() TRUE
|
|
|
|
#define rb_w32_iswin95() FALSE
|
2005-11-22 11:26:39 -05:00
|
|
|
|
1999-08-13 01:45:20 -04:00
|
|
|
#define WNOHANG -1
|
1999-01-19 23:45:32 -05:00
|
|
|
|
2016-03-12 19:43:25 -05:00
|
|
|
#define O_SHARE_DELETE 0x20000000 /* for rb_w32_open(), rb_w32_wopen() */
|
2015-06-12 08:14:06 -04:00
|
|
|
|
2013-08-15 01:32:02 -04:00
|
|
|
typedef int clockid_t;
|
|
|
|
#define CLOCK_REALTIME 0
|
2013-08-19 00:29:41 -04:00
|
|
|
#define CLOCK_MONOTONIC 1
|
2013-08-15 01:32:02 -04:00
|
|
|
|
2003-02-17 00:17:46 -05:00
|
|
|
#undef utime
|
2006-08-12 02:56:09 -04:00
|
|
|
#undef lseek
|
2011-12-08 18:00:36 -05:00
|
|
|
#undef stat
|
2006-08-12 02:56:09 -04:00
|
|
|
#undef fstat
|
2005-11-04 23:43:46 -05:00
|
|
|
#ifdef RUBY_EXPORT
|
2020-12-19 12:16:31 -05:00
|
|
|
#define utime(_p, _t) rb_w32_uutime(_p, _t)
|
2017-12-04 05:48:30 -05:00
|
|
|
#undef HAVE_UTIMES
|
|
|
|
#define HAVE_UTIMES 1
|
2020-12-19 12:16:31 -05:00
|
|
|
#define utimes(_p, _t) rb_w32_uutimes(_p, _t)
|
2017-12-04 05:48:30 -05:00
|
|
|
#undef HAVE_UTIMENSAT
|
|
|
|
#define HAVE_UTIMENSAT 1
|
|
|
|
#define AT_FDCWD -100
|
2020-12-19 12:16:31 -05:00
|
|
|
#define utimensat(_d, _p, _t, _f) rb_w32_uutimensat(_d, _p, _t, _f)
|
2019-07-24 17:39:40 -04:00
|
|
|
#define lseek(_f, _o, _w) rb_w32_lseek(_f, _o, _w)
|
2001-02-17 10:17:10 -05:00
|
|
|
|
2008-08-28 08:46:58 -04:00
|
|
|
#define pipe(p) rb_w32_pipe(p)
|
2020-12-19 12:16:31 -05:00
|
|
|
#define open rb_w32_uopen
|
2003-07-28 23:17:13 -04:00
|
|
|
#define close(h) rb_w32_close(h)
|
|
|
|
#define fclose(f) rb_w32_fclose(f)
|
2006-06-08 01:01:51 -04:00
|
|
|
#define read(f, b, s) rb_w32_read(f, b, s)
|
|
|
|
#define write(f, b, s) rb_w32_write(f, b, s)
|
2003-07-28 23:17:13 -04:00
|
|
|
#define getpid() rb_w32_getpid()
|
2022-01-18 05:08:07 -05:00
|
|
|
#undef HAVE_GETPPID
|
|
|
|
#define HAVE_GETPPID 1
|
2008-06-23 22:14:00 -04:00
|
|
|
#define getppid() rb_w32_getppid()
|
2005-11-04 23:43:46 -05:00
|
|
|
#define sleep(x) rb_w32_Sleep((x)*1000)
|
|
|
|
#define Sleep(msec) (void)rb_w32_Sleep(msec)
|
2004-11-18 06:52:46 -05:00
|
|
|
|
2022-01-18 05:08:07 -05:00
|
|
|
#undef HAVE_EXECV
|
|
|
|
#define HAVE_EXECV 1
|
2003-12-09 23:00:07 -05:00
|
|
|
#undef execv
|
2020-12-07 12:00:39 -05:00
|
|
|
#define execv(path,argv) rb_w32_uaspawn(P_OVERLAY,path,argv)
|
2004-11-18 06:52:46 -05:00
|
|
|
#undef isatty
|
|
|
|
#define isatty(h) rb_w32_isatty(h)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
2004-12-06 23:45:46 -05:00
|
|
|
#undef mkdir
|
2020-12-19 12:16:31 -05:00
|
|
|
#define mkdir(p, m) rb_w32_umkdir(p, m)
|
2004-12-06 23:45:46 -05:00
|
|
|
#undef rmdir
|
2020-12-19 12:16:31 -05:00
|
|
|
#define rmdir(p) rb_w32_urmdir(p)
|
2005-06-20 04:17:53 -04:00
|
|
|
#undef unlink
|
2020-12-19 12:16:31 -05:00
|
|
|
#define unlink(p) rb_w32_uunlink(p)
|
2009-10-20 03:43:17 -04:00
|
|
|
#endif /* RUBY_EXPORT */
|
2005-11-04 23:43:46 -05:00
|
|
|
|
support 128bit ino on Windows (if available)
* win32/win32.c, include/ruby/win32.h (stati128, rb_{,u,l,ul}stati128): rename
from stati64ns, change the type of st_ino to 64bit and added st_inohigh.
* dir.c, file.c (stat, lstat): follow above changes.
* file.c (rb_stat_ino): support 128bit ino.
* win32/win32.c (rb_{,u,l,ul}stati128): ditto.
[Feature #13731]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-10 12:26:58 -05:00
|
|
|
/* same with stati64 except the size of st_ino and nanosecond timestamps */
|
|
|
|
struct stati128 {
|
2017-12-04 05:48:30 -05:00
|
|
|
_dev_t st_dev;
|
support 128bit ino on Windows (if available)
* win32/win32.c, include/ruby/win32.h (stati128, rb_{,u,l,ul}stati128): rename
from stati64ns, change the type of st_ino to 64bit and added st_inohigh.
* dir.c, file.c (stat, lstat): follow above changes.
* file.c (rb_stat_ino): support 128bit ino.
* win32/win32.c (rb_{,u,l,ul}stati128): ditto.
[Feature #13731]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-10 12:26:58 -05:00
|
|
|
unsigned __int64 st_ino;
|
|
|
|
__int64 st_inohigh;
|
2017-12-04 05:48:30 -05:00
|
|
|
unsigned short st_mode;
|
|
|
|
short st_nlink;
|
|
|
|
short st_uid;
|
|
|
|
short st_gid;
|
|
|
|
_dev_t st_rdev;
|
|
|
|
__int64 st_size;
|
|
|
|
__time64_t st_atime;
|
|
|
|
long st_atimensec;
|
|
|
|
__time64_t st_mtime;
|
|
|
|
long st_mtimensec;
|
|
|
|
__time64_t st_ctime;
|
|
|
|
long st_ctimensec;
|
|
|
|
};
|
|
|
|
|
support 128bit ino on Windows (if available)
* win32/win32.c, include/ruby/win32.h (stati128, rb_{,u,l,ul}stati128): rename
from stati64ns, change the type of st_ino to 64bit and added st_inohigh.
* dir.c, file.c (stat, lstat): follow above changes.
* file.c (rb_stat_ino): support 128bit ino.
* win32/win32.c (rb_{,u,l,ul}stati128): ditto.
[Feature #13731]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-10 12:26:58 -05:00
|
|
|
#define stat stati128
|
2017-12-11 11:06:41 -05:00
|
|
|
#undef SIZEOF_STRUCT_STAT_ST_INO
|
support 128bit ino on Windows (if available)
* win32/win32.c, include/ruby/win32.h (stati128, rb_{,u,l,ul}stati128): rename
from stati64ns, change the type of st_ino to 64bit and added st_inohigh.
* dir.c, file.c (stat, lstat): follow above changes.
* file.c (rb_stat_ino): support 128bit ino.
* win32/win32.c (rb_{,u,l,ul}stati128): ditto.
[Feature #13731]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-10 12:26:58 -05:00
|
|
|
#define SIZEOF_STRUCT_STAT_ST_INO sizeof(unsigned __int64)
|
|
|
|
#define HAVE_STRUCT_STAT_ST_INOHIGH
|
2017-12-04 05:48:30 -05:00
|
|
|
#define HAVE_STRUCT_STAT_ST_ATIMENSEC
|
|
|
|
#define HAVE_STRUCT_STAT_ST_MTIMENSEC
|
|
|
|
#define HAVE_STRUCT_STAT_ST_CTIMENSEC
|
support 128bit ino on Windows (if available)
* win32/win32.c, include/ruby/win32.h (stati128, rb_{,u,l,ul}stati128): rename
from stati64ns, change the type of st_ino to 64bit and added st_inohigh.
* dir.c, file.c (stat, lstat): follow above changes.
* file.c (rb_stat_ino): support 128bit ino.
* win32/win32.c (rb_{,u,l,ul}stati128): ditto.
[Feature #13731]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-10 12:26:58 -05:00
|
|
|
#define fstat(fd,st) rb_w32_fstati128(fd,st)
|
2020-12-19 12:16:31 -05:00
|
|
|
#define stati128(path, st) rb_w32_ustati128(path,st)
|
|
|
|
#define lstat(path,st) rb_w32_ulstati128(path,st)
|
|
|
|
#define access(path,mode) rb_w32_uaccess(path,mode)
|
2006-08-12 02:56:09 -04:00
|
|
|
|
2009-03-10 06:58:49 -04:00
|
|
|
#define strcasecmp _stricmp
|
|
|
|
#define strncasecmp _strnicmp
|
2007-09-28 19:57:17 -04:00
|
|
|
#define fsync _commit
|
2004-12-06 23:45:46 -05:00
|
|
|
|
2010-01-12 16:54:47 -05:00
|
|
|
struct timezone;
|
|
|
|
|
2000-05-13 12:13:31 -04:00
|
|
|
#ifdef __MINGW32__
|
2006-06-27 03:21:31 -04:00
|
|
|
#undef isascii
|
|
|
|
#define isascii __isascii
|
2000-05-13 12:13:31 -04:00
|
|
|
#endif
|
2009-07-21 00:38:20 -04:00
|
|
|
|
|
|
|
struct iovec {
|
|
|
|
void *iov_base;
|
|
|
|
size_t iov_len;
|
|
|
|
};
|
|
|
|
struct msghdr {
|
|
|
|
void *msg_name;
|
|
|
|
int msg_namelen;
|
|
|
|
struct iovec *msg_iov;
|
|
|
|
int msg_iovlen;
|
|
|
|
void *msg_control;
|
|
|
|
int msg_controllen;
|
|
|
|
int msg_flags;
|
|
|
|
};
|
|
|
|
|
2013-05-13 07:29:32 -04:00
|
|
|
/* for getifaddrs() and others */
|
|
|
|
struct ifaddrs {
|
|
|
|
struct ifaddrs *ifa_next;
|
|
|
|
char *ifa_name;
|
|
|
|
u_int ifa_flags;
|
|
|
|
struct sockaddr *ifa_addr;
|
|
|
|
struct sockaddr *ifa_netmask;
|
|
|
|
struct sockaddr *ifa_broadaddr;
|
|
|
|
struct sockaddr *ifa_dstaddr;
|
|
|
|
void *ifa_data;
|
|
|
|
};
|
|
|
|
#ifdef IF_NAMESIZE
|
|
|
|
#define IFNAMSIZ IF_NAMESIZE
|
|
|
|
#else
|
|
|
|
#define IFNAMSIZ 256
|
|
|
|
#endif
|
|
|
|
#ifdef IFF_POINTTOPOINT
|
|
|
|
#define IFF_POINTOPOINT IFF_POINTTOPOINT
|
|
|
|
#endif
|
|
|
|
|
2016-12-13 00:17:48 -05:00
|
|
|
extern void rb_w32_sysinit(int *, char ***);
|
2012-07-09 04:33:47 -04:00
|
|
|
extern DWORD rb_w32_osid(void);
|
2002-05-29 06:22:19 -04:00
|
|
|
extern int flock(int fd, int oper);
|
2011-07-15 01:33:45 -04:00
|
|
|
extern int rb_w32_io_cancelable_p(int);
|
2004-12-06 06:19:27 -05:00
|
|
|
extern int rb_w32_is_socket(int);
|
2005-11-04 23:43:46 -05:00
|
|
|
extern int WSAAPI rb_w32_accept(int, struct sockaddr *, int *);
|
|
|
|
extern int WSAAPI rb_w32_bind(int, const struct sockaddr *, int);
|
|
|
|
extern int WSAAPI rb_w32_connect(int, const struct sockaddr *, int);
|
2002-05-29 06:22:19 -04:00
|
|
|
extern void rb_w32_fdset(int, fd_set*);
|
|
|
|
extern void rb_w32_fdclr(int, fd_set*);
|
|
|
|
extern int rb_w32_fdisset(int, fd_set*);
|
2005-11-04 23:43:46 -05:00
|
|
|
extern int WSAAPI rb_w32_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
|
|
|
extern int WSAAPI rb_w32_getpeername(int, struct sockaddr *, int *);
|
|
|
|
extern int WSAAPI rb_w32_getsockname(int, struct sockaddr *, int *);
|
|
|
|
extern int WSAAPI rb_w32_getsockopt(int, int, int, char *, int *);
|
|
|
|
extern int WSAAPI rb_w32_ioctlsocket(int, long, u_long *);
|
|
|
|
extern int WSAAPI rb_w32_listen(int, int);
|
|
|
|
extern int WSAAPI rb_w32_recv(int, char *, int, int);
|
|
|
|
extern int WSAAPI rb_w32_recvfrom(int, char *, int, int, struct sockaddr *, int *);
|
|
|
|
extern int WSAAPI rb_w32_send(int, const char *, int, int);
|
|
|
|
extern int WSAAPI rb_w32_sendto(int, const char *, int, int, const struct sockaddr *, int);
|
2009-07-21 00:38:20 -04:00
|
|
|
extern int recvmsg(int, struct msghdr *, int);
|
|
|
|
extern int sendmsg(int, const struct msghdr *, int);
|
2005-11-04 23:43:46 -05:00
|
|
|
extern int WSAAPI rb_w32_setsockopt(int, int, int, const char *, int);
|
|
|
|
extern int WSAAPI rb_w32_shutdown(int, int);
|
|
|
|
extern int WSAAPI rb_w32_socket(int, int, int);
|
2002-05-29 06:22:19 -04:00
|
|
|
extern SOCKET rb_w32_get_osfhandle(int);
|
2005-11-04 23:43:46 -05:00
|
|
|
extern struct hostent *WSAAPI rb_w32_gethostbyaddr(const char *, int, int);
|
|
|
|
extern struct hostent *WSAAPI rb_w32_gethostbyname(const char *);
|
|
|
|
extern int WSAAPI rb_w32_gethostname(char *, int);
|
|
|
|
extern struct protoent *WSAAPI rb_w32_getprotobyname(const char *);
|
|
|
|
extern struct protoent *WSAAPI rb_w32_getprotobynumber(int);
|
|
|
|
extern struct servent *WSAAPI rb_w32_getservbyname(const char *, const char *);
|
|
|
|
extern struct servent *WSAAPI rb_w32_getservbyport(int, const char *);
|
2013-05-13 07:29:32 -04:00
|
|
|
extern int socketpair(int, int, int, int *);
|
|
|
|
extern int getifaddrs(struct ifaddrs **);
|
|
|
|
extern void freeifaddrs(struct ifaddrs *);
|
2020-12-19 12:16:31 -05:00
|
|
|
extern char * rb_w32_ugetcwd(char *, int);
|
2012-03-14 23:57:02 -04:00
|
|
|
extern char * rb_w32_ugetenv(const char *);
|
* merge some patches from win32-uncode-test branch.
see #1685.
* file.c, include/ruby/intern.h (rb_str_encode_ospath): new function
to convert encoding for pathname.
* win32.c, include/ruby/win32.h (rb_w32_ulink, rb_w32_urename,
rb_w32_ustati64, rb_w32_uopen, rb_w32_uutime, rb_w32_uchdir,
rb_w32_umkdir, rb_w32_urmdir, rb_w32_uunlink): new functions to
accept UTF-8 path.
* win32/win32.c (rb_w32_opendir, link, rb_w32_stati64, rb_w32_utime,
rb_w32_unlink): use WCHAR path internally.
* file.c (rb_stat, eaccess, access_internal, rb_file_s_ftype,
chmod_internal, rb_file_chmod, rb_file_chown, utime_internal,
rb_file_s_link, unlink_internal, rb_file_s_rename): use UTF-8 version
functions on Win32.
* file.c (apply2files, rb_stat, rb_file_s_lstat, rb_file_symlink_p,
rb_file_readable_p, rb_file_writable_p, rb_file_executable_p,
check3rdbyte, rb_file_identical_p, rb_file_chmod, rb_file_chown,
rb_file_s_link, rb_file_s_symlink, rb_file_s_rename): call
rb_str_encode_ospath() before passing the path to system.
* io.c (rb_sysopen): ditto.
* dir.c (dir_chdir, dir_s_mkdir, dir_s_rmdir): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 13:56:23 -04:00
|
|
|
extern int rb_w32_urename(const char *, const char *);
|
2002-05-29 06:22:19 -04:00
|
|
|
extern char **rb_w32_get_environ(void);
|
|
|
|
extern void rb_w32_free_environ(char **);
|
2008-02-20 09:55:21 -05:00
|
|
|
extern int rb_w32_map_errno(DWORD);
|
2012-07-29 10:56:52 -04:00
|
|
|
extern const char *WSAAPI rb_w32_inet_ntop(int,const void *,char *,size_t);
|
2014-02-22 21:54:04 -05:00
|
|
|
extern int WSAAPI rb_w32_inet_pton(int,const char *,void *);
|
2011-05-15 07:55:52 -04:00
|
|
|
extern DWORD rb_w32_osver(void);
|
1999-08-13 01:45:20 -04:00
|
|
|
|
* merge some patches from win32-uncode-test branch.
see #1685.
* file.c, include/ruby/intern.h (rb_str_encode_ospath): new function
to convert encoding for pathname.
* win32.c, include/ruby/win32.h (rb_w32_ulink, rb_w32_urename,
rb_w32_ustati64, rb_w32_uopen, rb_w32_uutime, rb_w32_uchdir,
rb_w32_umkdir, rb_w32_urmdir, rb_w32_uunlink): new functions to
accept UTF-8 path.
* win32/win32.c (rb_w32_opendir, link, rb_w32_stati64, rb_w32_utime,
rb_w32_unlink): use WCHAR path internally.
* file.c (rb_stat, eaccess, access_internal, rb_file_s_ftype,
chmod_internal, rb_file_chmod, rb_file_chown, utime_internal,
rb_file_s_link, unlink_internal, rb_file_s_rename): use UTF-8 version
functions on Win32.
* file.c (apply2files, rb_stat, rb_file_s_lstat, rb_file_symlink_p,
rb_file_readable_p, rb_file_writable_p, rb_file_executable_p,
check3rdbyte, rb_file_identical_p, rb_file_chmod, rb_file_chown,
rb_file_s_link, rb_file_s_symlink, rb_file_s_rename): call
rb_str_encode_ospath() before passing the path to system.
* io.c (rb_sysopen): ditto.
* dir.c (dir_chdir, dir_s_mkdir, dir_s_rmdir): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 13:56:23 -04:00
|
|
|
extern int rb_w32_uchown(const char *, int, int);
|
|
|
|
extern int rb_w32_ulink(const char *, const char *);
|
2015-03-23 04:36:04 -04:00
|
|
|
extern ssize_t rb_w32_ureadlink(const char *, char *, size_t);
|
|
|
|
extern ssize_t rb_w32_wreadlink(const WCHAR *, WCHAR *, size_t);
|
2015-08-24 17:34:45 -04:00
|
|
|
extern int rb_w32_usymlink(const char *src, const char *link);
|
1999-08-13 01:45:20 -04:00
|
|
|
extern int gettimeofday(struct timeval *, struct timezone *);
|
2013-08-15 01:32:02 -04:00
|
|
|
extern int clock_gettime(clockid_t, struct timespec *);
|
2013-09-06 01:23:28 -04:00
|
|
|
extern int clock_getres(clockid_t, struct timespec *);
|
2020-12-27 02:32:08 -05:00
|
|
|
extern rb_pid_t waitpid(rb_pid_t, int *, int);
|
|
|
|
extern rb_pid_t wait(int *);
|
2013-06-29 21:59:07 -04:00
|
|
|
extern rb_pid_t rb_w32_uspawn(int, const char *, const char*);
|
2013-06-29 21:59:03 -04:00
|
|
|
extern rb_pid_t rb_w32_uaspawn(int, const char *, char *const *);
|
|
|
|
extern rb_pid_t rb_w32_uaspawn_flags(int, const char *, char *const *, DWORD);
|
2022-01-18 05:08:07 -05:00
|
|
|
#undef HAVE_KILL
|
|
|
|
#define HAVE_KILL 1
|
|
|
|
extern int kill(rb_pid_t, int);
|
2004-09-06 23:52:15 -04:00
|
|
|
extern int fcntl(int, int, ...);
|
2014-11-10 05:42:19 -05:00
|
|
|
extern int rb_w32_set_nonblock(int);
|
2005-05-15 14:36:56 -04:00
|
|
|
extern rb_pid_t rb_w32_getpid(void);
|
2008-06-23 22:14:00 -04:00
|
|
|
extern rb_pid_t rb_w32_getppid(void);
|
2004-11-18 06:52:46 -05:00
|
|
|
extern int rb_w32_isatty(int);
|
2010-05-04 00:26:43 -04:00
|
|
|
extern int rb_w32_uchdir(const char *);
|
* merge some patches from win32-uncode-test branch.
see #1685.
* file.c, include/ruby/intern.h (rb_str_encode_ospath): new function
to convert encoding for pathname.
* win32.c, include/ruby/win32.h (rb_w32_ulink, rb_w32_urename,
rb_w32_ustati64, rb_w32_uopen, rb_w32_uutime, rb_w32_uchdir,
rb_w32_umkdir, rb_w32_urmdir, rb_w32_uunlink): new functions to
accept UTF-8 path.
* win32/win32.c (rb_w32_opendir, link, rb_w32_stati64, rb_w32_utime,
rb_w32_unlink): use WCHAR path internally.
* file.c (rb_stat, eaccess, access_internal, rb_file_s_ftype,
chmod_internal, rb_file_chmod, rb_file_chown, utime_internal,
rb_file_s_link, unlink_internal, rb_file_s_rename): use UTF-8 version
functions on Win32.
* file.c (apply2files, rb_stat, rb_file_s_lstat, rb_file_symlink_p,
rb_file_readable_p, rb_file_writable_p, rb_file_executable_p,
check3rdbyte, rb_file_identical_p, rb_file_chmod, rb_file_chown,
rb_file_s_link, rb_file_s_symlink, rb_file_s_rename): call
rb_str_encode_ospath() before passing the path to system.
* io.c (rb_sysopen): ditto.
* dir.c (dir_chdir, dir_s_mkdir, dir_s_rmdir): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 13:56:23 -04:00
|
|
|
extern int rb_w32_umkdir(const char *, int);
|
|
|
|
extern int rb_w32_urmdir(const char *);
|
|
|
|
extern int rb_w32_uunlink(const char *);
|
|
|
|
extern int rb_w32_uchmod(const char *, int);
|
support 128bit ino on Windows (if available)
* win32/win32.c, include/ruby/win32.h (stati128, rb_{,u,l,ul}stati128): rename
from stati64ns, change the type of st_ino to 64bit and added st_inohigh.
* dir.c, file.c (stat, lstat): follow above changes.
* file.c (rb_stat_ino): support 128bit ino.
* win32/win32.c (rb_{,u,l,ul}stati128): ditto.
[Feature #13731]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-10 12:26:58 -05:00
|
|
|
extern int rb_w32_ustati128(const char *, struct stati128 *);
|
|
|
|
extern int rb_w32_ulstati128(const char *, struct stati128 *);
|
* merge some patches from win32-uncode-test branch.
see #1685.
* file.c, include/ruby/intern.h (rb_str_encode_ospath): new function
to convert encoding for pathname.
* win32.c, include/ruby/win32.h (rb_w32_ulink, rb_w32_urename,
rb_w32_ustati64, rb_w32_uopen, rb_w32_uutime, rb_w32_uchdir,
rb_w32_umkdir, rb_w32_urmdir, rb_w32_uunlink): new functions to
accept UTF-8 path.
* win32/win32.c (rb_w32_opendir, link, rb_w32_stati64, rb_w32_utime,
rb_w32_unlink): use WCHAR path internally.
* file.c (rb_stat, eaccess, access_internal, rb_file_s_ftype,
chmod_internal, rb_file_chmod, rb_file_chown, utime_internal,
rb_file_s_link, unlink_internal, rb_file_s_rename): use UTF-8 version
functions on Win32.
* file.c (apply2files, rb_stat, rb_file_s_lstat, rb_file_symlink_p,
rb_file_readable_p, rb_file_writable_p, rb_file_executable_p,
check3rdbyte, rb_file_identical_p, rb_file_chmod, rb_file_chown,
rb_file_s_link, rb_file_s_symlink, rb_file_s_rename): call
rb_str_encode_ospath() before passing the path to system.
* io.c (rb_sysopen): ditto.
* dir.c (dir_chdir, dir_s_mkdir, dir_s_rmdir): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 13:56:23 -04:00
|
|
|
extern int rb_w32_uaccess(const char *, int);
|
2011-12-14 05:38:12 -05:00
|
|
|
extern char rb_w32_fd_is_text(int);
|
support 128bit ino on Windows (if available)
* win32/win32.c, include/ruby/win32.h (stati128, rb_{,u,l,ul}stati128): rename
from stati64ns, change the type of st_ino to 64bit and added st_inohigh.
* dir.c, file.c (stat, lstat): follow above changes.
* file.c (rb_stat_ino): support 128bit ino.
* win32/win32.c (rb_{,u,l,ul}stati128): ditto.
[Feature #13731]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-10 12:26:58 -05:00
|
|
|
extern int rb_w32_fstati128(int, struct stati128 *);
|
2013-11-28 02:15:56 -05:00
|
|
|
extern int rb_w32_dup2(int, int);
|
2002-12-26 09:59:35 -05:00
|
|
|
|
2002-06-10 21:27:48 -04:00
|
|
|
#include <float.h>
|
2013-10-23 12:34:22 -04:00
|
|
|
|
|
|
|
#if defined _MSC_VER && _MSC_VER >= 1800 && defined INFINITY
|
|
|
|
#pragma warning(push)
|
|
|
|
#pragma warning(disable:4756)
|
|
|
|
static inline float
|
|
|
|
rb_infinity_float(void)
|
|
|
|
{
|
|
|
|
return INFINITY;
|
|
|
|
}
|
|
|
|
#pragma warning(pop)
|
|
|
|
#undef INFINITY
|
|
|
|
#define INFINITY rb_infinity_float()
|
|
|
|
#endif
|
|
|
|
|
2003-04-21 08:26:08 -04:00
|
|
|
#if !defined __MINGW32__ || defined __NO_ISOCEXT
|
2005-07-01 02:52:37 -04:00
|
|
|
#ifndef copysign
|
|
|
|
#define copysign(a, b) _copysign(a, b)
|
|
|
|
#endif
|
2009-10-20 03:43:17 -04:00
|
|
|
static inline double
|
|
|
|
scalb(double a, long b)
|
|
|
|
{
|
|
|
|
return _scalb(a, b);
|
|
|
|
}
|
2002-06-10 21:27:48 -04:00
|
|
|
#endif
|
|
|
|
|
2005-11-17 22:22:26 -05:00
|
|
|
#if !defined S_IFIFO && defined _S_IFIFO
|
|
|
|
#define S_IFIFO _S_IFIFO
|
|
|
|
#endif
|
|
|
|
|
2002-09-09 10:48:21 -04:00
|
|
|
#if !defined S_IRUSR && !defined __MINGW32__
|
2002-09-08 06:06:40 -04:00
|
|
|
#define S_IRUSR 0400
|
|
|
|
#endif
|
|
|
|
#ifndef S_IRGRP
|
|
|
|
#define S_IRGRP 0040
|
|
|
|
#endif
|
|
|
|
#ifndef S_IROTH
|
|
|
|
#define S_IROTH 0004
|
|
|
|
#endif
|
|
|
|
|
2002-09-09 10:48:21 -04:00
|
|
|
#if !defined S_IWUSR && !defined __MINGW32__
|
2002-09-08 06:06:40 -04:00
|
|
|
#define S_IWUSR 0200
|
|
|
|
#endif
|
|
|
|
#ifndef S_IWGRP
|
|
|
|
#define S_IWGRP 0020
|
|
|
|
#endif
|
|
|
|
#ifndef S_IWOTH
|
|
|
|
#define S_IWOTH 0002
|
|
|
|
#endif
|
|
|
|
|
2002-09-09 10:48:21 -04:00
|
|
|
#if !defined S_IXUSR && !defined __MINGW32__
|
2002-09-08 06:06:40 -04:00
|
|
|
#define S_IXUSR 0100
|
|
|
|
#endif
|
|
|
|
#ifndef S_IXGRP
|
|
|
|
#define S_IXGRP 0010
|
|
|
|
#endif
|
|
|
|
#ifndef S_IXOTH
|
|
|
|
#define S_IXOTH 0001
|
|
|
|
#endif
|
|
|
|
|
2015-03-18 22:38:02 -04:00
|
|
|
#define S_IFLNK 0xa000
|
|
|
|
|
2012-06-13 00:39:25 -04:00
|
|
|
/*
|
|
|
|
* define this so we can do inplace editing
|
|
|
|
*/
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#define SUFFIX
|
2011-04-11 12:38:10 -04:00
|
|
|
|
2022-09-05 07:23:27 -04:00
|
|
|
extern int rb_w32_ftruncate(int fd, rb_off_t length);
|
|
|
|
extern int rb_w32_truncate(const char *path, rb_off_t length);
|
|
|
|
extern int rb_w32_utruncate(const char *path, rb_off_t length);
|
2011-04-26 11:50:09 -04:00
|
|
|
|
|
|
|
#undef HAVE_FTRUNCATE
|
|
|
|
#define HAVE_FTRUNCATE 1
|
|
|
|
#if defined HAVE_FTRUNCATE64
|
|
|
|
#define ftruncate ftruncate64
|
|
|
|
#else
|
2010-04-10 22:58:26 -04:00
|
|
|
#define ftruncate rb_w32_ftruncate
|
2011-04-11 12:38:10 -04:00
|
|
|
#endif
|
|
|
|
|
2011-04-26 11:50:09 -04:00
|
|
|
#undef HAVE_TRUNCATE
|
|
|
|
#define HAVE_TRUNCATE 1
|
2020-12-19 12:16:31 -05:00
|
|
|
#define truncate rb_w32_utruncate
|
2011-04-11 12:38:10 -04:00
|
|
|
|
2014-02-06 22:23:32 -05:00
|
|
|
#if defined(_MSC_VER) && _MSC_VER >= 1400 && _MSC_VER < 1800
|
|
|
|
#define strtoll _strtoi64
|
|
|
|
#define strtoull _strtoui64
|
|
|
|
#endif
|
|
|
|
|
2012-06-13 00:39:25 -04:00
|
|
|
/*
|
|
|
|
* stubs
|
|
|
|
*/
|
2004-01-19 07:28:14 -05:00
|
|
|
extern int ioctl (int, int, ...);
|
2005-05-15 14:36:56 -04:00
|
|
|
extern rb_uid_t getuid (void);
|
|
|
|
extern rb_uid_t geteuid (void);
|
|
|
|
extern rb_gid_t getgid (void);
|
|
|
|
extern rb_gid_t getegid (void);
|
|
|
|
extern int setuid (rb_uid_t);
|
|
|
|
extern int setgid (rb_gid_t);
|
1999-01-19 23:45:32 -05:00
|
|
|
|
2002-05-29 06:22:19 -04:00
|
|
|
extern char *rb_w32_strerror(int);
|
1999-01-19 23:45:32 -05:00
|
|
|
|
2005-11-04 23:43:46 -05:00
|
|
|
#ifdef RUBY_EXPORT
|
2002-05-29 06:22:19 -04:00
|
|
|
#define strerror(e) rb_w32_strerror(e)
|
2005-11-04 23:43:46 -05:00
|
|
|
#endif
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#define PIPE_BUF 1024
|
|
|
|
|
|
|
|
#define LOCK_SH 1
|
|
|
|
#define LOCK_EX 2
|
|
|
|
#define LOCK_NB 4
|
|
|
|
#define LOCK_UN 8
|
|
|
|
|
|
|
|
|
2002-08-27 22:39:29 -04:00
|
|
|
#ifndef SIGINT
|
|
|
|
#define SIGINT 2
|
|
|
|
#endif
|
|
|
|
#ifndef SIGKILL
|
|
|
|
#define SIGKILL 9
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
1999-01-19 23:45:32 -05:00
|
|
|
/* #undef va_start */
|
|
|
|
/* #undef va_end */
|
|
|
|
|
* win32/win32.c (map_errno): support winsock error.
* win32/win32.c (pipe_exec, CreateChild, poll_child_status, waitpid,
kill, link, rb_w32_rename, unixtime_to_filetime, rb_w32_utime):
pass errno to map_errno().
* win32/win32.c (rb_w32_select, rb_w32_accept, rb_w32_bind,
rb_w32_connect, rb_w32_getpeername, rb_w32_getsockname,
rb_w32_getsockopt, rb_w32_ioctlsocket, rb_w32_listen, rb_w32_recv,
rb_w32_recvfrom, rb_w32_send, rb_w32_sendto, rb_w32_setsockopt,
rb_w32_shutdown, rb_w32_socket, rb_w32_gethostbyaddr,
rb_w32_gethostbyname, rb_w32_gethostname, rb_w32_getprotobyname,
rb_w32_getprotobynumber, rb_w32_getservbyname, rb_w32_getservbyport,
rb_w32_fclose, rb_w32_close): use map_errno().
* win32/win32.h: add winsock errors.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-26 16:17:18 -04:00
|
|
|
/* winsock error map */
|
2010-04-08 01:25:10 -04:00
|
|
|
#include <errno.h>
|
|
|
|
|
2010-04-06 01:58:07 -04:00
|
|
|
#ifndef EWOULDBLOCK
|
|
|
|
# define EWOULDBLOCK WSAEWOULDBLOCK
|
|
|
|
#endif
|
|
|
|
#ifndef EINPROGRESS
|
|
|
|
# define EINPROGRESS WSAEINPROGRESS
|
|
|
|
#endif
|
|
|
|
#ifndef EALREADY
|
|
|
|
# define EALREADY WSAEALREADY
|
|
|
|
#endif
|
|
|
|
#ifndef ENOTSOCK
|
|
|
|
# define ENOTSOCK WSAENOTSOCK
|
|
|
|
#endif
|
|
|
|
#ifndef EDESTADDRREQ
|
|
|
|
# define EDESTADDRREQ WSAEDESTADDRREQ
|
|
|
|
#endif
|
|
|
|
#ifndef EMSGSIZE
|
|
|
|
# define EMSGSIZE WSAEMSGSIZE
|
|
|
|
#endif
|
|
|
|
#ifndef EPROTOTYPE
|
|
|
|
# define EPROTOTYPE WSAEPROTOTYPE
|
|
|
|
#endif
|
|
|
|
#ifndef ENOPROTOOPT
|
|
|
|
# define ENOPROTOOPT WSAENOPROTOOPT
|
|
|
|
#endif
|
|
|
|
#ifndef EPROTONOSUPPORT
|
|
|
|
# define EPROTONOSUPPORT WSAEPROTONOSUPPORT
|
|
|
|
#endif
|
|
|
|
#ifndef ESOCKTNOSUPPORT
|
|
|
|
# define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
|
|
|
|
#endif
|
|
|
|
#ifndef EOPNOTSUPP
|
|
|
|
# define EOPNOTSUPP WSAEOPNOTSUPP
|
|
|
|
#endif
|
|
|
|
#ifndef EPFNOSUPPORT
|
|
|
|
# define EPFNOSUPPORT WSAEPFNOSUPPORT
|
|
|
|
#endif
|
|
|
|
#ifndef EAFNOSUPPORT
|
|
|
|
# define EAFNOSUPPORT WSAEAFNOSUPPORT
|
|
|
|
#endif
|
|
|
|
#ifndef EADDRINUSE
|
|
|
|
# define EADDRINUSE WSAEADDRINUSE
|
|
|
|
#endif
|
|
|
|
#ifndef EADDRNOTAVAIL
|
|
|
|
# define EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
|
|
|
#endif
|
|
|
|
#ifndef ENETDOWN
|
|
|
|
# define ENETDOWN WSAENETDOWN
|
|
|
|
#endif
|
|
|
|
#ifndef ENETUNREACH
|
|
|
|
# define ENETUNREACH WSAENETUNREACH
|
|
|
|
#endif
|
|
|
|
#ifndef ENETRESET
|
|
|
|
# define ENETRESET WSAENETRESET
|
|
|
|
#endif
|
|
|
|
#ifndef ECONNABORTED
|
|
|
|
# define ECONNABORTED WSAECONNABORTED
|
|
|
|
#endif
|
|
|
|
#ifndef ECONNRESET
|
|
|
|
# define ECONNRESET WSAECONNRESET
|
|
|
|
#endif
|
|
|
|
#ifndef ENOBUFS
|
|
|
|
# define ENOBUFS WSAENOBUFS
|
|
|
|
#endif
|
|
|
|
#ifndef EISCONN
|
|
|
|
# define EISCONN WSAEISCONN
|
|
|
|
#endif
|
|
|
|
#ifndef ENOTCONN
|
|
|
|
# define ENOTCONN WSAENOTCONN
|
|
|
|
#endif
|
|
|
|
#ifndef ESHUTDOWN
|
|
|
|
# define ESHUTDOWN WSAESHUTDOWN
|
|
|
|
#endif
|
|
|
|
#ifndef ETOOMANYREFS
|
|
|
|
# define ETOOMANYREFS WSAETOOMANYREFS
|
|
|
|
#endif
|
|
|
|
#ifndef ETIMEDOUT
|
|
|
|
# define ETIMEDOUT WSAETIMEDOUT
|
|
|
|
#endif
|
|
|
|
#ifndef ECONNREFUSED
|
|
|
|
# define ECONNREFUSED WSAECONNREFUSED
|
|
|
|
#endif
|
|
|
|
#ifndef ELOOP
|
|
|
|
# define ELOOP WSAELOOP
|
|
|
|
#endif
|
* win32/win32.c (map_errno): support winsock error.
* win32/win32.c (pipe_exec, CreateChild, poll_child_status, waitpid,
kill, link, rb_w32_rename, unixtime_to_filetime, rb_w32_utime):
pass errno to map_errno().
* win32/win32.c (rb_w32_select, rb_w32_accept, rb_w32_bind,
rb_w32_connect, rb_w32_getpeername, rb_w32_getsockname,
rb_w32_getsockopt, rb_w32_ioctlsocket, rb_w32_listen, rb_w32_recv,
rb_w32_recvfrom, rb_w32_send, rb_w32_sendto, rb_w32_setsockopt,
rb_w32_shutdown, rb_w32_socket, rb_w32_gethostbyaddr,
rb_w32_gethostbyname, rb_w32_gethostname, rb_w32_getprotobyname,
rb_w32_getprotobynumber, rb_w32_getservbyname, rb_w32_getservbyport,
rb_w32_fclose, rb_w32_close): use map_errno().
* win32/win32.h: add winsock errors.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-26 16:17:18 -04:00
|
|
|
/*#define ENAMETOOLONG WSAENAMETOOLONG*/
|
2010-04-06 01:58:07 -04:00
|
|
|
#ifndef EHOSTDOWN
|
|
|
|
# define EHOSTDOWN WSAEHOSTDOWN
|
|
|
|
#endif
|
|
|
|
#ifndef EHOSTUNREACH
|
|
|
|
# define EHOSTUNREACH WSAEHOSTUNREACH
|
|
|
|
#endif
|
* win32/win32.c (map_errno): support winsock error.
* win32/win32.c (pipe_exec, CreateChild, poll_child_status, waitpid,
kill, link, rb_w32_rename, unixtime_to_filetime, rb_w32_utime):
pass errno to map_errno().
* win32/win32.c (rb_w32_select, rb_w32_accept, rb_w32_bind,
rb_w32_connect, rb_w32_getpeername, rb_w32_getsockname,
rb_w32_getsockopt, rb_w32_ioctlsocket, rb_w32_listen, rb_w32_recv,
rb_w32_recvfrom, rb_w32_send, rb_w32_sendto, rb_w32_setsockopt,
rb_w32_shutdown, rb_w32_socket, rb_w32_gethostbyaddr,
rb_w32_gethostbyname, rb_w32_gethostname, rb_w32_getprotobyname,
rb_w32_getprotobynumber, rb_w32_getservbyname, rb_w32_getservbyport,
rb_w32_fclose, rb_w32_close): use map_errno().
* win32/win32.h: add winsock errors.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-26 16:17:18 -04:00
|
|
|
/*#define ENOTEMPTY WSAENOTEMPTY*/
|
2010-04-06 01:58:07 -04:00
|
|
|
#ifndef EPROCLIM
|
|
|
|
# define EPROCLIM WSAEPROCLIM
|
|
|
|
#endif
|
|
|
|
#ifndef EUSERS
|
|
|
|
# define EUSERS WSAEUSERS
|
|
|
|
#endif
|
|
|
|
#ifndef EDQUOT
|
|
|
|
# define EDQUOT WSAEDQUOT
|
|
|
|
#endif
|
|
|
|
#ifndef ESTALE
|
|
|
|
# define ESTALE WSAESTALE
|
|
|
|
#endif
|
|
|
|
#ifndef EREMOTE
|
|
|
|
# define EREMOTE WSAEREMOTE
|
|
|
|
#endif
|
* win32/win32.c (map_errno): support winsock error.
* win32/win32.c (pipe_exec, CreateChild, poll_child_status, waitpid,
kill, link, rb_w32_rename, unixtime_to_filetime, rb_w32_utime):
pass errno to map_errno().
* win32/win32.c (rb_w32_select, rb_w32_accept, rb_w32_bind,
rb_w32_connect, rb_w32_getpeername, rb_w32_getsockname,
rb_w32_getsockopt, rb_w32_ioctlsocket, rb_w32_listen, rb_w32_recv,
rb_w32_recvfrom, rb_w32_send, rb_w32_sendto, rb_w32_setsockopt,
rb_w32_shutdown, rb_w32_socket, rb_w32_gethostbyaddr,
rb_w32_gethostbyname, rb_w32_gethostname, rb_w32_getprotobyname,
rb_w32_getprotobynumber, rb_w32_getservbyname, rb_w32_getservbyport,
rb_w32_fclose, rb_w32_close): use map_errno().
* win32/win32.h: add winsock errors.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-26 16:17:18 -04:00
|
|
|
|
2011-10-31 00:16:11 -04:00
|
|
|
#define F_DUPFD 0
|
2012-06-13 00:39:25 -04:00
|
|
|
#define F_GETFD 1
|
|
|
|
#define F_SETFD 2
|
2015-09-12 01:23:22 -04:00
|
|
|
#if 0
|
2012-06-13 00:39:25 -04:00
|
|
|
#define F_GETFL 3
|
|
|
|
#endif
|
2011-10-31 00:16:11 -04:00
|
|
|
#define F_SETFL 4
|
2015-09-12 01:23:22 -04:00
|
|
|
#define F_DUPFD_CLOEXEC 67
|
2012-06-13 00:39:25 -04:00
|
|
|
#define FD_CLOEXEC 1 /* F_GETFD, F_SETFD */
|
2004-09-06 23:52:15 -04:00
|
|
|
#define O_NONBLOCK 1
|
|
|
|
|
1999-08-13 01:45:20 -04:00
|
|
|
#undef FD_SET
|
2012-05-08 08:47:25 -04:00
|
|
|
#define FD_SET(fd, set) do {\
|
|
|
|
unsigned int i;\
|
|
|
|
SOCKET s = _get_osfhandle(fd);\
|
|
|
|
\
|
|
|
|
for (i = 0; i < (set)->fd_count; i++) {\
|
|
|
|
if ((set)->fd_array[i] == s) {\
|
|
|
|
break;\
|
|
|
|
}\
|
|
|
|
}\
|
|
|
|
if (i == (set)->fd_count) {\
|
|
|
|
if ((set)->fd_count < FD_SETSIZE) {\
|
|
|
|
(set)->fd_array[i] = s;\
|
|
|
|
(set)->fd_count++;\
|
|
|
|
}\
|
|
|
|
}\
|
|
|
|
} while(0)
|
1999-08-13 01:45:20 -04:00
|
|
|
|
2000-06-28 04:31:35 -04:00
|
|
|
#undef FD_CLR
|
2003-07-28 23:17:13 -04:00
|
|
|
#define FD_CLR(f, s) rb_w32_fdclr(f, s)
|
2000-06-28 04:31:35 -04:00
|
|
|
|
1999-08-13 01:45:20 -04:00
|
|
|
#undef FD_ISSET
|
2003-07-28 23:17:13 -04:00
|
|
|
#define FD_ISSET(f, s) rb_w32_fdisset(f, s)
|
1999-08-13 01:45:20 -04:00
|
|
|
|
2011-12-05 00:29:31 -05:00
|
|
|
#ifdef RUBY_EXPORT
|
|
|
|
#undef inet_ntop
|
|
|
|
#define inet_ntop(f,a,n,l) rb_w32_inet_ntop(f,a,n,l)
|
|
|
|
|
2014-02-22 21:54:04 -05:00
|
|
|
#undef inet_pton
|
|
|
|
#define inet_pton(f,s,d) rb_w32_inet_pton(f,s,d)
|
|
|
|
|
2011-12-05 00:29:31 -05:00
|
|
|
#undef accept
|
|
|
|
#define accept(s, a, l) rb_w32_accept(s, a, l)
|
|
|
|
|
|
|
|
#undef bind
|
|
|
|
#define bind(s, a, l) rb_w32_bind(s, a, l)
|
|
|
|
|
|
|
|
#undef connect
|
|
|
|
#define connect(s, a, l) rb_w32_connect(s, a, l)
|
|
|
|
|
|
|
|
#undef select
|
|
|
|
#define select(n, r, w, e, t) rb_w32_select(n, r, w, e, t)
|
|
|
|
|
|
|
|
#undef getpeername
|
|
|
|
#define getpeername(s, a, l) rb_w32_getpeername(s, a, l)
|
|
|
|
|
|
|
|
#undef getsockname
|
|
|
|
#define getsockname(s, a, l) rb_w32_getsockname(s, a, l)
|
|
|
|
|
|
|
|
#undef getsockopt
|
|
|
|
#define getsockopt(s, v, n, o, l) rb_w32_getsockopt(s, v, n, o, l)
|
|
|
|
|
|
|
|
#undef ioctlsocket
|
|
|
|
#define ioctlsocket(s, c, a) rb_w32_ioctlsocket(s, c, a)
|
|
|
|
|
|
|
|
#undef listen
|
|
|
|
#define listen(s, b) rb_w32_listen(s, b)
|
|
|
|
|
|
|
|
#undef recv
|
|
|
|
#define recv(s, b, l, f) rb_w32_recv(s, b, l, f)
|
|
|
|
|
|
|
|
#undef recvfrom
|
|
|
|
#define recvfrom(s, b, l, f, fr, frl) rb_w32_recvfrom(s, b, l, f, fr, frl)
|
|
|
|
|
|
|
|
#undef send
|
|
|
|
#define send(s, b, l, f) rb_w32_send(s, b, l, f)
|
|
|
|
|
|
|
|
#undef sendto
|
|
|
|
#define sendto(s, b, l, f, t, tl) rb_w32_sendto(s, b, l, f, t, tl)
|
|
|
|
|
|
|
|
#undef setsockopt
|
|
|
|
#define setsockopt(s, v, n, o, l) rb_w32_setsockopt(s, v, n, o, l)
|
|
|
|
|
2022-01-19 02:40:06 -05:00
|
|
|
#undef HAVE_SHUTDOWN
|
|
|
|
#define HAVE_SHUTDOWN 1
|
2011-12-05 00:29:31 -05:00
|
|
|
#undef shutdown
|
|
|
|
#define shutdown(s, h) rb_w32_shutdown(s, h)
|
|
|
|
|
|
|
|
#undef socket
|
|
|
|
#define socket(s, t, p) rb_w32_socket(s, t, p)
|
|
|
|
|
|
|
|
#undef gethostbyaddr
|
|
|
|
#define gethostbyaddr(a, l, t) rb_w32_gethostbyaddr(a, l, t)
|
|
|
|
|
|
|
|
#undef gethostbyname
|
|
|
|
#define gethostbyname(n) rb_w32_gethostbyname(n)
|
|
|
|
|
|
|
|
#undef gethostname
|
|
|
|
#define gethostname(n, l) rb_w32_gethostname(n, l)
|
|
|
|
|
|
|
|
#undef getprotobyname
|
|
|
|
#define getprotobyname(n) rb_w32_getprotobyname(n)
|
|
|
|
|
|
|
|
#undef getprotobynumber
|
|
|
|
#define getprotobynumber(n) rb_w32_getprotobynumber(n)
|
|
|
|
|
|
|
|
#undef getservbyname
|
|
|
|
#define getservbyname(n, p) rb_w32_getservbyname(n, p)
|
|
|
|
|
|
|
|
#undef getservbyport
|
|
|
|
#define getservbyport(p, pr) rb_w32_getservbyport(p, pr)
|
|
|
|
|
|
|
|
#undef get_osfhandle
|
|
|
|
#define get_osfhandle(h) rb_w32_get_osfhandle(h)
|
|
|
|
|
|
|
|
#undef getcwd
|
2020-12-19 12:16:31 -05:00
|
|
|
#define getcwd(b, s) rb_w32_ugetcwd(b, s)
|
2011-12-05 00:29:31 -05:00
|
|
|
|
|
|
|
#undef getenv
|
2020-12-07 12:00:39 -05:00
|
|
|
#define getenv(n) rb_w32_ugetenv(n)
|
2011-12-05 00:29:31 -05:00
|
|
|
|
|
|
|
#undef rename
|
2020-12-19 12:16:31 -05:00
|
|
|
#define rename(o, n) rb_w32_urename(o, n)
|
2011-12-05 00:29:31 -05:00
|
|
|
|
|
|
|
#undef times
|
|
|
|
#define times(t) rb_w32_times(t)
|
2013-11-28 02:15:56 -05:00
|
|
|
|
|
|
|
#undef dup2
|
|
|
|
#define dup2(o, n) rb_w32_dup2(o, n)
|
2011-12-05 00:29:31 -05:00
|
|
|
#endif
|
|
|
|
|
2000-08-15 02:22:49 -04:00
|
|
|
struct tms {
|
|
|
|
long tms_utime;
|
|
|
|
long tms_stime;
|
|
|
|
long tms_cutime;
|
|
|
|
long tms_cstime;
|
|
|
|
};
|
|
|
|
|
2003-07-28 23:17:13 -04:00
|
|
|
int rb_w32_times(struct tms *);
|
2000-08-15 02:22:49 -04:00
|
|
|
|
2012-04-16 03:22:43 -04:00
|
|
|
struct tm *gmtime_r(const time_t *, struct tm *);
|
|
|
|
struct tm *localtime_r(const time_t *, struct tm *);
|
|
|
|
|
2000-09-27 05:11:13 -04:00
|
|
|
/* thread stuff */
|
2002-05-29 06:22:19 -04:00
|
|
|
int rb_w32_sleep(unsigned long msec);
|
* merge some patches from win32-uncode-test branch.
see #1685.
* file.c, include/ruby/intern.h (rb_str_encode_ospath): new function
to convert encoding for pathname.
* win32.c, include/ruby/win32.h (rb_w32_ulink, rb_w32_urename,
rb_w32_ustati64, rb_w32_uopen, rb_w32_uutime, rb_w32_uchdir,
rb_w32_umkdir, rb_w32_urmdir, rb_w32_uunlink): new functions to
accept UTF-8 path.
* win32/win32.c (rb_w32_opendir, link, rb_w32_stati64, rb_w32_utime,
rb_w32_unlink): use WCHAR path internally.
* file.c (rb_stat, eaccess, access_internal, rb_file_s_ftype,
chmod_internal, rb_file_chmod, rb_file_chown, utime_internal,
rb_file_s_link, unlink_internal, rb_file_s_rename): use UTF-8 version
functions on Win32.
* file.c (apply2files, rb_stat, rb_file_s_lstat, rb_file_symlink_p,
rb_file_readable_p, rb_file_writable_p, rb_file_executable_p,
check3rdbyte, rb_file_identical_p, rb_file_chmod, rb_file_chown,
rb_file_s_link, rb_file_s_symlink, rb_file_s_rename): call
rb_str_encode_ospath() before passing the path to system.
* io.c (rb_sysopen): ditto.
* dir.c (dir_chdir, dir_s_mkdir, dir_s_rmdir): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 13:56:23 -04:00
|
|
|
int rb_w32_uopen(const char *, int, ...);
|
|
|
|
int rb_w32_wopen(const WCHAR *, int, ...);
|
2002-10-10 17:07:16 -04:00
|
|
|
int rb_w32_close(int);
|
|
|
|
int rb_w32_fclose(FILE*);
|
2008-08-28 08:46:58 -04:00
|
|
|
int rb_w32_pipe(int[2]);
|
2011-07-09 02:59:23 -04:00
|
|
|
ssize_t rb_w32_read(int, void *, size_t);
|
|
|
|
ssize_t rb_w32_write(int, const void *, size_t);
|
2022-09-05 07:23:27 -04:00
|
|
|
rb_off_t rb_w32_lseek(int, rb_off_t, int);
|
* merge some patches from win32-uncode-test branch.
see #1685.
* file.c, include/ruby/intern.h (rb_str_encode_ospath): new function
to convert encoding for pathname.
* win32.c, include/ruby/win32.h (rb_w32_ulink, rb_w32_urename,
rb_w32_ustati64, rb_w32_uopen, rb_w32_uutime, rb_w32_uchdir,
rb_w32_umkdir, rb_w32_urmdir, rb_w32_uunlink): new functions to
accept UTF-8 path.
* win32/win32.c (rb_w32_opendir, link, rb_w32_stati64, rb_w32_utime,
rb_w32_unlink): use WCHAR path internally.
* file.c (rb_stat, eaccess, access_internal, rb_file_s_ftype,
chmod_internal, rb_file_chmod, rb_file_chown, utime_internal,
rb_file_s_link, unlink_internal, rb_file_s_rename): use UTF-8 version
functions on Win32.
* file.c (apply2files, rb_stat, rb_file_s_lstat, rb_file_symlink_p,
rb_file_readable_p, rb_file_writable_p, rb_file_executable_p,
check3rdbyte, rb_file_identical_p, rb_file_chmod, rb_file_chown,
rb_file_s_link, rb_file_s_symlink, rb_file_s_rename): call
rb_str_encode_ospath() before passing the path to system.
* io.c (rb_sysopen): ditto.
* dir.c (dir_chdir, dir_s_mkdir, dir_s_rmdir): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 13:56:23 -04:00
|
|
|
int rb_w32_uutime(const char *, const struct utimbuf *);
|
2017-12-04 05:48:30 -05:00
|
|
|
int rb_w32_uutimes(const char *, const struct timeval *);
|
|
|
|
int rb_w32_uutimensat(int /* must be AT_FDCWD */, const char *, const struct timespec *, int /* must be 0 */);
|
2010-11-29 00:20:08 -05:00
|
|
|
long rb_w32_write_console(uintptr_t, int); /* use uintptr_t instead of VALUE because it's not defined yet here */
|
2005-11-04 23:43:46 -05:00
|
|
|
int WINAPI rb_w32_Sleep(unsigned long msec);
|
2008-06-01 15:55:25 -04:00
|
|
|
int rb_w32_wait_events_blocking(HANDLE *events, int num, DWORD timeout);
|
2011-04-29 08:12:52 -04:00
|
|
|
int rb_w32_time_subtract(struct timeval *rest, const struct timeval *wait);
|
2012-06-06 00:29:38 -04:00
|
|
|
int rb_w32_wrap_io_handle(HANDLE, int);
|
|
|
|
int rb_w32_unwrap_io_handle(int);
|
2014-04-05 19:51:27 -04:00
|
|
|
WCHAR *rb_w32_mbstr_to_wstr(UINT, const char *, int, long *);
|
|
|
|
char *rb_w32_wstr_to_mbstr(UINT, const WCHAR *, int, long *);
|
2000-11-14 02:10:31 -05:00
|
|
|
|
2020-12-19 12:20:27 -05:00
|
|
|
DEPRECATED_BY(rb_w32_ugetcwd, char *rb_w32_getcwd(char *, int));
|
|
|
|
DEPRECATED_BY(rb_w32_ugetenv, char *rb_w32_getenv(const char *));
|
|
|
|
DEPRECATED_BY(rb_w32_urename, int rb_w32_rename(const char *, const char *));
|
|
|
|
DEPRECATED_BY(rb_w32_uopen, int rb_w32_open(const char *, int, ...));
|
|
|
|
DEPRECATED_BY(rb_w32_uchown, int chown(const char *, int, int));
|
|
|
|
DEPRECATED_BY(rb_w32_ulink, int link(const char *, const char *));
|
|
|
|
DEPRECATED_BY(rb_w32_ureadlink, ssize_t readlink(const char *, char *, size_t));
|
|
|
|
DEPRECATED_BY(rb_w32_usymlink, int symlink(const char *src, const char *link));
|
|
|
|
DEPRECATED_BY(rb_w32_umkdir, int rb_w32_mkdir(const char *, int));
|
|
|
|
DEPRECATED_BY(rb_w32_urmdir, int rb_w32_rmdir(const char *));
|
|
|
|
DEPRECATED_BY(rb_w32_uunlink, int rb_w32_unlink(const char *));
|
|
|
|
DEPRECATED_BY(rb_w32_uutime, int rb_w32_utime(const char *, const struct utimbuf *));
|
|
|
|
DEPRECATED_BY(rb_w32_uutimes, int rb_w32_utimes(const char *, const struct timeval *));
|
|
|
|
DEPRECATED_BY(rb_w32_uutimensat, int rb_w32_utimensat(int, const char *, const struct timespec *, int));
|
|
|
|
DEPRECATED_BY(rb_w32_ustati128, int rb_w32_stati128(const char *, struct stati128 *));
|
|
|
|
DEPRECATED_BY(rb_w32_ulstati128, int rb_w32_lstati128(const char *, struct stati128 *));
|
|
|
|
DEPRECATED_BY(rb_w32_uaccess, int rb_w32_access(const char *, int));
|
|
|
|
DEPRECATED_BY(rb_w32_uspawn, rb_pid_t rb_w32_spawn(int, const char *, const char*));
|
|
|
|
DEPRECATED_BY(rb_w32_uaspawn, rb_pid_t rb_w32_aspawn(int, const char *, char *const *));
|
|
|
|
DEPRECATED_BY(rb_w32_uaspawn_flags, rb_pid_t rb_w32_aspawn_flags(int, const char *, char *const *, DWORD));
|
|
|
|
|
2000-11-14 02:10:31 -05:00
|
|
|
/*
|
|
|
|
== ***CAUTION***
|
|
|
|
Since this function is very dangerous, ((*NEVER*))
|
|
|
|
* lock any HANDLEs(i.e. Mutex, Semaphore, CriticalSection and so on) or,
|
* include/ruby/intern.h,
include/ruby/io.h,
include/ruby/ruby.h,
include/ruby/win32.h,
include/ruby/backward/rubysig.h,
bignum.c,
gc.c,
io.c,
process.c,
safe.c,
struct.c,
thread.c,
ext/socket/rubysocket.h,
ext/-test-/old_thread_select: Remove deprecated definitions
[ruby-core:60581] [Feature #9502]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-14 10:16:31 -05:00
|
|
|
* use anything like rb_thread_call_without_gvl,
|
2000-11-14 02:10:31 -05:00
|
|
|
in asynchronous_func_t.
|
|
|
|
*/
|
2007-06-27 07:47:53 -04:00
|
|
|
typedef uintptr_t (*asynchronous_func_t)(uintptr_t self, int argc, uintptr_t* argv);
|
|
|
|
uintptr_t rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self, int argc, uintptr_t* argv, uintptr_t intrval);
|
2000-09-27 05:11:13 -04:00
|
|
|
|
2013-04-05 06:29:38 -04:00
|
|
|
RUBY_SYMBOL_EXPORT_END
|
2010-07-21 17:38:25 -04:00
|
|
|
|
2017-03-02 23:51:34 -05:00
|
|
|
#if (defined(__MINGW64_VERSION_MAJOR) || defined(__MINGW64__)) && !defined(__cplusplus)
|
|
|
|
#ifdef RUBY_MINGW64_BROKEN_FREXP_MODF
|
2011-08-05 09:20:26 -04:00
|
|
|
/* License: Ruby's */
|
2011-04-14 08:21:09 -04:00
|
|
|
/* get rid of bugs in math.h of mingw */
|
|
|
|
#define frexp(_X, _Y) __extension__ ({\
|
2011-04-26 12:14:26 -04:00
|
|
|
int intpart_frexp_bug = intpart_frexp_bug;\
|
|
|
|
double result_frexp_bug = frexp((_X), &intpart_frexp_bug);\
|
|
|
|
*(_Y) = intpart_frexp_bug;\
|
|
|
|
result_frexp_bug;\
|
2011-04-14 08:21:09 -04:00
|
|
|
})
|
2011-08-05 09:20:26 -04:00
|
|
|
/* License: Ruby's */
|
2011-04-14 08:21:09 -04:00
|
|
|
#define modf(_X, _Y) __extension__ ({\
|
2011-04-26 12:14:26 -04:00
|
|
|
double intpart_modf_bug = intpart_modf_bug;\
|
|
|
|
double result_modf_bug = modf((_X), &intpart_modf_bug);\
|
|
|
|
*(_Y) = intpart_modf_bug;\
|
|
|
|
result_modf_bug;\
|
2011-04-14 08:21:09 -04:00
|
|
|
})
|
|
|
|
#endif
|
|
|
|
|
2012-10-12 09:30:17 -04:00
|
|
|
#if defined(__MINGW64__)
|
2012-07-24 11:12:26 -04:00
|
|
|
/*
|
|
|
|
* Use powl() instead of broken pow() of x86_64-w64-mingw32.
|
|
|
|
* This workaround will fix test failures in test_bignum.rb,
|
|
|
|
* test_fixnum.rb and test_float.rb etc.
|
|
|
|
*/
|
|
|
|
static inline double
|
|
|
|
rb_w32_pow(double x, double y)
|
|
|
|
{
|
2017-04-20 20:11:56 -04:00
|
|
|
return (double)powl(x, y);
|
2012-07-24 11:12:26 -04:00
|
|
|
}
|
2012-10-12 09:30:17 -04:00
|
|
|
#elif defined(__MINGW64_VERSION_MAJOR)
|
2013-07-08 10:13:13 -04:00
|
|
|
double rb_w32_pow(double x, double y);
|
2012-10-12 09:30:17 -04:00
|
|
|
#endif
|
2012-07-24 11:12:26 -04:00
|
|
|
#define pow rb_w32_pow
|
|
|
|
#endif
|
|
|
|
|
2021-12-27 01:56:23 -05:00
|
|
|
// mmap tiny emulation
|
|
|
|
#define MAP_FAILED ((void *)-1)
|
|
|
|
|
|
|
|
#define PROT_READ 0x01
|
|
|
|
#define PROT_WRITE 0x02
|
|
|
|
#define PROT_EXEC 0x04
|
|
|
|
|
|
|
|
#define MAP_PRIVATE 0x0002
|
|
|
|
#define MAP_ANON 0x1000
|
|
|
|
#define MAP_ANONYMOUS MAP_ANON
|
|
|
|
|
2022-09-05 07:23:27 -04:00
|
|
|
extern void *rb_w32_mmap(void *, size_t, int, int, int, rb_off_t);
|
2021-12-27 01:56:23 -05:00
|
|
|
extern int rb_w32_munmap(void *, size_t);
|
|
|
|
extern int rb_w32_mprotect(void *, size_t, int);
|
|
|
|
|
|
|
|
#define mmap(a, l, p, f, d, o) rb_w32_mmap(a, l, p, f, d, o)
|
2021-12-27 02:38:29 -05:00
|
|
|
#define munmap(a, l) rb_w32_munmap(a, l)
|
2021-12-27 03:15:09 -05:00
|
|
|
#define mprotect(a, l, prot) rb_w32_mprotect(a, l, prot)
|
2021-12-27 01:56:23 -05:00
|
|
|
|
2017-03-02 23:51:34 -05:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
#if 0
|
|
|
|
{ /* satisfy cc-mode */
|
|
|
|
#endif
|
|
|
|
} /* extern "C" { */
|
|
|
|
#endif
|
|
|
|
|
2007-06-09 23:06:15 -04:00
|
|
|
#endif /* RUBY_WIN32_H */
|