2002-10-10 17:07:16 -04:00
|
|
|
#ifndef RUBY_WIN32_H
|
|
|
|
#define RUBY_WIN32_H
|
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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
//
|
|
|
|
// Definitions for NT port of Perl
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Ok now we can include the normal include files.
|
|
|
|
//
|
|
|
|
|
|
|
|
// #include <stdarg.h> conflict with varargs.h?
|
2005-11-04 23:43:46 -05:00
|
|
|
#if !defined(WSAAPI)
|
2005-02-09 23:55:34 -05:00
|
|
|
#include <winsock2.h>
|
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
|
|
|
|
|
|
|
#define NT 1 /* deprecated */
|
|
|
|
|
|
|
|
#ifdef _WIN32_WCE
|
|
|
|
#undef CharNext
|
|
|
|
#define CharNext CharNextA
|
|
|
|
#endif
|
|
|
|
|
1999-01-19 23:45:32 -05:00
|
|
|
//
|
2001-11-14 13:41:46 -05:00
|
|
|
// We're not using Microsoft's "extensions" to C for
|
1999-01-19 23:45:32 -05:00
|
|
|
// Structured Exception Handling (SEH) so we can nuke these
|
|
|
|
//
|
|
|
|
#undef try
|
|
|
|
#undef except
|
|
|
|
#undef finally
|
|
|
|
#undef leave
|
1999-08-13 01:45:20 -04:00
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
2000-01-04 23:41:21 -05:00
|
|
|
extern "C++" {
|
1999-08-13 01:45:20 -04:00
|
|
|
#endif
|
|
|
|
|
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>
|
|
|
|
#include <math.h>
|
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>
|
1999-01-19 23:45:32 -05:00
|
|
|
|
1999-08-13 01:45:20 -04:00
|
|
|
#if defined(__cplusplus)
|
2000-01-04 23:41:21 -05:00
|
|
|
}
|
1999-08-13 01:45:20 -04:00
|
|
|
#endif
|
|
|
|
|
2005-11-22 11:26:39 -05:00
|
|
|
#ifdef _M_IX86
|
|
|
|
# define WIN95 1
|
|
|
|
#else
|
|
|
|
# undef WIN95
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef WIN95
|
|
|
|
extern DWORD rb_w32_osid(void);
|
|
|
|
#define rb_w32_iswinnt() (rb_w32_osid() == VER_PLATFORM_WIN32_NT)
|
|
|
|
#define rb_w32_iswin95() (rb_w32_osid() == VER_PLATFORM_WIN32_WINDOWS)
|
|
|
|
#else
|
|
|
|
#define rb_w32_iswinnt() TRUE
|
|
|
|
#define rb_w32_iswin95() FALSE
|
|
|
|
#endif
|
|
|
|
|
1999-08-13 01:45:20 -04:00
|
|
|
#define WNOHANG -1
|
1999-01-19 23:45:32 -05:00
|
|
|
|
2001-02-17 10:17:10 -05:00
|
|
|
#undef getc
|
|
|
|
#undef putc
|
|
|
|
#undef fgetc
|
|
|
|
#undef fputc
|
|
|
|
#undef getchar
|
|
|
|
#undef putchar
|
|
|
|
#undef fgetchar
|
|
|
|
#undef fputchar
|
2003-02-17 00:17:46 -05:00
|
|
|
#undef utime
|
2006-08-12 02:56:09 -04:00
|
|
|
#undef lseek
|
|
|
|
#undef fstat
|
2002-05-29 06:22:19 -04:00
|
|
|
#define getc(_stream) rb_w32_getc(_stream)
|
2005-11-04 23:43:46 -05:00
|
|
|
#define getchar() rb_w32_getc(stdin)
|
2002-05-29 06:22:19 -04:00
|
|
|
#define putc(_c, _stream) rb_w32_putc(_c, _stream)
|
2005-11-04 23:43:46 -05:00
|
|
|
#define putchar(_c) rb_w32_putc(_c, stdout)
|
|
|
|
#ifdef RUBY_EXPORT
|
2001-02-17 10:17:10 -05:00
|
|
|
#define fgetc(_stream) getc(_stream)
|
|
|
|
#define fputc(_c, _stream) putc(_c, _stream)
|
2002-10-10 17:07:16 -04:00
|
|
|
#define fgetchar() getchar()
|
|
|
|
#define fputchar(_c) putchar(_c)
|
2003-02-17 00:17:46 -05:00
|
|
|
#define utime(_p, _t) rb_w32_utime(_p, _t)
|
2006-08-12 02:56:09 -04:00
|
|
|
#define lseek(_f, _o, _w) _lseeki64(_f, _o, _w)
|
2001-02-17 10:17:10 -05:00
|
|
|
|
2005-09-14 10:30:37 -04:00
|
|
|
#define pipe(p) _pipe(p, 2048L, O_BINARY)
|
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()
|
2005-11-04 23:43:46 -05:00
|
|
|
#define sleep(x) rb_w32_Sleep((x)*1000)
|
|
|
|
#define Sleep(msec) (void)rb_w32_Sleep(msec)
|
2006-08-12 02:56:09 -04:00
|
|
|
#define fstat(fd,st) _fstati64(fd,st)
|
2003-01-04 13:17:30 -05:00
|
|
|
#ifdef __BORLANDC__
|
2003-07-28 23:17:13 -04:00
|
|
|
#define creat(p, m) _creat(p, m)
|
|
|
|
#define eof() _eof()
|
|
|
|
#define filelength(h) _filelength(h)
|
|
|
|
#define mktemp(t) _mktemp(t)
|
|
|
|
#define tell(h) _tell(h)
|
|
|
|
#define _open _sopen
|
|
|
|
#define sopen _sopen
|
2006-08-12 02:56:09 -04:00
|
|
|
#define _fstati64(fd,st) rb_w32_fstati64(fd,st)
|
2004-07-24 22:25:25 -04:00
|
|
|
#undef fopen
|
|
|
|
#define fopen(p, m) rb_w32_fopen(p, m)
|
|
|
|
#undef fdopen
|
|
|
|
#define fdopen(h, m) rb_w32_fdopen(h, m)
|
|
|
|
#undef fsopen
|
|
|
|
#define fsopen(p, m, sh) rb_w32_fsopen(p, m, sh)
|
2003-07-28 23:17:13 -04:00
|
|
|
#endif
|
2004-11-18 06:52:46 -05:00
|
|
|
|
2003-12-09 23:00:07 -05:00
|
|
|
#undef execv
|
2004-02-16 01:45:32 -05:00
|
|
|
#define execv(path,argv) rb_w32_aspawn(P_OVERLAY,path,argv)
|
2005-01-05 03:00:50 -05:00
|
|
|
#if !defined(__BORLANDC__) && !defined(_WIN32_WCE)
|
2004-11-18 06:52:46 -05:00
|
|
|
#undef isatty
|
|
|
|
#define isatty(h) rb_w32_isatty(h)
|
2005-01-05 03:00:50 -05:00
|
|
|
#endif
|
1999-01-19 23:45:32 -05:00
|
|
|
|
2004-12-06 23:45:46 -05:00
|
|
|
#undef mkdir
|
|
|
|
#define mkdir(p, m) rb_w32_mkdir(p, m)
|
|
|
|
#undef rmdir
|
|
|
|
#define rmdir(p) rb_w32_rmdir(p)
|
2005-06-20 04:17:53 -04:00
|
|
|
#undef unlink
|
|
|
|
#define unlink(p) rb_w32_unlink(p)
|
2005-11-04 23:43:46 -05:00
|
|
|
#endif
|
|
|
|
|
2006-08-12 02:56:09 -04:00
|
|
|
#if SIZEOF_OFF_T == 8
|
|
|
|
#define off_t __int64
|
|
|
|
#define stat stati64
|
|
|
|
#if defined(__BORLANDC__)
|
|
|
|
#define stati64(path, st) rb_w32_stati64(path, st)
|
|
|
|
#elif !defined(_MSC_VER) || _MSC_VER < 1400
|
|
|
|
#define stati64 _stati64
|
|
|
|
#define _stati64(path, st) rb_w32_stati64(path, st)
|
|
|
|
#else
|
|
|
|
#define stati64 _stat64
|
|
|
|
#define _stat64(path, st) rb_w32_stati64(path, st)
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define stat(path,st) rb_w32_stat(path,st)
|
|
|
|
#define fstat(fd,st) rb_w32_fstat(fd,st)
|
|
|
|
extern int rb_w32_stat(const char *, struct stat *);
|
|
|
|
extern int rb_w32_fstat(int, struct stat *);
|
|
|
|
#endif
|
|
|
|
|
2005-11-04 23:43:46 -05:00
|
|
|
#define strcasecmp(s1, s2) stricmp(s1, s2)
|
|
|
|
#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
|
|
|
|
#define fsync(h) _commit(h)
|
2004-12-06 23:45:46 -05:00
|
|
|
|
2000-05-13 12:13:31 -04:00
|
|
|
#ifdef __MINGW32__
|
|
|
|
struct timezone {
|
|
|
|
int tz_minuteswest;
|
|
|
|
int tz_dsttime;
|
|
|
|
};
|
2006-06-27 03:21:31 -04:00
|
|
|
#undef isascii
|
|
|
|
#define isascii __isascii
|
2000-05-13 12:13:31 -04:00
|
|
|
#endif
|
2002-05-29 06:22:19 -04:00
|
|
|
extern void NtInitialize(int *, char ***);
|
2004-11-12 01:15:40 -05:00
|
|
|
extern int rb_w32_cmdvector(const char *, char ***);
|
2005-05-15 14:36:56 -04:00
|
|
|
extern rb_pid_t rb_w32_pipe_exec(const char *, const char *, int, int *);
|
2002-05-29 06:22:19 -04:00
|
|
|
extern int flock(int fd, int oper);
|
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);
|
|
|
|
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 *);
|
2004-12-07 10:47:59 -05:00
|
|
|
extern int rb_w32_socketpair(int, int, int, int *);
|
2002-05-29 06:22:19 -04:00
|
|
|
extern char * rb_w32_getenv(const char *);
|
|
|
|
extern int rb_w32_rename(const char *, const char *);
|
|
|
|
extern char **rb_w32_get_environ(void);
|
|
|
|
extern void rb_w32_free_environ(char **);
|
1999-08-13 01:45:20 -04:00
|
|
|
|
2005-08-02 21:21:20 -04:00
|
|
|
#define vsnprintf(s,n,f,l) rb_w32_vsnprintf(s,n,f,l)
|
|
|
|
#define snprintf rb_w32_snprintf
|
|
|
|
extern int rb_w32_vsnprintf(char *, size_t, const char *, va_list);
|
|
|
|
extern int rb_w32_snprintf(char *, size_t, const char *, ...);
|
|
|
|
|
1999-08-13 01:45:20 -04:00
|
|
|
extern int chown(const char *, int, int);
|
2004-02-11 23:35:30 -05:00
|
|
|
extern int link(const char *, const char *);
|
1999-08-13 01:45:20 -04:00
|
|
|
extern int gettimeofday(struct timeval *, struct timezone *);
|
2005-05-15 14:36:56 -04:00
|
|
|
extern rb_pid_t waitpid (rb_pid_t, int *, int);
|
2005-09-12 07:40:40 -04:00
|
|
|
extern int rb_w32_argv_size(char *const *);
|
|
|
|
extern char *rb_w32_join_argv(char *, char *const *);
|
* configure.in (pid_t, uid_t, gid_t): check if defined.
* intern.h, process.c, rubyio.h, ext/etc/etc.c, ext/pty/pty.c: use
rb_{pid,uid,gid}_t instead of plain int. [ruby-dev:30376]
* ext/etc/extconf.rb (PIDT2NUM, NUM2PIDT, UIDT2NUM, NUM2UIDT, GIDT2NUM,
NUM2GIDT): moved to configure.in.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-17 23:13:09 -05:00
|
|
|
extern rb_pid_t rb_w32_spawn(int, const char *, const char*);
|
|
|
|
extern rb_pid_t rb_w32_aspawn(int, const char *, char *const *);
|
1999-08-13 01:45:20 -04:00
|
|
|
extern int kill(int, int);
|
2004-09-06 23:52:15 -04:00
|
|
|
extern int fcntl(int, int, ...);
|
2005-05-15 14:36:56 -04:00
|
|
|
extern rb_pid_t rb_w32_getpid(void);
|
2005-01-05 03:00:50 -05:00
|
|
|
#if !defined(__BORLANDC__) && !defined(_WIN32_WCE)
|
2004-11-18 06:52:46 -05:00
|
|
|
extern int rb_w32_isatty(int);
|
2005-01-05 03:00:50 -05:00
|
|
|
#endif
|
2004-12-06 23:45:46 -05:00
|
|
|
extern int rb_w32_mkdir(const char *, int);
|
|
|
|
extern int rb_w32_rmdir(const char *);
|
2005-09-06 20:37:53 -04:00
|
|
|
extern int rb_w32_unlink(const char *);
|
2006-08-12 02:56:09 -04:00
|
|
|
extern int rb_w32_stati64(const char *, struct stati64 *);
|
2002-12-26 09:59:35 -05:00
|
|
|
|
2004-07-24 22:25:25 -04:00
|
|
|
#ifdef __BORLANDC__
|
2006-08-12 02:56:09 -04:00
|
|
|
extern int rb_w32_fstati64(int, struct stati64 *);
|
|
|
|
extern off_t _lseeki64(int, off_t, int);
|
2004-07-24 22:25:25 -04:00
|
|
|
extern FILE *rb_w32_fopen(const char *, const char *);
|
2005-02-09 22:07:24 -05:00
|
|
|
extern FILE *rb_w32_fdopen(int, const char *);
|
2004-07-24 22:25:25 -04:00
|
|
|
extern FILE *rb_w32_fsopen(const char *, const char *, int);
|
|
|
|
#endif
|
|
|
|
|
2002-06-10 21:27:48 -04:00
|
|
|
#include <float.h>
|
2003-04-21 08:26:08 -04:00
|
|
|
#if !defined __MINGW32__ || defined __NO_ISOCEXT
|
2002-06-10 21:27:48 -04:00
|
|
|
#ifndef isnan
|
2003-04-21 08:26:08 -04:00
|
|
|
#define isnan(x) _isnan(x)
|
2002-06-10 21:27:48 -04:00
|
|
|
#endif
|
2003-04-21 08:26:08 -04:00
|
|
|
#ifndef finite
|
|
|
|
#define finite(x) _finite(x)
|
2002-06-10 21:27:48 -04:00
|
|
|
#endif
|
2005-07-01 02:52:37 -04:00
|
|
|
#ifndef copysign
|
|
|
|
#define copysign(a, b) _copysign(a, b)
|
|
|
|
#endif
|
|
|
|
#ifndef scalb
|
|
|
|
#define scalb(a, b) _scalb(a, b)
|
|
|
|
#endif
|
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
|
|
|
|
|
2004-01-19 07:28:14 -05:00
|
|
|
#if 0 && defined __BORLANDC__
|
2003-04-21 08:26:08 -04:00
|
|
|
#undef S_ISDIR
|
|
|
|
#undef S_ISFIFO
|
|
|
|
#undef S_ISBLK
|
2002-06-10 21:27:48 -04:00
|
|
|
#undef S_ISCHR
|
|
|
|
#undef S_ISREG
|
|
|
|
#define S_ISDIR(m) (((unsigned short)(m) & S_IFMT) == S_IFDIR)
|
|
|
|
#define S_ISFIFO(m) (((unsigned short)(m) & S_IFMT) == S_IFIFO)
|
|
|
|
#define S_ISBLK(m) (((unsigned short)(m) & S_IFMT) == S_IFBLK)
|
|
|
|
#define S_ISCHR(m) (((unsigned short)(m) & S_IFMT) == S_IFCHR)
|
|
|
|
#define S_ISREG(m) (((unsigned short)(m) & S_IFMT) == S_IFREG)
|
|
|
|
#endif
|
1999-01-19 23:45:32 -05:00
|
|
|
|
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
|
|
|
|
|
1999-01-19 23:45:32 -05:00
|
|
|
//
|
|
|
|
// define this so we can do inplace editing
|
|
|
|
//
|
|
|
|
|
|
|
|
#define SUFFIX
|
2006-08-12 02:56:09 -04:00
|
|
|
extern int truncate(const char *path, off_t length);
|
|
|
|
extern int ftruncate(int fd, off_t length);
|
|
|
|
extern int fseeko(FILE *stream, off_t offset, int whence);
|
|
|
|
extern off_t ftello(FILE *stream);
|
1999-01-19 23:45:32 -05: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 */
|
|
|
|
#define EWOULDBLOCK WSAEWOULDBLOCK
|
|
|
|
#define EINPROGRESS WSAEINPROGRESS
|
|
|
|
#define EALREADY WSAEALREADY
|
|
|
|
#define ENOTSOCK WSAENOTSOCK
|
|
|
|
#define EDESTADDRREQ WSAEDESTADDRREQ
|
|
|
|
#define EMSGSIZE WSAEMSGSIZE
|
|
|
|
#define EPROTOTYPE WSAEPROTOTYPE
|
|
|
|
#define ENOPROTOOPT WSAENOPROTOOPT
|
|
|
|
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
|
|
|
|
#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
|
|
|
|
#define EOPNOTSUPP WSAEOPNOTSUPP
|
|
|
|
#define EPFNOSUPPORT WSAEPFNOSUPPORT
|
|
|
|
#define EAFNOSUPPORT WSAEAFNOSUPPORT
|
|
|
|
#define EADDRINUSE WSAEADDRINUSE
|
|
|
|
#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
|
|
|
#define ENETDOWN WSAENETDOWN
|
|
|
|
#define ENETUNREACH WSAENETUNREACH
|
|
|
|
#define ENETRESET WSAENETRESET
|
|
|
|
#define ECONNABORTED WSAECONNABORTED
|
|
|
|
#define ECONNRESET WSAECONNRESET
|
|
|
|
#define ENOBUFS WSAENOBUFS
|
|
|
|
#define EISCONN WSAEISCONN
|
|
|
|
#define ENOTCONN WSAENOTCONN
|
|
|
|
#define ESHUTDOWN WSAESHUTDOWN
|
|
|
|
#define ETOOMANYREFS WSAETOOMANYREFS
|
|
|
|
#define ETIMEDOUT WSAETIMEDOUT
|
|
|
|
#define ECONNREFUSED WSAECONNREFUSED
|
|
|
|
#define ELOOP WSAELOOP
|
|
|
|
/*#define ENAMETOOLONG WSAENAMETOOLONG*/
|
|
|
|
#define EHOSTDOWN WSAEHOSTDOWN
|
|
|
|
#define EHOSTUNREACH WSAEHOSTUNREACH
|
|
|
|
/*#define ENOTEMPTY WSAENOTEMPTY*/
|
|
|
|
#define EPROCLIM WSAEPROCLIM
|
|
|
|
#define EUSERS WSAEUSERS
|
|
|
|
#define EDQUOT WSAEDQUOT
|
|
|
|
#define ESTALE WSAESTALE
|
|
|
|
#define EREMOTE WSAEREMOTE
|
|
|
|
|
2004-09-06 23:52:15 -04:00
|
|
|
#define F_SETFL 1
|
|
|
|
#define O_NONBLOCK 1
|
|
|
|
|
1999-08-13 01:45:20 -04:00
|
|
|
#undef FD_SET
|
2003-07-28 23:17:13 -04:00
|
|
|
#define FD_SET(f, s) rb_w32_fdset(f, s)
|
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
|
|
|
|
2005-11-04 23:43:46 -05:00
|
|
|
#ifdef RUBY_EXPORT
|
|
|
|
#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)
|
|
|
|
|
1999-08-13 01:45:20 -04:00
|
|
|
#undef select
|
2003-07-28 23:17:13 -04:00
|
|
|
#define select(n, r, w, e, t) rb_w32_select(n, r, w, e, t)
|
1999-08-13 01:45:20 -04:00
|
|
|
|
1999-01-19 23:45:32 -05:00
|
|
|
#undef getpeername
|
2003-07-28 23:17:13 -04:00
|
|
|
#define getpeername(s, a, l) rb_w32_getpeername(s, a, l)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef getsockname
|
2003-07-28 23:17:13 -04:00
|
|
|
#define getsockname(s, a, l) rb_w32_getsockname(s, a, l)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef getsockopt
|
2003-07-28 23:17:13 -04:00
|
|
|
#define getsockopt(s, v, n, o, l) rb_w32_getsockopt(s, v, n, o, l)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef ioctlsocket
|
2003-07-28 23:17:13 -04:00
|
|
|
#define ioctlsocket(s, c, a) rb_w32_ioctlsocket(s, c, a)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef listen
|
2003-07-28 23:17:13 -04:00
|
|
|
#define listen(s, b) rb_w32_listen(s, b)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef recv
|
2003-07-28 23:17:13 -04:00
|
|
|
#define recv(s, b, l, f) rb_w32_recv(s, b, l, f)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef recvfrom
|
2003-07-28 23:17:13 -04:00
|
|
|
#define recvfrom(s, b, l, f, fr, frl) rb_w32_recvfrom(s, b, l, f, fr, frl)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef send
|
2003-07-28 23:17:13 -04:00
|
|
|
#define send(s, b, l, f) rb_w32_send(s, b, l, f)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef sendto
|
2003-07-28 23:17:13 -04:00
|
|
|
#define sendto(s, b, l, f, t, tl) rb_w32_sendto(s, b, l, f, t, tl)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef setsockopt
|
2003-07-28 23:17:13 -04:00
|
|
|
#define setsockopt(s, v, n, o, l) rb_w32_setsockopt(s, v, n, o, l)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef shutdown
|
2003-07-28 23:17:13 -04:00
|
|
|
#define shutdown(s, h) rb_w32_shutdown(s, h)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef socket
|
2003-07-28 23:17:13 -04:00
|
|
|
#define socket(s, t, p) rb_w32_socket(s, t, p)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef gethostbyaddr
|
2003-07-28 23:17:13 -04:00
|
|
|
#define gethostbyaddr(a, l, t) rb_w32_gethostbyaddr(a, l, t)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef gethostbyname
|
2003-07-28 23:17:13 -04:00
|
|
|
#define gethostbyname(n) rb_w32_gethostbyname(n)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef gethostname
|
2003-07-28 23:17:13 -04:00
|
|
|
#define gethostname(n, l) rb_w32_gethostname(n, l)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef getprotobyname
|
2003-07-28 23:17:13 -04:00
|
|
|
#define getprotobyname(n) rb_w32_getprotobyname(n)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef getprotobynumber
|
2003-07-28 23:17:13 -04:00
|
|
|
#define getprotobynumber(n) rb_w32_getprotobynumber(n)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef getservbyname
|
2003-07-28 23:17:13 -04:00
|
|
|
#define getservbyname(n, p) rb_w32_getservbyname(n, p)
|
1999-01-19 23:45:32 -05:00
|
|
|
|
|
|
|
#undef getservbyport
|
2003-07-28 23:17:13 -04:00
|
|
|
#define getservbyport(p, pr) rb_w32_getservbyport(p, pr)
|
1999-08-13 01:45:20 -04:00
|
|
|
|
2004-12-07 10:47:59 -05:00
|
|
|
#undef socketpair
|
|
|
|
#define socketpair(a, t, p, s) rb_w32_socketpair(a, t, p, s)
|
|
|
|
|
1999-08-13 01:45:20 -04:00
|
|
|
#undef get_osfhandle
|
2003-07-28 23:17:13 -04:00
|
|
|
#define get_osfhandle(h) rb_w32_get_osfhandle(h)
|
1999-08-13 01:45:20 -04:00
|
|
|
|
2000-02-18 01:59:36 -05:00
|
|
|
#undef getcwd
|
2003-07-28 23:17:13 -04:00
|
|
|
#define getcwd(b, s) rb_w32_getcwd(b, s)
|
2000-02-18 01:59:36 -05:00
|
|
|
|
1999-08-13 01:45:20 -04:00
|
|
|
#undef getenv
|
2003-07-28 23:17:13 -04:00
|
|
|
#define getenv(n) rb_w32_getenv(n)
|
1999-08-13 01:45:20 -04:00
|
|
|
|
2000-08-09 00:26:06 -04:00
|
|
|
#undef rename
|
2003-07-28 23:17:13 -04:00
|
|
|
#define rename(o, n) rb_w32_rename(o, n)
|
2000-08-09 00:26:06 -04:00
|
|
|
|
2005-11-04 23:43:46 -05:00
|
|
|
#undef times
|
|
|
|
#define times(t) rb_w32_times(t)
|
|
|
|
#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
|
|
|
|
2000-09-27 05:11:13 -04:00
|
|
|
/* thread stuff */
|
|
|
|
HANDLE GetCurrentThreadHandle(void);
|
2002-05-29 06:22:19 -04:00
|
|
|
int rb_w32_sleep(unsigned long msec);
|
|
|
|
int rb_w32_putc(int, FILE*);
|
|
|
|
int rb_w32_getc(FILE*);
|
2002-10-10 17:07:16 -04:00
|
|
|
int rb_w32_close(int);
|
|
|
|
int rb_w32_fclose(FILE*);
|
2006-06-08 01:01:51 -04:00
|
|
|
size_t rb_w32_read(int, void *, size_t);
|
|
|
|
size_t rb_w32_write(int, const void *, size_t);
|
2005-09-06 20:37:53 -04:00
|
|
|
int rb_w32_utime(const char *, const struct utimbuf *);
|
2005-11-04 23:43:46 -05:00
|
|
|
int WINAPI rb_w32_Sleep(unsigned long msec);
|
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,
|
|
|
|
* use anything like TRAP_BEG...TRAP_END block structure,
|
|
|
|
in asynchronous_func_t.
|
|
|
|
*/
|
|
|
|
typedef DWORD (*asynchronous_func_t)(DWORD self, int argc, DWORD* argv);
|
2002-05-29 06:22:19 -04:00
|
|
|
DWORD rb_w32_asynchronize(asynchronous_func_t func, DWORD self, int argc, DWORD* argv, DWORD intrval);
|
2000-09-27 05:11:13 -04:00
|
|
|
|
1999-01-19 23:45:32 -05:00
|
|
|
#endif
|