|
Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
|
#include <winsock2.h>#include <ws2tcpip.h>#include <iphlpapi.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <direct.h>#include <process.h>#include <time.h>#include <math.h>#include <signal.h>#include <sys/stat.h>#include <sys/types.h>#include <utime.h>#include <io.h>#include <malloc.h>#include <float.h>#include <errno.h>Go to the source code of this file.
Data Structures | |
| struct | stati128 |
| struct | iovec |
| struct | msghdr |
| struct | ifaddrs |
| struct | tms |
Macros | |
| #define | WIN32 |
| #define | _INTPTR_T_DEFINED |
| #define | INTPTR_MAX 2147483647 |
| #define | INTPTR_MIN (-INTPTR_MAX-1) |
| #define | _UINTPTR_T_DEFINED |
| #define | UINTPTR_MAX 4294967295U |
| #define | mode_t int |
| #define | rb_w32_iswinnt() TRUE |
| #define | rb_w32_iswin95() FALSE |
| #define | WNOHANG -1 |
| #define | O_SHARE_DELETE 0x20000000 /* for rb_w32_open(), rb_w32_wopen() */ |
| #define | CLOCK_REALTIME 0 |
| #define | CLOCK_MONOTONIC 1 |
| #define | off_t __int64 |
| #define | stat stati128 |
| #define | SIZEOF_STRUCT_STAT_ST_INO sizeof(unsigned __int64) |
| #define | HAVE_STRUCT_STAT_ST_INOHIGH |
| #define | HAVE_STRUCT_STAT_ST_ATIMENSEC |
| #define | HAVE_STRUCT_STAT_ST_MTIMENSEC |
| #define | HAVE_STRUCT_STAT_ST_CTIMENSEC |
| #define | fstat(fd, st) rb_w32_fstati128(fd,st) |
| #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) |
| #define | strcasecmp _stricmp |
| #define | strncasecmp _strnicmp |
| #define | fsync _commit |
| #define | IFNAMSIZ 256 |
| #define | isnan(x) _isnan(x) |
| #define | copysign(a, b) _copysign(a, b) |
| #define | S_IRUSR 0400 |
| #define | S_IRGRP 0040 |
| #define | S_IROTH 0004 |
| #define | S_IWUSR 0200 |
| #define | S_IWGRP 0020 |
| #define | S_IWOTH 0002 |
| #define | S_IXUSR 0100 |
| #define | S_IXGRP 0010 |
| #define | S_IXOTH 0001 |
| #define | S_IFLNK 0xa000 |
| #define | SUFFIX |
| #define | HAVE_FTRUNCATE 1 |
| #define | ftruncate rb_w32_ftruncate |
| #define | HAVE_TRUNCATE 1 |
| #define | truncate rb_w32_utruncate |
| #define | PIPE_BUF 1024 |
| #define | LOCK_SH 1 |
| #define | LOCK_EX 2 |
| #define | LOCK_NB 4 |
| #define | LOCK_UN 8 |
| #define | SIGINT 2 |
| #define | SIGKILL 9 |
| #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 | EHOSTDOWN WSAEHOSTDOWN |
| #define | EHOSTUNREACH WSAEHOSTUNREACH |
| #define | EPROCLIM WSAEPROCLIM |
| #define | EUSERS WSAEUSERS |
| #define | EDQUOT WSAEDQUOT |
| #define | ESTALE WSAESTALE |
| #define | EREMOTE WSAEREMOTE |
| #define | F_DUPFD 0 |
| #define | F_GETFD 1 |
| #define | F_SETFD 2 |
| #define | F_SETFL 4 |
| #define | F_DUPFD_CLOEXEC 67 |
| #define | FD_CLOEXEC 1 /* F_GETFD, F_SETFD */ |
| #define | O_NONBLOCK 1 |
| #define | FD_SET(fd, set) |
| #define | FD_CLR(f, s) rb_w32_fdclr(f, s) |
| #define | FD_ISSET(f, s) rb_w32_fdisset(f, s) |
Typedefs | |
| typedef int | intptr_t |
| typedef unsigned int | uintptr_t |
| typedef int | clockid_t |
| typedef uintptr_t(* | asynchronous_func_t) (uintptr_t self, int argc, uintptr_t *argv) |
| #define access | ( | path, | |
| mode | |||
| ) | rb_w32_uaccess(path,mode) |
| #define FD_CLR | ( | f, | |
| s | |||
| ) | rb_w32_fdclr(f, s) |
| #define FD_ISSET | ( | f, | |
| s | |||
| ) | rb_w32_fdisset(f, s) |
| #define FD_SET | ( | fd, | |
| set | |||
| ) |
| #define fstat | ( | fd, | |
| st | |||
| ) | rb_w32_fstati128(fd,st) |
| #define ftruncate rb_w32_ftruncate |
| #define INTPTR_MIN (-INTPTR_MAX-1) |
| #define lstat | ( | path, | |
| st | |||
| ) | rb_w32_ulstati128(path,st) |
| #define O_SHARE_DELETE 0x20000000 /* for rb_w32_open(), rb_w32_wopen() */ |
| #define stati128 | ( | path, | |
| st | |||
| ) | rb_w32_ustati128(path,st) |
| #define truncate rb_w32_utruncate |
Definition at line 4819 of file win32.c.
Referenced by copymeta().
Definition at line 4708 of file win32.c.
References CLOCK_MONOTONIC, CLOCK_REALTIME, long(), map_errno, timespec::tv_nsec, and timespec::tv_sec.
Definition at line 4668 of file win32.c.
References CLOCK_MONOTONIC, CLOCK_REALTIME, count, map_errno, timespec::tv_nsec, and timespec::tv_sec.
Referenced by rb_timespec_now().
Definition at line 4338 of file win32.c.
References _osfile, F_DUPFD, F_DUPFD_CLOEXEC, F_GETFD, F_SETFD, F_SETFL, FD_CLOEXEC, FNOINHERIT, is_socket, L, map_errno, SIGNED_VALUE, and TO_SOCKET.
Referenced by dup2(), rb_cloexec_fcntl_dupfd(), rb_maygvl_fd_fix_cloexec(), rb_update_max_fd(), and rsock_make_fd_nonblock().
Definition at line 125 of file flock.c.
References NULL, and rb_w32_asynchronize().
| void freeifaddrs | ( | struct ifaddrs * | ifp | ) |
Definition at line 4232 of file win32.c.
References ifaddrs::ifa_addr, ifaddrs::ifa_name, ifaddrs::ifa_next, and ruby_xfree().
| rb_gid_t getegid | ( | void | ) |
Definition at line 2842 of file win32.c.
References ROOT_GID.
Referenced by eaccess(), and InitVM_process().
| rb_uid_t geteuid | ( | void | ) |
Definition at line 2828 of file win32.c.
References ROOT_UID.
Referenced by eaccess(), and InitVM_process().
| rb_gid_t getgid | ( | void | ) |
Definition at line 4145 of file win32.c.
References added, AF_UNSPEC, ifaddrs::ifa_addr, ifaddrs::ifa_flags, ifaddrs::ifa_name, ifaddrs::ifa_next, IFNAMSIZ, map_errno, memcpy, name, NULL, root, ruby_strdup(), ruby_xcalloc(), ruby_xfree(), and ruby_xmalloc().
Definition at line 4654 of file win32.c.
References timeval::tv_sec, and timeval::tv_usec.
Referenced by rb_timespec_now(), and rb_w32_select_with_thread().
| rb_uid_t getuid | ( | void | ) |
Definition at line 2821 of file win32.c.
References ROOT_UID.
Referenced by eaccess(), and rb_default_home_dir().
| struct tm * gmtime_r | ( | const time_t * | tp, |
| struct tm * | rp | ||
| ) |
Definition at line 4845 of file win32.c.
References err, FALSE, INVALID_HANDLE_VALUE, map_errno, NULL, RUBY_CRITICAL, SIGINT, and SIGKILL.
Referenced by rb_f_kill().
Definition at line 4987 of file win32.c.
References filecp_to_wstr, free, and NULL.
Referenced by rb_mark_end_proc(), rb_set_end_proc(), rb_w32_usymlink(), and symlink().
| struct tm * localtime_r | ( | const time_t * | tp, |
| struct tm * | rp | ||
| ) |
| uintptr_t rb_w32_asynchronize | ( | asynchronous_func_t | func, |
| uintptr_t | self, | ||
| int | argc, | ||
| uintptr_t * | argv, | ||
| uintptr_t | intrval | ||
| ) |
Definition at line 6042 of file win32.c.
References argc, asynchronous_arg_t::argc, argv, asynchronous_arg_t::argv, Debug, asynchronous_arg_t::errnum, FALSE, asynchronous_arg_t::func, NULL, rb_fatal(), rb_w32_wait_events_blocking(), RUBY_CRITICAL, asynchronous_arg_t::self, asynchronous_arg_t::stackaddr, TRUE, yield_once, and yield_until.
Referenced by flock().
Definition at line 3357 of file win32.c.
References map_errno, RUBY_CRITICAL, and TO_SOCKET.
Definition at line 6985 of file win32.c.
References _set_osfhnd, INVALID_HANDLE_VALUE, is_socket, LK_LEN, map_errno, NULL, and TO_SOCKET.
Referenced by rb_w32_pipe(), and socketpair().
Definition at line 3373 of file win32.c.
References EINPROGRESS, err, map_errno, RUBY_CRITICAL, and TO_SOCKET.
Definition at line 6199 of file win32.c.
References dup2(), and set_new_std_fd.
Definition at line 6454 of file win32.c.
References _set_osfhnd, fileno, INVALID_HANDLE_VALUE, is_socket, LK_LEN, map_errno, and TO_SOCKET.
| char rb_w32_fd_is_text | ( | int | fd | ) |
| void rb_w32_fdclr | ( | int | fd, |
| fd_set * | set | ||
| ) |
Definition at line 2901 of file win32.c.
References INVALID_HANDLE_VALUE, RUBY_CRITICAL, and TO_SOCKET.
| void rb_w32_fdset | ( | int | fd, |
| fd_set * | set | ||
| ) |
| void rb_w32_free_environ | ( | char ** | env | ) |
| char ** rb_w32_get_environ | ( | void | ) |
| SOCKET rb_w32_get_osfhandle | ( | int | fh | ) |
Definition at line 1115 of file win32.c.
Referenced by rb_w32_start_process().
| char * rb_w32_getcwd | ( | char * | buffer, |
| int | size | ||
| ) |
| struct hostent *WSAAPI rb_w32_gethostbyname | ( | const char * | name | ) |
Definition at line 3394 of file win32.c.
References map_errno, RUBY_CRITICAL, and TO_SOCKET.
| rb_pid_t rb_w32_getpid | ( | void | ) |
Definition at line 6152 of file win32.c.
Referenced by rb_w32_pipe().
| rb_pid_t rb_w32_getppid | ( | void | ) |
| struct protoent *WSAAPI rb_w32_getprotobyname | ( | const char * | name | ) |
| struct protoent *WSAAPI rb_w32_getprotobynumber | ( | int | num | ) |
Definition at line 3977 of file win32.c.
References map_errno, NULL, and RUBY_CRITICAL.
Definition at line 3409 of file win32.c.
References GET_FAMILY, map_errno, RUBY_CRITICAL, and TO_SOCKET.
Definition at line 3439 of file win32.c.
References map_errno, RUBY_CRITICAL, and TO_SOCKET.
Definition at line 3454 of file win32.c.
References map_errno, RUBY_CRITICAL, and TO_SOCKET.
Definition at line 3469 of file win32.c.
References map_errno, RUBY_CRITICAL, and TO_SOCKET.
Definition at line 7578 of file win32.c.
References filecp_to_wstr, free, and NULL.
Definition at line 6246 of file win32.c.
References filecp_to_wstr, free, and NULL.
| DWORD rb_w32_osid | ( | void | ) |
Definition at line 6477 of file win32.c.
References _set_osfhnd, _set_osflags, err, FALSE, FNOINHERIT, FOPEN, FPIPE, int(), INVALID_HANDLE_VALUE, map_errno, memcpy, name, NULL, prefix, rb_acrt_lowio_lock_fh, rb_acrt_lowio_unlock_fh, rb_w32_close(), rb_w32_getpid(), RUBY_CRITICAL, and snprintf.
| ssize_t rb_w32_read | ( | int | fd, |
| void * | buf, | ||
| size_t | size | ||
| ) |
Definition at line 7056 of file win32.c.
References _osfhnd, _osfile, _set_osflags, err, EWOULDBLOCK, FALSE, FEOFLAG, FPIPE, FTEXT, is_socket, len, map_errno, NULL, rb_acrt_lowio_lock_fh, rb_acrt_lowio_unlock_fh, rb_w32_recv(), rb_w32_wait_events_blocking(), read(), constat::state, TO_SOCKET, TRUE, and wait().
Definition at line 5389 of file win32.c.
References filecp_to_wstr, free, and NULL.
Definition at line 7613 of file win32.c.
References filecp_to_wstr, free, and NULL.
| int WSAAPI rb_w32_select | ( | int | nfds, |
| fd_set * | rd, | ||
| fd_set * | wr, | ||
| fd_set * | ex, | ||
| struct timeval * | timeout | ||
| ) |
Definition at line 3306 of file win32.c.
References rb_w32_select_with_thread().
Definition at line 4446 of file win32.c.
References rb_w32_set_nonblock2(), and TRUE.
Definition at line 3781 of file win32.c.
References map_errno, RUBY_CRITICAL, and TO_SOCKET.
Definition at line 3861 of file win32.c.
References MAKE_SOCKDATA, map_errno, O_BINARY, and RUBY_CRITICAL.
| char * rb_w32_strerror | ( | int | e | ) |
Definition at line 2762 of file win32.c.
References EADDRINUSE, err, EWOULDBLOCK, int(), memmove(), NULL, strerror(), strlcpy(), strlen(), sys_nerr, and winerr.
| void rb_w32_sysinit | ( | int * | argc, |
| char *** | argv | ||
| ) |
Definition at line 884 of file win32.c.
References argc, argv, and OnigEncodingUTF_8.
Referenced by ruby_sysinit().
Definition at line 3130 of file win32.c.
References timeval::tv_sec, timeval::tv_usec, and wait().
Referenced by rb_w32_select_with_thread().
Definition at line 5991 of file win32.c.
References tms::tms_cstime, tms::tms_cutime, tms::tms_stime, and tms::tms_utime.
Definition at line 1607 of file win32.c.
References argv, prog, and rb_w32_uaspawn_flags().
Definition at line 7530 of file win32.c.
References free, NULL, and utf8_to_wstr.
Definition at line 7699 of file win32.c.
References free, NULL, and utf8_to_wstr.
| char * rb_w32_ugetcwd | ( | char * | buffer, |
| int | size | ||
| ) |
| char * rb_w32_ugetenv | ( | const char * | name | ) |
Definition at line 4967 of file win32.c.
References free, NULL, and utf8_to_wstr.
Definition at line 7564 of file win32.c.
References free, NULL, and utf8_to_wstr.
Definition at line 7685 of file win32.c.
References filecp_to_wstr, free, and NULL.
Definition at line 7983 of file win32.c.
References _set_osfhnd, INVALID_HANDLE_VALUE, is_socket, LK_LEN, NULL, and TO_SOCKET.
Definition at line 6212 of file win32.c.
References free, NULL, and utf8_to_wstr.
| ssize_t rb_w32_ureadlink | ( | const char * | path, |
| char * | buf, | ||
| size_t | bufsize | ||
| ) |
Definition at line 5370 of file win32.c.
References free, NULL, and utf8_to_wstr.
Definition at line 7627 of file win32.c.
References free, NULL, and utf8_to_wstr.
Definition at line 7477 of file win32.c.
References utimbuf::actime, AT_FDCWD, filecp, utimbuf::modtime, timespec::tv_nsec, and timespec::tv_sec.
Definition at line 7503 of file win32.c.
References AT_FDCWD, filecp, timespec::tv_nsec, timeval::tv_sec, timespec::tv_sec, and timeval::tv_usec.
Definition at line 7671 of file win32.c.
References free, NULL, and utf8_to_wstr.
Definition at line 7464 of file win32.c.
References utimbuf::actime, AT_FDCWD, utimbuf::modtime, timespec::tv_nsec, and timespec::tv_sec.
Definition at line 7490 of file win32.c.
References AT_FDCWD, timespec::tv_nsec, timeval::tv_sec, timespec::tv_sec, and timeval::tv_usec.
Referenced by rb_w32_asynchronize(), rb_w32_read(), rb_w32_write(), and waitpid().
Definition at line 7961 of file win32.c.
References f, len, and O_NONBLOCK.
| ssize_t rb_w32_wreadlink | ( | const WCHAR * | , |
| WCHAR * | , | ||
| size_t | |||
| ) |
Definition at line 7195 of file win32.c.
References _osfhnd, _osfile, err, EWOULDBLOCK, FDEV, FEOFLAG, fileno, FPIPE, FTEXT, is_socket, len, map_errno, rb_acrt_lowio_lock_fh, rb_acrt_lowio_unlock_fh, rb_w32_send(), rb_w32_wait_events_blocking(), TO_SOCKET, TRUE, and wait().
Definition at line 7300 of file win32.c.
References _osfhnd, ECONV_INVALID_REPLACE, ECONV_UNDEF_REPLACE, ENABLE_VIRTUAL_TERMINAL_PROCESSING, ENCINDEX_ASCII, ENCINDEX_US_ASCII, ENCINDEX_UTF_16LE, ENCINDEX_UTF_8, ENCODING_GET, free, len, mbstr_to_wstr, NULL, ptr, Qnil, rb_econv_has_convpath_p(), rb_enc_from_index(), rb_enc_name, RB_GC_GUARD, rb_str_conv_enc_opts(), RSTRING_LEN, RSTRING_PTR, and str.
Referenced by rb_write_error2(), and rb_write_error_str().
| ssize_t readlink | ( | const char * | path, |
| char * | buf, | ||
| size_t | bufsize | ||
| ) |
Definition at line 3677 of file win32.c.
References WSAMSG::dwFlags, FALSE, GET_FLAGS, int(), len, map_errno, msghdr::msg_flags, msghdr::msg_name, msghdr::msg_namelen, msghdr_to_wsamsg, WSAMSG::name, WSAMSG::namelen, NULL, O_NONBLOCK, RUBY_CRITICAL, TO_SOCKET, TRUE, and WSAID_WSARECVMSG.
Definition at line 3732 of file win32.c.
References FALSE, GET_FLAGS, int(), len, map_errno, msghdr_to_wsamsg, NULL, O_NONBLOCK, RUBY_CRITICAL, TO_SOCKET, TRUE, and WSAID_WSASENDMSG.
| int setgid | ( | rb_gid_t | gid | ) |
Definition at line 2856 of file win32.c.
References ROOT_GID.
Referenced by rb_execarg_run_options().
| int setuid | ( | rb_uid_t | uid | ) |
Definition at line 2849 of file win32.c.
References ROOT_UID.
Referenced by rb_execarg_run_options().
Definition at line 4078 of file win32.c.
References MAKE_SOCKDATA, O_BINARY, and rb_w32_close().
Definition at line 4532 of file win32.c.
References count, END_FOREACH_CHILD, FOREACH_CHILD, map_errno, MAXCHILDNUM, rb_w32_wait_events_blocking(), and WNOHANG.
Referenced by wait().