include/ruby/win32.h

Go to the documentation of this file.
00001 #ifndef RUBY_WIN32_H
00002 #define RUBY_WIN32_H 1
00003 
00004 #if defined(__cplusplus)
00005 extern "C" {
00006 #if 0
00007 } /* satisfy cc-mode */
00008 #endif
00009 #endif
00010 
00011 /*
00012  *  Copyright (c) 1993, Intergraph Corporation
00013  *
00014  *  You may distribute under the terms of either the GNU General Public
00015  *  License or the Artistic License, as specified in the perl README file.
00016  *
00017  */
00018 
00019 //
00020 // Definitions for NT port of Perl
00021 //
00022 
00023 
00024 //
00025 // Ok now we can include the normal include files.
00026 //
00027 
00028 // #include <stdarg.h> conflict with varargs.h?
00029 #if !defined(WSAAPI)
00030 #if defined(__cplusplus) && defined(_MSC_VER)
00031 extern "C++" {                  /* template without extern "C++" */
00032 #endif
00033 #include <winsock2.h>
00034 #include <ws2tcpip.h>
00035 #if defined(__cplusplus) && defined(_MSC_VER)
00036 }
00037 #endif
00038 #endif
00039 
00040 #define NT 1                    /* deprecated */
00041 
00042 //
00043 // We're not using Microsoft's "extensions" to C for
00044 // Structured Exception Handling (SEH) so we can nuke these
00045 //
00046 #undef try
00047 #undef except
00048 #undef finally
00049 #undef leave
00050 
00051 #include <stdio.h>
00052 #include <stdlib.h>
00053 #include <string.h>
00054 #include <direct.h>
00055 #include <process.h>
00056 #include <time.h>
00057 #if defined(__cplusplus) && defined(_MSC_VER) && _MSC_VER == 1200
00058 extern "C++" {                  /* template without extern "C++" */
00059 #endif
00060 #include <math.h>
00061 #if defined(__cplusplus) && defined(_MSC_VER) && _MSC_VER == 1200
00062 }
00063 #endif
00064 #include <signal.h>
00065 #include <sys/stat.h>
00066 #include <sys/types.h>
00067 #ifdef HAVE_SYS_UTIME_H
00068 # include <sys/utime.h>
00069 #else
00070 # include <utime.h>
00071 #endif
00072 #include <io.h>
00073 #include <malloc.h>
00074 #if defined __MINGW32__ || __BORLANDC__ >= 0x0580
00075 # include <stdint.h>
00076 #else
00077 # if !defined(_INTPTR_T_DEFINED)
00078 #  ifdef _WIN64
00079 typedef __int64 intptr_t;
00080 #  else
00081 typedef int intptr_t;
00082 #  endif
00083 #  define _INTPTR_T_DEFINED
00084 # endif
00085 # if !defined(_UINTPTR_T_DEFINED)
00086 #  ifdef _WIN64
00087 typedef unsigned __int64 uintptr_t;
00088 #  else
00089 typedef unsigned int uintptr_t;
00090 #  endif
00091 #  define _UINTPTR_T_DEFINED
00092 # endif
00093 #endif
00094 #ifndef __MINGW32__
00095 # define mode_t int
00096 #endif
00097 
00098 #ifdef WIN95
00099 extern DWORD rb_w32_osid(void);
00100 #define rb_w32_iswinnt()  (rb_w32_osid() == VER_PLATFORM_WIN32_NT)
00101 #define rb_w32_iswin95()  (rb_w32_osid() == VER_PLATFORM_WIN32_WINDOWS)
00102 #else
00103 #define rb_w32_iswinnt()  TRUE
00104 #define rb_w32_iswin95()  FALSE
00105 #endif
00106 
00107 #define WNOHANG -1
00108 
00109 #undef getc
00110 #undef putc
00111 #undef fgetc
00112 #undef fputc
00113 #undef getchar
00114 #undef putchar
00115 #undef fgetchar
00116 #undef fputchar
00117 #undef utime
00118 #undef lseek
00119 #undef fstat
00120 #define getc(_stream)           rb_w32_getc(_stream)
00121 #define getchar()               rb_w32_getc(stdin)
00122 #define putc(_c, _stream)       rb_w32_putc(_c, _stream)
00123 #define putchar(_c)             rb_w32_putc(_c, stdout)
00124 #ifdef RUBY_EXPORT
00125 #define fgetc(_stream)          getc(_stream)
00126 #define fputc(_c, _stream)      putc(_c, _stream)
00127 #define fgetchar()              getchar()
00128 #define fputchar(_c)            putchar(_c)
00129 #define utime(_p, _t)           rb_w32_utime(_p, _t)
00130 #define lseek(_f, _o, _w)       _lseeki64(_f, _o, _w)
00131 
00132 #define pipe(p)                 rb_w32_pipe(p)
00133 #define open                    rb_w32_open
00134 #define close(h)                rb_w32_close(h)
00135 #define fclose(f)               rb_w32_fclose(f)
00136 #define read(f, b, s)           rb_w32_read(f, b, s)
00137 #define write(f, b, s)          rb_w32_write(f, b, s)
00138 #define getpid()                rb_w32_getpid()
00139 #define getppid()               rb_w32_getppid()
00140 #define sleep(x)                rb_w32_Sleep((x)*1000)
00141 #define Sleep(msec)             (void)rb_w32_Sleep(msec)
00142 #ifdef __BORLANDC__
00143 #define creat(p, m)             _creat(p, m)
00144 #define eof()                   _eof()
00145 #define filelength(h)           _filelength(h)
00146 #define mktemp(t)               _mktemp(t)
00147 #define tell(h)                 _tell(h)
00148 #define _open                   _sopen
00149 #define sopen                   _sopen
00150 #define _fstati64(fd,st)        rb_w32_fstati64(fd,st)
00151 #undef fopen
00152 #define fopen(p, m)             rb_w32_fopen(p, m)
00153 #undef fdopen
00154 #define fdopen(h, m)            rb_w32_fdopen(h, m)
00155 #undef fsopen
00156 #define fsopen(p, m, sh)        rb_w32_fsopen(p, m, sh)
00157 #endif /* __BORLANDC__ */
00158 
00159 #undef execv
00160 #define execv(path,argv)        rb_w32_aspawn(P_OVERLAY,path,argv)
00161 #if !defined(__BORLANDC__)
00162 #undef isatty
00163 #define isatty(h)               rb_w32_isatty(h)
00164 #endif /* __BORLANDC__ */
00165 
00166 #undef mkdir
00167 #define mkdir(p, m)             rb_w32_mkdir(p, m)
00168 #undef rmdir
00169 #define rmdir(p)                rb_w32_rmdir(p)
00170 #undef unlink
00171 #define unlink(p)               rb_w32_unlink(p)
00172 #endif /* RUBY_EXPORT */
00173 
00174 #if SIZEOF_OFF_T == 8
00175 #define off_t __int64
00176 #define stat stati64
00177 #define fstat(fd,st)            _fstati64(fd,st)
00178 #if defined(__BORLANDC__)
00179 #define stati64(path, st) rb_w32_stati64(path, st)
00180 #elif !defined(_MSC_VER) || RT_VER < 80
00181 #define stati64 _stati64
00182 #define _stati64(path, st) rb_w32_stati64(path, st)
00183 #else
00184 #define stati64 _stat64
00185 #define _stat64(path, st) rb_w32_stati64(path, st)
00186 #define _fstati64 _fstat64
00187 #endif
00188 #else
00189 #define stat(path,st)           rb_w32_stat(path,st)
00190 #define fstat(fd,st)            rb_w32_fstat(fd,st)
00191 extern int rb_w32_stat(const char *, struct stat *);
00192 extern int rb_w32_fstat(int, struct stat *);
00193 #endif
00194 #define access(path,mode)       rb_w32_access(path,mode)
00195 
00196 #define strcasecmp              _stricmp
00197 #define strncasecmp             _strnicmp
00198 #define fsync                   _commit
00199 
00200 struct timezone;
00201 
00202 #ifdef __MINGW32__
00203 #undef isascii
00204 #define isascii __isascii
00205 #endif
00206 
00207 struct iovec {
00208     void *iov_base;
00209     size_t iov_len;
00210 };
00211 struct msghdr {
00212     void *msg_name;
00213     int msg_namelen;
00214     struct iovec *msg_iov;
00215     int msg_iovlen;
00216     void *msg_control;
00217     int msg_controllen;
00218     int msg_flags;
00219 };
00220 
00221 #define NtInitialize ruby_sysinit
00222 extern int    rb_w32_cmdvector(const char *, char ***);
00223 extern rb_pid_t  rb_w32_pipe_exec(const char *, const char *, int, int *, int *);
00224 extern int    flock(int fd, int oper);
00225 extern int    rb_w32_has_cancel_io(void);
00226 extern int    rb_w32_is_socket(int);
00227 extern int    WSAAPI rb_w32_accept(int, struct sockaddr *, int *);
00228 extern int    WSAAPI rb_w32_bind(int, const struct sockaddr *, int);
00229 extern int    WSAAPI rb_w32_connect(int, const struct sockaddr *, int);
00230 extern void   rb_w32_fdset(int, fd_set*);
00231 extern void   rb_w32_fdclr(int, fd_set*);
00232 extern int    rb_w32_fdisset(int, fd_set*);
00233 extern int    WSAAPI rb_w32_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
00234 extern int    WSAAPI rb_w32_getpeername(int, struct sockaddr *, int *);
00235 extern int    WSAAPI rb_w32_getsockname(int, struct sockaddr *, int *);
00236 extern int    WSAAPI rb_w32_getsockopt(int, int, int, char *, int *);
00237 extern int    WSAAPI rb_w32_ioctlsocket(int, long, u_long *);
00238 extern int    WSAAPI rb_w32_listen(int, int);
00239 extern int    WSAAPI rb_w32_recv(int, char *, int, int);
00240 extern int    WSAAPI rb_w32_recvfrom(int, char *, int, int, struct sockaddr *, int *);
00241 extern int    WSAAPI rb_w32_send(int, const char *, int, int);
00242 extern int    WSAAPI rb_w32_sendto(int, const char *, int, int, const struct sockaddr *, int);
00243 extern int    recvmsg(int, struct msghdr *, int);
00244 extern int    sendmsg(int, const struct msghdr *, int);
00245 extern int    WSAAPI rb_w32_setsockopt(int, int, int, const char *, int);
00246 extern int    WSAAPI rb_w32_shutdown(int, int);
00247 extern int    WSAAPI rb_w32_socket(int, int, int);
00248 extern SOCKET rb_w32_get_osfhandle(int);
00249 extern struct hostent *WSAAPI rb_w32_gethostbyaddr(const char *, int, int);
00250 extern struct hostent *WSAAPI rb_w32_gethostbyname(const char *);
00251 extern int    WSAAPI rb_w32_gethostname(char *, int);
00252 extern struct protoent *WSAAPI rb_w32_getprotobyname(const char *);
00253 extern struct protoent *WSAAPI rb_w32_getprotobynumber(int);
00254 extern struct servent  *WSAAPI rb_w32_getservbyname(const char *, const char *);
00255 extern struct servent  *WSAAPI rb_w32_getservbyport(int, const char *);
00256 extern int    rb_w32_socketpair(int, int, int, int *);
00257 extern char * rb_w32_getcwd(char *, int);
00258 extern char * rb_w32_getenv(const char *);
00259 extern int    rb_w32_rename(const char *, const char *);
00260 extern int    rb_w32_urename(const char *, const char *);
00261 extern char **rb_w32_get_environ(void);
00262 extern void   rb_w32_free_environ(char **);
00263 extern int    rb_w32_map_errno(DWORD);
00264 
00265 extern int chown(const char *, int, int);
00266 extern int rb_w32_uchown(const char *, int, int);
00267 extern int link(const char *, const char *);
00268 extern int rb_w32_ulink(const char *, const char *);
00269 extern int gettimeofday(struct timeval *, struct timezone *);
00270 extern rb_pid_t waitpid (rb_pid_t, int *, int);
00271 extern rb_pid_t rb_w32_spawn(int, const char *, const char*);
00272 extern rb_pid_t rb_w32_aspawn(int, const char *, char *const *);
00273 extern int kill(int, int);
00274 extern int fcntl(int, int, ...);
00275 extern rb_pid_t rb_w32_getpid(void);
00276 extern rb_pid_t rb_w32_getppid(void);
00277 #if !defined(__BORLANDC__)
00278 extern int rb_w32_isatty(int);
00279 #endif
00280 extern int rb_w32_uchdir(const char *);
00281 extern int rb_w32_mkdir(const char *, int);
00282 extern int rb_w32_umkdir(const char *, int);
00283 extern int rb_w32_rmdir(const char *);
00284 extern int rb_w32_urmdir(const char *);
00285 extern int rb_w32_unlink(const char *);
00286 extern int rb_w32_uunlink(const char *);
00287 extern int rb_w32_uchmod(const char *, int);
00288 extern int rb_w32_stati64(const char *, struct stati64 *);
00289 extern int rb_w32_ustati64(const char *, struct stati64 *);
00290 extern int rb_w32_access(const char *, int);
00291 extern int rb_w32_uaccess(const char *, int);
00292 
00293 #ifdef __BORLANDC__
00294 extern int rb_w32_fstati64(int, struct stati64 *);
00295 extern off_t _lseeki64(int, off_t, int);
00296 extern FILE *rb_w32_fopen(const char *, const char *);
00297 extern FILE *rb_w32_fdopen(int, const char *);
00298 extern FILE *rb_w32_fsopen(const char *, const char *, int);
00299 #endif
00300 
00301 #include <float.h>
00302 #if !defined __MINGW32__ || defined __NO_ISOCEXT
00303 #ifndef isnan
00304 #define isnan(x) _isnan(x)
00305 #endif
00306 static inline int
00307 finite(double x)
00308 {
00309     return _finite(x);
00310 }
00311 #ifndef copysign
00312 #define copysign(a, b) _copysign(a, b)
00313 #endif
00314 static inline double
00315 scalb(double a, long b)
00316 {
00317     return _scalb(a, b);
00318 }
00319 #endif
00320 
00321 #if !defined S_IFIFO && defined _S_IFIFO
00322 #define S_IFIFO _S_IFIFO
00323 #endif
00324 
00325 #if 0 && defined __BORLANDC__
00326 #undef S_ISDIR
00327 #undef S_ISFIFO
00328 #undef S_ISBLK
00329 #undef S_ISCHR
00330 #undef S_ISREG
00331 #define S_ISDIR(m)  (((unsigned short)(m) & S_IFMT) == S_IFDIR)
00332 #define S_ISFIFO(m) (((unsigned short)(m) & S_IFMT) == S_IFIFO)
00333 #define S_ISBLK(m)  (((unsigned short)(m) & S_IFMT) == S_IFBLK)
00334 #define S_ISCHR(m)  (((unsigned short)(m) & S_IFMT) == S_IFCHR)
00335 #define S_ISREG(m)  (((unsigned short)(m) & S_IFMT) == S_IFREG)
00336 #endif
00337 
00338 #if !defined S_IRUSR && !defined __MINGW32__
00339 #define S_IRUSR 0400
00340 #endif
00341 #ifndef S_IRGRP
00342 #define S_IRGRP 0040
00343 #endif
00344 #ifndef S_IROTH
00345 #define S_IROTH 0004
00346 #endif
00347 
00348 #if !defined S_IWUSR && !defined __MINGW32__
00349 #define S_IWUSR 0200
00350 #endif
00351 #ifndef S_IWGRP
00352 #define S_IWGRP 0020
00353 #endif
00354 #ifndef S_IWOTH
00355 #define S_IWOTH 0002
00356 #endif
00357 
00358 #if !defined S_IXUSR && !defined __MINGW32__
00359 #define S_IXUSR 0100
00360 #endif
00361 #ifndef S_IXGRP
00362 #define S_IXGRP 0010
00363 #endif
00364 #ifndef S_IXOTH
00365 #define S_IXOTH 0001
00366 #endif
00367 
00368 //
00369 // define this so we can do inplace editing
00370 //
00371 
00372 #define SUFFIX
00373 #define ftruncate rb_w32_ftruncate
00374 extern int       truncate(const char *path, off_t length);
00375 extern int       ftruncate(int fd, off_t length);
00376 extern int       fseeko(FILE *stream, off_t offset, int whence);
00377 extern off_t     ftello(FILE *stream);
00378 
00379 //
00380 // stubs
00381 //
00382 extern int       ioctl (int, int, ...);
00383 extern rb_uid_t  getuid (void);
00384 extern rb_uid_t  geteuid (void);
00385 extern rb_gid_t  getgid (void);
00386 extern rb_gid_t  getegid (void);
00387 extern int       setuid (rb_uid_t);
00388 extern int       setgid (rb_gid_t);
00389 
00390 extern char *rb_w32_strerror(int);
00391 
00392 #ifdef RUBY_EXPORT
00393 #define strerror(e) rb_w32_strerror(e)
00394 #endif
00395 
00396 #define PIPE_BUF 1024
00397 
00398 #define LOCK_SH 1
00399 #define LOCK_EX 2
00400 #define LOCK_NB 4
00401 #define LOCK_UN 8
00402 
00403 
00404 #ifndef SIGINT
00405 #define SIGINT 2
00406 #endif
00407 #ifndef SIGKILL
00408 #define SIGKILL 9
00409 #endif
00410 
00411 
00412 /* #undef va_start */
00413 /* #undef va_end */
00414 
00415 /* winsock error map */
00416 #include <errno.h>
00417 
00418 #ifndef EWOULDBLOCK
00419 # define EWOULDBLOCK            WSAEWOULDBLOCK
00420 #endif
00421 #ifndef EINPROGRESS
00422 # define EINPROGRESS            WSAEINPROGRESS
00423 #endif
00424 #ifndef EALREADY
00425 # define EALREADY               WSAEALREADY
00426 #endif
00427 #ifndef ENOTSOCK
00428 # define ENOTSOCK               WSAENOTSOCK
00429 #endif
00430 #ifndef EDESTADDRREQ
00431 # define EDESTADDRREQ           WSAEDESTADDRREQ
00432 #endif
00433 #ifndef EMSGSIZE
00434 # define EMSGSIZE               WSAEMSGSIZE
00435 #endif
00436 #ifndef EPROTOTYPE
00437 # define EPROTOTYPE             WSAEPROTOTYPE
00438 #endif
00439 #ifndef ENOPROTOOPT
00440 # define ENOPROTOOPT            WSAENOPROTOOPT
00441 #endif
00442 #ifndef EPROTONOSUPPORT
00443 # define EPROTONOSUPPORT        WSAEPROTONOSUPPORT
00444 #endif
00445 #ifndef ESOCKTNOSUPPORT
00446 # define ESOCKTNOSUPPORT        WSAESOCKTNOSUPPORT
00447 #endif
00448 #ifndef EOPNOTSUPP
00449 # define EOPNOTSUPP             WSAEOPNOTSUPP
00450 #endif
00451 #ifndef EPFNOSUPPORT
00452 # define EPFNOSUPPORT           WSAEPFNOSUPPORT
00453 #endif
00454 #ifndef EAFNOSUPPORT
00455 # define EAFNOSUPPORT           WSAEAFNOSUPPORT
00456 #endif
00457 #ifndef EADDRINUSE
00458 # define EADDRINUSE             WSAEADDRINUSE
00459 #endif
00460 #ifndef EADDRNOTAVAIL
00461 # define EADDRNOTAVAIL          WSAEADDRNOTAVAIL
00462 #endif
00463 #ifndef ENETDOWN
00464 # define ENETDOWN               WSAENETDOWN
00465 #endif
00466 #ifndef ENETUNREACH
00467 # define ENETUNREACH            WSAENETUNREACH
00468 #endif
00469 #ifndef ENETRESET
00470 # define ENETRESET              WSAENETRESET
00471 #endif
00472 #ifndef ECONNABORTED
00473 # define ECONNABORTED           WSAECONNABORTED
00474 #endif
00475 #ifndef ECONNRESET
00476 # define ECONNRESET             WSAECONNRESET
00477 #endif
00478 #ifndef ENOBUFS
00479 # define ENOBUFS                WSAENOBUFS
00480 #endif
00481 #ifndef EISCONN
00482 # define EISCONN                WSAEISCONN
00483 #endif
00484 #ifndef ENOTCONN
00485 # define ENOTCONN               WSAENOTCONN
00486 #endif
00487 #ifndef ESHUTDOWN
00488 # define ESHUTDOWN              WSAESHUTDOWN
00489 #endif
00490 #ifndef ETOOMANYREFS
00491 # define ETOOMANYREFS           WSAETOOMANYREFS
00492 #endif
00493 #ifndef ETIMEDOUT
00494 # define ETIMEDOUT              WSAETIMEDOUT
00495 #endif
00496 #ifndef ECONNREFUSED
00497 # define ECONNREFUSED           WSAECONNREFUSED
00498 #endif
00499 #ifndef ELOOP
00500 # define ELOOP                  WSAELOOP
00501 #endif
00502 /*#define ENAMETOOLONG  WSAENAMETOOLONG*/
00503 #ifndef EHOSTDOWN
00504 # define EHOSTDOWN              WSAEHOSTDOWN
00505 #endif
00506 #ifndef EHOSTUNREACH
00507 # define EHOSTUNREACH           WSAEHOSTUNREACH
00508 #endif
00509 /*#define ENOTEMPTY     WSAENOTEMPTY*/
00510 #ifndef EPROCLIM
00511 # define EPROCLIM               WSAEPROCLIM
00512 #endif
00513 #ifndef EUSERS
00514 # define EUSERS                 WSAEUSERS
00515 #endif
00516 #ifndef EDQUOT
00517 # define EDQUOT                 WSAEDQUOT
00518 #endif
00519 #ifndef ESTALE
00520 # define ESTALE                 WSAESTALE
00521 #endif
00522 #ifndef EREMOTE
00523 # define EREMOTE                WSAEREMOTE
00524 #endif
00525 
00526 #define F_SETFL 1
00527 #define O_NONBLOCK 1
00528 
00529 #undef FD_SET
00530 #define FD_SET(f, s)            rb_w32_fdset(f, s)
00531 
00532 #undef FD_CLR
00533 #define FD_CLR(f, s)            rb_w32_fdclr(f, s)
00534 
00535 #undef FD_ISSET
00536 #define FD_ISSET(f, s)          rb_w32_fdisset(f, s)
00537 
00538 #ifdef RUBY_EXPORT
00539 #undef accept
00540 #define accept(s, a, l)         rb_w32_accept(s, a, l)
00541 
00542 #undef bind
00543 #define bind(s, a, l)           rb_w32_bind(s, a, l)
00544 
00545 #undef connect
00546 #define connect(s, a, l)        rb_w32_connect(s, a, l)
00547 
00548 #undef select
00549 #define select(n, r, w, e, t)   rb_w32_select(n, r, w, e, t)
00550 
00551 #undef getpeername
00552 #define getpeername(s, a, l)    rb_w32_getpeername(s, a, l)
00553 
00554 #undef getsockname
00555 #define getsockname(s, a, l)    rb_w32_getsockname(s, a, l)
00556 
00557 #undef getsockopt
00558 #define getsockopt(s, v, n, o, l) rb_w32_getsockopt(s, v, n, o, l)
00559 
00560 #undef ioctlsocket
00561 #define ioctlsocket(s, c, a)    rb_w32_ioctlsocket(s, c, a)
00562 
00563 #undef listen
00564 #define listen(s, b)            rb_w32_listen(s, b)
00565 
00566 #undef recv
00567 #define recv(s, b, l, f)        rb_w32_recv(s, b, l, f)
00568 
00569 #undef recvfrom
00570 #define recvfrom(s, b, l, f, fr, frl) rb_w32_recvfrom(s, b, l, f, fr, frl)
00571 
00572 #undef send
00573 #define send(s, b, l, f)        rb_w32_send(s, b, l, f)
00574 
00575 #undef sendto
00576 #define sendto(s, b, l, f, t, tl) rb_w32_sendto(s, b, l, f, t, tl)
00577 
00578 #undef setsockopt
00579 #define setsockopt(s, v, n, o, l) rb_w32_setsockopt(s, v, n, o, l)
00580 
00581 #undef shutdown
00582 #define shutdown(s, h)          rb_w32_shutdown(s, h)
00583 
00584 #undef socket
00585 #define socket(s, t, p)         rb_w32_socket(s, t, p)
00586 
00587 #undef gethostbyaddr
00588 #define gethostbyaddr(a, l, t)  rb_w32_gethostbyaddr(a, l, t)
00589 
00590 #undef gethostbyname
00591 #define gethostbyname(n)        rb_w32_gethostbyname(n)
00592 
00593 #undef gethostname
00594 #define gethostname(n, l)       rb_w32_gethostname(n, l)
00595 
00596 #undef getprotobyname
00597 #define getprotobyname(n)       rb_w32_getprotobyname(n)
00598 
00599 #undef getprotobynumber
00600 #define getprotobynumber(n)     rb_w32_getprotobynumber(n)
00601 
00602 #undef getservbyname
00603 #define getservbyname(n, p)     rb_w32_getservbyname(n, p)
00604 
00605 #undef getservbyport
00606 #define getservbyport(p, pr)    rb_w32_getservbyport(p, pr)
00607 
00608 #undef socketpair
00609 #define socketpair(a, t, p, s)  rb_w32_socketpair(a, t, p, s)
00610 
00611 #undef get_osfhandle
00612 #define get_osfhandle(h)        rb_w32_get_osfhandle(h)
00613 
00614 #undef getcwd
00615 #define getcwd(b, s)            rb_w32_getcwd(b, s)
00616 
00617 #undef getenv
00618 #define getenv(n)               rb_w32_getenv(n)
00619 
00620 #undef rename
00621 #define rename(o, n)            rb_w32_rename(o, n)
00622 
00623 #undef times
00624 #define times(t)                rb_w32_times(t)
00625 #endif
00626 
00627 struct tms {
00628         long    tms_utime;
00629         long    tms_stime;
00630         long    tms_cutime;
00631         long    tms_cstime;
00632 };
00633 
00634 int rb_w32_times(struct tms *);
00635 
00636 /* thread stuff */
00637 HANDLE GetCurrentThreadHandle(void);
00638 int  rb_w32_sleep(unsigned long msec);
00639 int  rb_w32_putc(int, FILE*);
00640 int  rb_w32_getc(FILE*);
00641 int  rb_w32_open(const char *, int, ...);
00642 int  rb_w32_uopen(const char *, int, ...);
00643 int  rb_w32_wopen(const WCHAR *, int, ...);
00644 int  rb_w32_close(int);
00645 int  rb_w32_fclose(FILE*);
00646 int  rb_w32_pipe(int[2]);
00647 size_t rb_w32_read(int, void *, size_t);
00648 size_t rb_w32_write(int, const void *, size_t);
00649 int  rb_w32_utime(const char *, const struct utimbuf *);
00650 int  rb_w32_uutime(const char *, const struct utimbuf *);
00651 long rb_w32_write_console(unsigned long, int);
00652 int  WINAPI rb_w32_Sleep(unsigned long msec);
00653 int  rb_w32_wait_events_blocking(HANDLE *events, int num, DWORD timeout);
00654 
00655 /*
00656 == ***CAUTION***
00657 Since this function is very dangerous, ((*NEVER*))
00658 * lock any HANDLEs(i.e. Mutex, Semaphore, CriticalSection and so on) or,
00659 * use anything like TRAP_BEG...TRAP_END block structure,
00660 in asynchronous_func_t.
00661 */
00662 typedef uintptr_t (*asynchronous_func_t)(uintptr_t self, int argc, uintptr_t* argv);
00663 uintptr_t rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self, int argc, uintptr_t* argv, uintptr_t intrval);
00664 
00665 #if defined(__cplusplus)
00666 #if 0
00667 { /* satisfy cc-mode */
00668 #endif
00669 }  /* extern "C" { */
00670 #endif
00671 
00672 #endif /* RUBY_WIN32_H */
00673 

Generated on Wed Aug 10 09:17:07 2011 for Ruby by  doxygen 1.4.7