Ruby  2.4.2p198(2017-09-14revision59899)
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
win32.c File Reference
#include "ruby/ruby.h"
#include "ruby/encoding.h"
#include "ruby/util.h"
#include <fcntl.h>
#include <process.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <assert.h>
#include <ctype.h>
#include <windows.h>
#include <winbase.h>
#include <wincon.h>
#include <share.h>
#include <shlobj.h>
#include <mbstring.h>
#include <shlwapi.h>
#include "ruby/win32.h"
#include "win32/dir.h"
#include "win32/file.h"
#include "internal.h"
#include "encindex.h"
#include "dln.h"
#include "dln_find.c"
#include <sys/timeb.h>
#include "missing/nextafter.c"
Include dependency graph for win32.c:

Go to the source code of this file.

Data Structures

struct  constat
 
struct  ChildRecord
 
struct  _NtCmdLineElement
 
struct  ioinfo
 
struct  WSAMSG
 
struct  NET_LUID
 
struct  asynchronous_arg_t
 

Macros

#define isdirsep(x)   ((x) == '/' || (x) == '\\')
 
#define DLN_FIND_EXTRA_ARG_DECL   ,UINT cp
 
#define DLN_FIND_EXTRA_ARG   ,cp
 
#define rb_w32_stati64(path, st)   w32_stati64(path, st, cp)
 
#define getenv(name)   w32_getenv(name, cp)
 
#define CharNext(p)   CharNextExA(cp, (p), 0)
 
#define dln_find_exe_r   rb_w32_udln_find_exe_r
 
#define dln_find_file_r   rb_w32_udln_find_file_r
 
#define dln_find_exe_r(fname, path, buf, size)   rb_w32_udln_find_exe_r(fname, path, buf, size, cp)
 
#define dln_find_file_r(fname, path, buf, size)   rb_w32_udln_find_file_r(fname, path, buf, size, cp)
 
#define ENV_MAX   512
 
#define enough_to_get(n)   (--(n) >= 0)
 
#define enough_to_put(n)   (--(n) >= 0)
 
#define Debug(something)   /* nothing */
 
#define TO_SOCKET(x)   _get_osfhandle(x)
 
#define RUBY_CRITICAL   if (0) {} else /* just remark */
 
#define ERROR_PIPE_LOCAL   229L
 
#define map_errno   rb_w32_map_errno
 
#define LK_ERR(f, i)
 
#define LK_LEN   ULONG_MAX
 
#define CSIDL_LOCAL_APPDATA   28
 
#define CSIDL_COMMON_APPDATA   35
 
#define CSIDL_WINDOWS   36
 
#define CSIDL_SYSTEM   37
 
#define CSIDL_PROFILE   40
 
#define env   wk.val
 
#define set_env_val(vname)
 
#define conlist_disabled   ((st_table *)-1)
 
#define MAKE_SOCKDATA(af, fl)   ((int)((((int)af)<<4)|((fl)&0xFFFF)))
 
#define GET_FAMILY(v)   ((int)(((v)>>4)&0xFFFF))
 
#define GET_FLAGS(v)   ((int)((v)&0xFFFF))
 
#define MAXCHILDNUM   256 /* max num of child processes */
 
#define FOREACH_CHILD(v)
 
#define END_FOREACH_CHILD   } while (0)
 
#define InternalCmdsMax   8
 
#define STRNDUPV(ptr, v, src, len)   (((char *)memcpy(((ptr) = ALLOCV((v), (len) + 1)), (src), (len)))[len] = 0)
 
#define filecp   rb_w32_filecp
 
#define mbstr_to_wstr   rb_w32_mbstr_to_wstr
 
#define wstr_to_mbstr   rb_w32_wstr_to_mbstr
 
#define acp_to_wstr(str, plen)   mbstr_to_wstr(CP_ACP, str, -1, plen)
 
#define wstr_to_acp(str, plen)   wstr_to_mbstr(CP_ACP, str, -1, plen)
 
#define filecp_to_wstr(str, plen)   mbstr_to_wstr(filecp(), str, -1, plen)
 
#define wstr_to_filecp(str, plen)   wstr_to_mbstr(filecp(), str, -1, plen)
 
#define utf8_to_wstr(str, plen)   mbstr_to_wstr(CP_UTF8, str, -1, plen)
 
#define wstr_to_utf8(str, plen)   wstr_to_mbstr(CP_UTF8, str, -1, plen)
 
#define NTGLOB   0x1
 
#define NTMALLOC   0x2
 
#define NTSTRING   0x4
 
#define GetBit(bits, i)   ((bits)[(i) / CHAR_BIT] & (1 << (i) % CHAR_BIT))
 
#define SetBit(bits, i)   ((bits)[(i) / CHAR_BIT] |= (1 << (i) % CHAR_BIT))
 
#define BitOfIsDir(n)   ((n) * 2)
 
#define BitOfIsRep(n)   ((n) * 2 + 1)
 
#define DIRENT_PER_CHAR   (CHAR_BIT / 2)
 
#define FILE_COUNT(stream)   stream->_cnt
 
#define FILE_READPTR(stream)   stream->_ptr
 
#define FILE_FILENO(stream)   stream->_file
 
#define _CRTIMP   __declspec(dllimport)
 
#define IOINFO_L2E   5
 
#define IOINFO_ARRAY_ELTS   (1 << IOINFO_L2E)
 
#define _osfhnd(i)   (_pioinfo(i)->osfhnd)
 
#define _osfile(i)   (_pioinfo(i)->osfile)
 
#define rb_acrt_lowio_lock_fh(i)   EnterCriticalSection(&_pioinfo(i)->lock)
 
#define rb_acrt_lowio_unlock_fh(i)   LeaveCriticalSection(&_pioinfo(i)->lock)
 
#define pioinfo_extra   0
 
#define _set_osfhnd(fh, osfh)   (void)(_osfhnd(fh) = osfh)
 
#define _set_osflags(fh, flags)   (_osfile(fh) = (flags))
 
#define FOPEN   0x01 /* file handle open */
 
#define FEOFLAG   0x02 /* end of file has been encountered */
 
#define FPIPE   0x08 /* file handle refers to a pipe */
 
#define FNOINHERIT   0x10 /* file handle opened O_NOINHERIT */
 
#define FAPPEND   0x20 /* file handle opened O_APPEND */
 
#define FDEV   0x40 /* file handle refers to device */
 
#define FTEXT   0x80 /* file handle is in text mode */
 
#define open_null(fd)
 
#define ROOT_UID   0
 
#define ROOT_GID   0
 
#define WSAID_WSARECVMSG   {0xf689d7c8,0x6f1f,0x436b,{0x8a,0x53,0xe5,0x4f,0xe3,0x51,0xc3,0x22}}
 
#define WSAID_WSASENDMSG   {0xa441e712,0x754f,0x43ca,{0x84,0xa7,0x0d,0xee,0x44,0xcf,0x60,0x6d}}
 
#define msghdr_to_wsamsg(msg, wsamsg)
 
#define hex2byte(str)   ((isdigit(*(str)) ? *(str) - '0' : toupper(*(str)) - 'A' + 10) << 4 | (isdigit(*((str) + 1)) ? *((str) + 1) - '0' : toupper(*((str) + 1)) - 'A' + 10))
 
#define FILE_DEVICE_FILE_SYSTEM   0x00000009
 
#define FSCTL_GET_REPARSE_POINT   ((0x9<<16)|(42<<2))
 
#define IO_REPARSE_TAG_SYMLINK   0xA000000CL
 
#define SYMBOLIC_LINK_FLAG_DIRECTORY   (0x1)
 
#define COPY_STAT(src, dest, size_cast)
 
#define yield_once()   Sleep(0)
 
#define yield_until(condition)   do yield_once(); while (!(condition))
 
#define set_new_std_handle(newfd, handle)
 
#define set_new_std_fd(newfd)   set_new_std_handle(newfd, (HANDLE)rb_w32_get_osfhandle(newfd))
 
#define FOREGROUND_MASK   (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY)
 
#define BACKGROUND_MASK   (BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY)
 
#define constat_attr_color_reverse(attr)
 
#define COMMON_LVB_UNDERSCORE   0x8000
 
#define INVALID_SET_FILE_POINTER   ((DWORD)-1)
 

Typedefs

typedef struct _NtCmdLineElement NtCmdLineElement
 
typedef DWORD(WINAPI * get_final_path_func) (HANDLE, WCHAR *, DWORD, DWORD)
 
typedef DWORD(WINAPI * cigl_t) (const GUID *, NET_LUID *)
 
typedef DWORD(WINAPI * cilnA_t) (const NET_LUID *, char *, size_t)
 

Enumerations

enum  { constat_init = -2, constat_esc = -1, constat_seq = 0 }
 

Functions

static int w32_wopen (const WCHAR *file, int oflag, int perm)
 
static int w32_stati64 (const char *path, struct stati64 *st, UINT cp)
 
static int w32_lstati64 (const char *path, struct stati64 *st, UINT cp)
 
static char * w32_getenv (const char *name, UINT cp)
 
int rb_w32_reparse_symlink_p (const WCHAR *path)
 
static struct ChildRecordCreateChild (const WCHAR *, const WCHAR *, SECURITY_ATTRIBUTES *, HANDLE, HANDLE, HANDLE, DWORD)
 
static int has_redirection (const char *, UINT)
 
int rb_w32_wait_events (HANDLE *events, int num, DWORD timeout)
 
static int rb_w32_open_osfhandle (intptr_t osfhandle, int flags)
 
static int wstati64 (const WCHAR *path, struct stati64 *st)
 
static int wlstati64 (const WCHAR *path, struct stati64 *st)
 
VALUE rb_w32_conv_from_wchar (const WCHAR *wstr, rb_encoding *enc)
 
int ruby_brace_glob_with_enc (const char *str, int flags, ruby_glob_func *func, VALUE arg, rb_encoding *enc)
 
static FARPROC get_proc_address (const char *module, const char *func, HANDLE *mh)
 
int rb_w32_map_errno (DWORD winerr)
 
static void get_version (void)
 
DWORD rb_w32_osver (void)
 
static uintptr_t flock_winnt (uintptr_t self, int argc, uintptr_t *argv)
 
int flock (int fd, int oper)
 
static WCHAR * translate_wchar (WCHAR *p, int from, int to)
 
static char * translate_char (char *p, int from, int to, UINT cp)
 
static BOOL get_special_folder (int n, WCHAR *buf, size_t len)
 
static void regulate_path (WCHAR *path)
 
VALUE rb_w32_special_folder (int type)
 
UINT rb_w32_system_tmpdir (WCHAR *path, UINT len)
 
WCHAR * rb_w32_home_dir (void)
 
static void init_env (void)
 
static void init_stdhandle (void)
 
static int free_conlist (st_data_t key, st_data_t val, st_data_t arg)
 
static void constat_delete (HANDLE h)
 
static void exit_handler (void)
 
static void StartSockets (void)
 
static int socklist_insert (SOCKET sock, int flag)
 
static int socklist_lookup (SOCKET sock, int *flagp)
 
static int socklist_delete (SOCKET *sockp, int *flagp)
 
static int w32_cmdvector (const WCHAR *, char ***, UINT, rb_encoding *)
 
void rb_w32_sysinit (int *argc, char ***argv)
 
char * getlogin (void)
 
static struct ChildRecordFindChildSlot (rb_pid_t pid)
 
static struct ChildRecordFindChildSlotByHandle (HANDLE h)
 
static void CloseChildHandle (struct ChildRecord *child)
 
static struct ChildRecordFindFreeChildSlot (void)
 
static int internal_match (const void *key, const void *elem)
 
static int is_command_com (const char *interp)
 
static int internal_cmd_match (const char *cmdname, int nt)
 
static int is_internal_cmd (const char *cmd, int nt)
 
SOCKET rb_w32_get_osfhandle (int fh)
 
static int join_argv (char *cmd, char *const *argv, BOOL escape, UINT cp, int backslash)
 
static int check_spawn_mode (int mode)
 
static rb_pid_t child_result (struct ChildRecord *child, int mode)
 
static int is_batch (const char *cmd)
 
static rb_pid_t w32_spawn (int mode, const char *cmd, const char *prog, UINT cp)
 
rb_pid_t rb_w32_spawn (int mode, const char *cmd, const char *prog)
 
rb_pid_t rb_w32_uspawn (int mode, const char *cmd, const char *prog)
 
static rb_pid_t w32_aspawn_flags (int mode, const char *prog, char *const *argv, DWORD flags, UINT cp)
 
rb_pid_t rb_w32_aspawn_flags (int mode, const char *prog, char *const *argv, DWORD flags)
 
rb_pid_t rb_w32_uaspawn_flags (int mode, const char *prog, char *const *argv, DWORD flags)
 
rb_pid_t rb_w32_aspawn (int mode, const char *prog, char *const *argv)
 
rb_pid_t rb_w32_uaspawn (int mode, const char *prog, char *const *argv)
 
static int insert (const char *path, VALUE vinfo, void *enc)
 
static NtCmdLineElement ** cmdglob (NtCmdLineElement *patt, NtCmdLineElement **tail, UINT cp, rb_encoding *enc)
 
static WCHAR * skipspace (WCHAR *ptr)
 
static DWORD WINAPI get_final_path_fail (HANDLE f, WCHAR *buf, DWORD len, DWORD flag)
 
static DWORD WINAPI get_final_path_unknown (HANDLE f, WCHAR *buf, DWORD len, DWORD flag)
 
static HANDLE open_special (const WCHAR *path, DWORD access, DWORD flags)
 
static HANDLE open_dir_handle (const WCHAR *filename, WIN32_FIND_DATAW *fd)
 
static DIRw32_wopendir (const WCHAR *wpath)
 
UINT filecp (void)
 
char * rb_w32_wstr_to_mbstr (UINT cp, const WCHAR *wstr, int clen, long *plen)
 
WCHAR * rb_w32_mbstr_to_wstr (UINT cp, const char *str, int clen, long *plen)
 
DIRrb_w32_opendir (const char *filename)
 
DIRrb_w32_uopendir (const char *filename)
 
static void move_to_next_entry (DIR *dirp)
 
static BOOL win32_direct_conv (const WCHAR *file, const WCHAR *alt, struct direct *entry, const void *enc)
 
char * rb_w32_conv_from_wstr (const WCHAR *wstr, long *lenp, rb_encoding *enc)
 
static BOOL ruby_direct_conv (const WCHAR *file, const WCHAR *alt, struct direct *entry, const void *enc)
 
static struct directreaddir_internal (DIR *dirp, BOOL(*conv)(const WCHAR *, const WCHAR *, struct direct *, const void *), const void *enc)
 
struct directrb_w32_readdir (DIR *dirp, rb_encoding *enc)
 
long rb_w32_telldir (DIR *dirp)
 
void rb_w32_seekdir (DIR *dirp, long loc)
 
void rb_w32_rewinddir (DIR *dirp)
 
void rb_w32_closedir (DIR *dirp)
 
static ioinfo_pioinfo (int)
 
static int is_socket (SOCKET)
 
static int is_console (SOCKET)
 
int rb_w32_io_cancelable_p (int fd)
 
int rb_w32_is_socket (int fd)
 
char * rb_w32_strerror (int e)
 
rb_uid_t getuid (void)
 
rb_uid_t geteuid (void)
 
rb_gid_t getgid (void)
 
rb_gid_t getegid (void)
 
int setuid (rb_uid_t uid)
 
int setgid (rb_gid_t gid)
 
int ioctl (int i, int u,...)
 
void rb_w32_fdset (int fd, fd_set *set)
 
void rb_w32_fdclr (int fd, fd_set *set)
 
int rb_w32_fdisset (int fd, fd_set *set)
 
void rb_w32_fd_copy (rb_fdset_t *dst, const fd_set *src, int max)
 
void rb_w32_fd_dup (rb_fdset_t *dst, const rb_fdset_t *src)
 
static int extract_fd (rb_fdset_t *dst, fd_set *src, int(*func)(SOCKET))
 
static int copy_fd (fd_set *dst, fd_set *src)
 
static int is_not_socket (SOCKET sock)
 
static int is_pipe (SOCKET sock)
 
static int is_readable_pipe (SOCKET sock)
 
static int is_readable_console (SOCKET sock)
 
static int is_invalid_handle (SOCKET sock)
 
static int do_select (int nfds, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *timeout)
 
int rb_w32_time_subtract (struct timeval *rest, const struct timeval *wait)
 
static int compare (const struct timeval *t1, const struct timeval *t2)
 
int rb_w32_check_interrupt (void *)
 
int rb_w32_select_with_thread (int nfds, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *timeout, void *th)
 
int WSAAPI rb_w32_select (int nfds, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *timeout)
 
static FARPROC get_wsa_extension_function (SOCKET s, GUID *guid)
 
int WSAAPI rb_w32_accept (int s, struct sockaddr *addr, int *addrlen)
 
int WSAAPI rb_w32_bind (int s, const struct sockaddr *addr, int addrlen)
 
int WSAAPI rb_w32_connect (int s, const struct sockaddr *addr, int addrlen)
 
int WSAAPI rb_w32_getpeername (int s, struct sockaddr *addr, int *addrlen)
 
int WSAAPI rb_w32_getsockname (int fd, struct sockaddr *addr, int *addrlen)
 
int WSAAPI rb_w32_getsockopt (int s, int level, int optname, char *optval, int *optlen)
 
int WSAAPI rb_w32_ioctlsocket (int s, long cmd, u_long *argp)
 
int WSAAPI rb_w32_listen (int s, int backlog)
 
static int finish_overlapped_socket (BOOL input, SOCKET s, WSAOVERLAPPED *wol, int result, DWORD *len, DWORD size)
 
static int overlapped_socket_io (BOOL input, int fd, char *buf, int len, int flags, struct sockaddr *addr, int *addrlen)
 
int WSAAPI rb_w32_recv (int fd, char *buf, int len, int flags)
 
int WSAAPI rb_w32_recvfrom (int fd, char *buf, int len, int flags, struct sockaddr *from, int *fromlen)
 
int WSAAPI rb_w32_send (int fd, const char *buf, int len, int flags)
 
int WSAAPI rb_w32_sendto (int fd, const char *buf, int len, int flags, const struct sockaddr *to, int tolen)
 
int recvmsg (int fd, struct msghdr *msg, int flags)
 
int sendmsg (int fd, const struct msghdr *msg, int flags)
 
int WSAAPI rb_w32_setsockopt (int s, int level, int optname, const char *optval, int optlen)
 
int WSAAPI rb_w32_shutdown (int s, int how)
 
static SOCKET open_ifs_socket (int af, int type, int protocol)
 
int WSAAPI rb_w32_socket (int af, int type, int protocol)
 
struct hostent *WSAAPI rb_w32_gethostbyaddr (const char *addr, int len, int type)
 
struct hostent *WSAAPI rb_w32_gethostbyname (const char *name)
 
int WSAAPI rb_w32_gethostname (char *name, int len)
 
struct protoent *WSAAPI rb_w32_getprotobyname (const char *name)
 
struct protoent *WSAAPI rb_w32_getprotobynumber (int num)
 
struct servent *WSAAPI rb_w32_getservbyname (const char *name, const char *proto)
 
struct servent *WSAAPI rb_w32_getservbyport (int port, const char *proto)
 
static int socketpair_internal (int af, int type, int protocol, SOCKET *sv)
 
int socketpair (int af, int type, int protocol, int *sv)
 
static void str2guid (const char *str, GUID *guid)
 
int getifaddrs (struct ifaddrs **ifap)
 
void freeifaddrs (struct ifaddrs *ifp)
 
void endhostent (void)
 
void endnetent (void)
 
void endprotoent (void)
 
void endservent (void)
 
struct netent * getnetent (void)
 
struct netent * getnetbyaddr (long net, int type)
 
struct netent * getnetbyname (const char *name)
 
struct protoent * getprotoent (void)
 
struct servent * getservent (void)
 
void sethostent (int stayopen)
 
void setnetent (int stayopen)
 
void setprotoent (int stayopen)
 
void setservent (int stayopen)
 
static int setfl (SOCKET sock, int arg)
 
static int dupfd (HANDLE hDup, int flags, int minfd)
 
int fcntl (int fd, int cmd,...)
 
int rb_w32_set_nonblock (int fd)
 
static rb_pid_t poll_child_status (struct ChildRecord *child, int *stat_loc)
 
rb_pid_t waitpid (rb_pid_t pid, int *stat_loc, int options)
 
static int filetime_to_timeval (const FILETIME *ft, struct timeval *tv)
 
int __cdecl gettimeofday (struct timeval *tv, struct timezone *tz)
 
int clock_gettime (clockid_t clock_id, struct timespec *sp)
 
int clock_getres (clockid_t clock_id, struct timespec *sp)
 
char * rb_w32_getcwd (char *buffer, int size)
 
int chown (const char *path, int owner, int group)
 
int rb_w32_uchown (const char *path, int owner, int group)
 
int lchown (const char *path, int owner, int group)
 
int rb_w32_ulchown (const char *path, int owner, int group)
 
int kill (int pid, int sig)
 
static int wlink (const WCHAR *from, const WCHAR *to)
 
int rb_w32_ulink (const char *from, const char *to)
 
int link (const char *from, const char *to)
 
static int reparse_symlink (const WCHAR *path, rb_w32_reparse_buffer_t *rp, size_t size)
 
int rb_w32_read_reparse_point (const WCHAR *path, rb_w32_reparse_buffer_t *rp, size_t bufsize, WCHAR **result, DWORD *len)
 
static ssize_t w32_readlink (UINT cp, const char *path, char *buf, size_t bufsize)
 
ssize_t rb_w32_ureadlink (const char *path, char *buf, size_t bufsize)
 
ssize_t readlink (const char *path, char *buf, size_t bufsize)
 
static int w32_symlink (UINT cp, const char *src, const char *link)
 
int rb_w32_usymlink (const char *src, const char *link)
 
int symlink (const char *src, const char *link)
 
int wait (int *status)
 
char * rb_w32_ugetenv (const char *name)
 
char * rb_w32_getenv (const char *name)
 
static DWORD get_attr_vsn (const WCHAR *path, DWORD *atts, DWORD *vsn)
 
static int wrename (const WCHAR *oldpath, const WCHAR *newpath)
 
int rb_w32_urename (const char *from, const char *to)
 
int rb_w32_rename (const char *from, const char *to)
 
static int isUNCRoot (const WCHAR *path)
 
static time_t filetime_to_unixtime (const FILETIME *ft)
 
static WCHAR * name_for_stat (WCHAR *buf, const WCHAR *path)
 
static DWORD stati64_handle (HANDLE h, struct stati64 *st)
 
static void stati64_set_inode (BY_HANDLE_FILE_INFORMATION *pinfo, struct stati64 *st)
 
static DWORD stati64_set_inode_handle (HANDLE h, struct stati64 *st)
 
int rb_w32_fstat (int fd, struct stat *st)
 
int rb_w32_fstati64 (int fd, struct stati64 *st)
 
static unsigned fileattr_to_unixmode (DWORD attr, const WCHAR *path)
 
static int check_valid_dir (const WCHAR *path)
 
static int stat_by_find (const WCHAR *path, struct stati64 *st)
 
static int path_drive (const WCHAR *path)
 
static int winnt_stat (const WCHAR *path, struct stati64 *st)
 
static int winnt_lstat (const WCHAR *path, struct stati64 *st)
 
int rb_w32_stat (const char *path, struct stat *st)
 
int rb_w32_ustati64 (const char *path, struct stati64 *st)
 
int rb_w32_stati64 (const char *path, struct stati64 *st)
 
int rb_w32_ulstati64 (const char *path, struct stati64 *st)
 
int rb_w32_lstati64 (const char *path, struct stati64 *st)
 
int rb_w32_access (const char *path, int mode)
 
int rb_w32_uaccess (const char *path, int mode)
 
static int rb_chsize (HANDLE h, off_t size)
 
static int w32_truncate (const char *path, off_t length, UINT cp)
 
int rb_w32_utruncate (const char *path, off_t length)
 
int rb_w32_truncate (const char *path, off_t length)
 
int rb_w32_ftruncate (int fd, off_t length)
 
static long filetime_to_clock (FILETIME *ft)
 
int rb_w32_times (struct tms *tmbuf)
 
static DWORD WINAPI call_asynchronous (PVOID argp)
 
uintptr_t rb_w32_asynchronize (asynchronous_func_t func, uintptr_t self, int argc, uintptr_t *argv, uintptr_t intrval)
 
char ** rb_w32_get_environ (void)
 
void rb_w32_free_environ (char **env)
 
rb_pid_t rb_w32_getpid (void)
 
rb_pid_t rb_w32_getppid (void)
 
 STATIC_ASSERT (std_handle,(STD_OUTPUT_HANDLE-STD_INPUT_HANDLE)==(STD_ERROR_HANDLE-STD_OUTPUT_HANDLE))
 
int rb_w32_dup2 (int oldfd, int newfd)
 
int rb_w32_uopen (const char *file, int oflag,...)
 
static int check_if_wdir (const WCHAR *wfile)
 
int rb_w32_open (const char *file, int oflag,...)
 
int rb_w32_wopen (const WCHAR *file, int oflag,...)
 
int rb_w32_fclose (FILE *fp)
 
int rb_w32_pipe (int fds[2])
 
static int console_emulator_p (void)
 
static struct constatconstat_handle (HANDLE h)
 
static void constat_reset (HANDLE h)
 
static WORD constat_attr (int count, const int *seq, WORD attr, WORD default_attr, int *reverse)
 
static void constat_apply (HANDLE handle, struct constat *s, WCHAR w)
 
static long constat_parse (HANDLE h, struct constat *s, const WCHAR **ptrp, long *lenp)
 
int rb_w32_close (int fd)
 
static int setup_overlapped (OVERLAPPED *ol, int fd, int iswrite)
 
static void finish_overlapped (OVERLAPPED *ol, int fd, DWORD size)
 
ssize_t rb_w32_read (int fd, void *buf, size_t size)
 
ssize_t rb_w32_write (int fd, const void *buf, size_t size)
 
long rb_w32_write_console (uintptr_t strarg, int fd)
 
static int unixtime_to_filetime (time_t time, FILETIME *ft)
 
static int wutime (const WCHAR *path, const struct utimbuf *times)
 
int rb_w32_uutime (const char *path, const struct utimbuf *times)
 
int rb_w32_utime (const char *path, const struct utimbuf *times)
 
int rb_w32_uchdir (const char *path)
 
static int wmkdir (const WCHAR *wpath, int mode)
 
int rb_w32_umkdir (const char *path, int mode)
 
int rb_w32_mkdir (const char *path, int mode)
 
static int wrmdir (const WCHAR *wpath)
 
int rb_w32_rmdir (const char *path)
 
int rb_w32_urmdir (const char *path)
 
static int wunlink (const WCHAR *path)
 
int rb_w32_uunlink (const char *path)
 
int rb_w32_unlink (const char *path)
 
int rb_w32_uchmod (const char *path, int mode)
 
int fchmod (int fd, int mode)
 
int rb_w32_isatty (int fd)
 
int signbit (double x)
 
const char *WSAAPI rb_w32_inet_ntop (int af, const void *addr, char *numaddr, size_t numaddr_len)
 
int WSAAPI rb_w32_inet_pton (int af, const char *src, void *dst)
 
char rb_w32_fd_is_text (int fd)
 
static int unixtime_to_systemtime (const time_t t, SYSTEMTIME *st)
 
static void systemtime_to_tm (const SYSTEMTIME *st, struct tm *t)
 
static int systemtime_to_localtime (TIME_ZONE_INFORMATION *tz, SYSTEMTIME *gst, SYSTEMTIME *lst)
 
struct tm * gmtime_r (const time_t *tp, struct tm *rp)
 
struct tm * localtime_r (const time_t *tp, struct tm *rp)
 
int rb_w32_wrap_io_handle (HANDLE h, int flags)
 
int rb_w32_unwrap_io_handle (int fd)
 

Variables

struct {
   DWORD   winerr
 
   int   err
 
errmap []
 
static const char * NTLoginName
 
static OSVERSIONINFO osver
 
static CRITICAL_SECTION select_mutex
 
static int NtSocketsInitialized = 0
 
static st_tablesocklist = NULL
 
static st_tableconlist = NULL
 
static char * uenvarea
 
static struct ChildRecord ChildRecord [MAXCHILDNUM]
 
static const char szInternalCmds [][InternalCmdsMax+2]
 
static get_final_path_func get_final_path = get_final_path_unknown
 
EXTERN_C _CRTIMP ioinfo__pioinfo []
 
static cigl_t pConvertInterfaceGuidToLuid = (cigl_t)-1
 
static cilnA_t pConvertInterfaceLuidToNameA = (cilnA_t)-1
 
static const WCHAR namespace_prefix [] = {L'\\', L'\\', L'?', L'\\'}
 
VALUE(*const rb_f_notimplement_ )(int, const VALUE *, VALUE) = rb_f_notimplement
 

Macro Definition Documentation

◆ _CRTIMP

#define _CRTIMP   __declspec(dllimport)

Definition at line 2415 of file win32.c.

Referenced by systemtime_to_localtime().

◆ _osfhnd

#define _osfhnd (   i)    (_pioinfo(i)->osfhnd)

◆ _osfile

#define _osfile (   i)    (_pioinfo(i)->osfile)

◆ _set_osfhnd

#define _set_osfhnd (   fh,
  osfh 
)    (void)(_osfhnd(fh) = osfh)

◆ _set_osflags

#define _set_osflags (   fh,
  flags 
)    (_osfile(fh) = (flags))

Definition at line 2531 of file win32.c.

Referenced by rb_w32_open_osfhandle(), rb_w32_pipe(), rb_w32_read(), and w32_wopen().

◆ acp_to_wstr

#define acp_to_wstr (   str,
  plen 
)    mbstr_to_wstr(CP_ACP, str, -1, plen)

Definition at line 1276 of file win32.c.

◆ BACKGROUND_MASK

#define BACKGROUND_MASK   (BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY)

Definition at line 6536 of file win32.c.

◆ BitOfIsDir

#define BitOfIsDir (   n)    ((n) * 2)

Definition at line 1926 of file win32.c.

Referenced by readdir_internal(), and w32_wopendir().

◆ BitOfIsRep

#define BitOfIsRep (   n)    ((n) * 2 + 1)

Definition at line 1927 of file win32.c.

Referenced by readdir_internal(), and w32_wopendir().

◆ CharNext

#define CharNext (   p)    CharNextExA(cp, (p), 0)

Definition at line 73 of file win32.c.

◆ COMMON_LVB_UNDERSCORE

#define COMMON_LVB_UNDERSCORE   0x8000

Referenced by constat_attr().

◆ conlist_disabled

#define conlist_disabled   ((st_table *)-1)

Definition at line 695 of file win32.c.

Referenced by constat_delete(), constat_handle(), constat_reset(), and exit_handler().

◆ constat_attr_color_reverse

#define constat_attr_color_reverse (   attr)
Value:
((attr) & ~(FOREGROUND_MASK | BACKGROUND_MASK)) | \
(((attr) & FOREGROUND_MASK) << 4) | \
(((attr) & BACKGROUND_MASK) >> 4)
#define FOREGROUND_MASK
Definition: win32.c:6535
#define BACKGROUND_MASK
Definition: win32.c:6536

Definition at line 6538 of file win32.c.

Referenced by constat_attr().

◆ COPY_STAT

#define COPY_STAT (   src,
  dest,
  size_cast 
)
Value:
do { \
(dest).st_dev = (src).st_dev; \
(dest).st_ino = (src).st_ino; \
(dest).st_mode = (src).st_mode; \
(dest).st_nlink = (src).st_nlink; \
(dest).st_uid = (src).st_uid; \
(dest).st_gid = (src).st_gid; \
(dest).st_rdev = (src).st_rdev; \
(dest).st_size = size_cast(src).st_size; \
(dest).st_atime = (src).st_atime; \
(dest).st_mtime = (src).st_mtime; \
(dest).st_ctime = (src).st_ctime; \
} while (0)

Definition at line 5288 of file win32.c.

Referenced by rb_w32_fstati64(), and rb_w32_stat().

◆ CSIDL_COMMON_APPDATA

#define CSIDL_COMMON_APPDATA   35

Definition at line 420 of file win32.c.

Referenced by etc_sysconfdir().

◆ CSIDL_LOCAL_APPDATA

#define CSIDL_LOCAL_APPDATA   28

Definition at line 417 of file win32.c.

Referenced by rb_w32_system_tmpdir().

◆ CSIDL_PROFILE

#define CSIDL_PROFILE   40

Definition at line 429 of file win32.c.

Referenced by init_env(), and rb_w32_home_dir().

◆ CSIDL_SYSTEM

#define CSIDL_SYSTEM   37

Definition at line 426 of file win32.c.

◆ CSIDL_WINDOWS

#define CSIDL_WINDOWS   36

Definition at line 423 of file win32.c.

◆ Debug

#define Debug (   something)    /* nothing */

Definition at line 113 of file win32.c.

Referenced by rb_w32_asynchronize().

◆ DIRENT_PER_CHAR

#define DIRENT_PER_CHAR   (CHAR_BIT / 2)

Definition at line 1928 of file win32.c.

Referenced by w32_wopendir().

◆ dln_find_exe_r [1/2]

#define dln_find_exe_r   rb_w32_udln_find_exe_r

Definition at line 82 of file win32.c.

Referenced by proc_exec_sh(), rb_exec_fillarg(), w32_aspawn_flags(), and w32_spawn().

◆ dln_find_exe_r [2/2]

#define dln_find_exe_r (   fname,
  path,
  buf,
  size 
)    rb_w32_udln_find_exe_r(fname, path, buf, size, cp)

Definition at line 82 of file win32.c.

◆ DLN_FIND_EXTRA_ARG

#define DLN_FIND_EXTRA_ARG   ,cp

Definition at line 69 of file win32.c.

◆ DLN_FIND_EXTRA_ARG_DECL

#define DLN_FIND_EXTRA_ARG_DECL   ,UINT cp

Definition at line 68 of file win32.c.

◆ dln_find_file_r [1/2]

#define dln_find_file_r   rb_w32_udln_find_file_r

Definition at line 83 of file win32.c.

Referenced by process_options().

◆ dln_find_file_r [2/2]

#define dln_find_file_r (   fname,
  path,
  buf,
  size 
)    rb_w32_udln_find_file_r(fname, path, buf, size, cp)

Definition at line 83 of file win32.c.

◆ END_FOREACH_CHILD

#define END_FOREACH_CHILD   } while (0)

Definition at line 884 of file win32.c.

Referenced by FindChildSlot(), FindChildSlotByHandle(), FindFreeChildSlot(), and waitpid().

◆ enough_to_get

#define enough_to_get (   n)    (--(n) >= 0)

Definition at line 107 of file win32.c.

◆ enough_to_put

#define enough_to_put (   n)    (--(n) >= 0)

Definition at line 108 of file win32.c.

◆ env

#define env   wk.val

◆ ENV_MAX

#define ENV_MAX   512

Definition at line 94 of file win32.c.

Referenced by init_env().

◆ ERROR_PIPE_LOCAL

#define ERROR_PIPE_LOCAL   229L

◆ FAPPEND

#define FAPPEND   0x20 /* file handle opened O_APPEND */

Definition at line 2537 of file win32.c.

Referenced by rb_w32_open_osfhandle(), setup_overlapped(), and w32_wopen().

◆ FDEV

#define FDEV   0x40 /* file handle refers to device */

◆ FEOFLAG

#define FEOFLAG   0x02 /* end of file has been encountered */

Definition at line 2534 of file win32.c.

Referenced by rb_w32_read(), and rb_w32_write().

◆ FILE_COUNT

#define FILE_COUNT (   stream)    stream->_cnt

Definition at line 2376 of file win32.c.

◆ FILE_DEVICE_FILE_SYSTEM

#define FILE_DEVICE_FILE_SYSTEM   0x00000009

Definition at line 4886 of file win32.c.

◆ FILE_FILENO

#define FILE_FILENO (   stream)    stream->_file

Definition at line 2378 of file win32.c.

Referenced by init_stdhandle().

◆ FILE_READPTR

#define FILE_READPTR (   stream)    stream->_ptr

Definition at line 2377 of file win32.c.

◆ filecp

#define filecp   rb_w32_filecp

◆ filecp_to_wstr

#define filecp_to_wstr (   str,
  plen 
)    mbstr_to_wstr(filecp(), str, -1, plen)

◆ FNOINHERIT

#define FNOINHERIT   0x10 /* file handle opened O_NOINHERIT */

Definition at line 2536 of file win32.c.

Referenced by fcntl(), rb_w32_open_osfhandle(), rb_w32_pipe(), and w32_wopen().

◆ FOPEN

#define FOPEN   0x01 /* file handle open */

Definition at line 2533 of file win32.c.

Referenced by dupfd(), rb_w32_open_osfhandle(), rb_w32_pipe(), and w32_wopen().

◆ FOREACH_CHILD

#define FOREACH_CHILD (   v)
Value:
do { \
struct ChildRecord* v; \
for (v = ChildRecord; v < ChildRecord + sizeof(ChildRecord) / sizeof(ChildRecord[0]); ++v)
static struct ChildRecord ChildRecord[MAXCHILDNUM]

Definition at line 881 of file win32.c.

Referenced by FindChildSlot(), FindChildSlotByHandle(), FindFreeChildSlot(), and waitpid().

◆ FOREGROUND_MASK

#define FOREGROUND_MASK   (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY)

Definition at line 6535 of file win32.c.

◆ FPIPE

#define FPIPE   0x08 /* file handle refers to a pipe */

◆ FSCTL_GET_REPARSE_POINT

#define FSCTL_GET_REPARSE_POINT   ((0x9<<16)|(42<<2))

Definition at line 4889 of file win32.c.

Referenced by reparse_symlink().

◆ FTEXT

#define FTEXT   0x80 /* file handle is in text mode */

Definition at line 2539 of file win32.c.

Referenced by rb_w32_fd_is_text(), rb_w32_open_osfhandle(), rb_w32_read(), and rb_w32_write().

◆ GET_FAMILY

#define GET_FAMILY (   v)    ((int)(((v)>>4)&0xFFFF))

Definition at line 774 of file win32.c.

Referenced by rb_w32_getsockname(), and setfl().

◆ GET_FLAGS

#define GET_FLAGS (   v)    ((int)((v)&0xFFFF))

Definition at line 775 of file win32.c.

Referenced by overlapped_socket_io(), recvmsg(), sendmsg(), and setfl().

◆ GetBit

#define GetBit (   bits,
 
)    ((bits)[(i) / CHAR_BIT] & (1 << (i) % CHAR_BIT))

Definition at line 1923 of file win32.c.

Referenced by readdir_internal().

◆ getenv

#define getenv (   name)    w32_getenv(name, cp)

◆ hex2byte

#define hex2byte (   str)    ((isdigit(*(str)) ? *(str) - '0' : toupper(*(str)) - 'A' + 10) << 4 | (isdigit(*((str) + 1)) ? *((str) + 1) - '0' : toupper(*((str) + 1)) - 'A' + 10))

Referenced by str2guid().

◆ InternalCmdsMax

#define InternalCmdsMax   8

Definition at line 943 of file win32.c.

Referenced by internal_match().

◆ INVALID_SET_FILE_POINTER

#define INVALID_SET_FILE_POINTER   ((DWORD)-1)

Referenced by setup_overlapped().

◆ IO_REPARSE_TAG_SYMLINK

#define IO_REPARSE_TAG_SYMLINK   0xA000000CL

Definition at line 4892 of file win32.c.

Referenced by rb_w32_read_reparse_point(), and reparse_symlink().

◆ IOINFO_ARRAY_ELTS

#define IOINFO_ARRAY_ELTS   (1 << IOINFO_L2E)

Definition at line 2427 of file win32.c.

Referenced by _pioinfo().

◆ IOINFO_L2E

#define IOINFO_L2E   5

Definition at line 2423 of file win32.c.

Referenced by _pioinfo().

◆ isdirsep

#define isdirsep (   x)    ((x) == '/' || (x) == '\\')

Definition at line 56 of file win32.c.

Referenced by is_command_com(), and open_dir_handle().

◆ LK_ERR

#define LK_ERR (   f,
 
)
Value:
do { \
if (f) \
i = 0; \
else { \
DWORD err = GetLastError(); \
if (err == ERROR_LOCK_VIOLATION || err == ERROR_IO_PENDING) \
errno = EWOULDBLOCK; \
else if (err == ERROR_NOT_LOCKED) \
i = 0; \
else \
errno = map_errno(err); \
} \
} while (0)
int err
Definition: win32.c:135
#define f
#define EWOULDBLOCK
Definition: rubysocket.h:128
#define map_errno
Definition: win32.c:293

Definition at line 327 of file win32.c.

Referenced by flock_winnt().

◆ LK_LEN

#define LK_LEN   ULONG_MAX

Definition at line 341 of file win32.c.

Referenced by flock_winnt(), rb_w32_close(), rb_w32_fclose(), and rb_w32_unwrap_io_handle().

◆ MAKE_SOCKDATA

#define MAKE_SOCKDATA (   af,
  fl 
)    ((int)((((int)af)<<4)|((fl)&0xFFFF)))

Definition at line 773 of file win32.c.

Referenced by rb_w32_socket(), setfl(), and socketpair().

◆ map_errno

#define map_errno   rb_w32_map_errno

◆ MAXCHILDNUM

#define MAXCHILDNUM   256 /* max num of child processes */

Definition at line 872 of file win32.c.

Referenced by waitpid().

◆ mbstr_to_wstr

#define mbstr_to_wstr   rb_w32_mbstr_to_wstr

◆ msghdr_to_wsamsg

#define msghdr_to_wsamsg (   msg,
  wsamsg 
)
Value:
do { \
int i; \
(wsamsg)->name = (msg)->msg_name; \
(wsamsg)->namelen = (msg)->msg_namelen; \
(wsamsg)->lpBuffers = ALLOCA_N(WSABUF, (msg)->msg_iovlen); \
(wsamsg)->dwBufferCount = (msg)->msg_iovlen; \
for (i = 0; i < (msg)->msg_iovlen; ++i) { \
(wsamsg)->lpBuffers[i].buf = (msg)->msg_iov[i].iov_base; \
(wsamsg)->lpBuffers[i].len = (msg)->msg_iov[i].iov_len; \
} \
(wsamsg)->Control.buf = (msg)->msg_control; \
(wsamsg)->Control.len = (msg)->msg_controllen; \
(wsamsg)->dwFlags = (msg)->msg_flags; \
} while (0)
static char msg[50]
Definition: strerror.c:8
#define ALLOCA_N(type, n)
Definition: ruby.h:1593
unsigned char buf[MIME_BUF_SIZE]
Definition: nkf.c:4309
register unsigned int len
Definition: zonetab.h:51
const char * name
Definition: nkf.c:208

Definition at line 3577 of file win32.c.

Referenced by recvmsg(), and sendmsg().

◆ NTGLOB

#define NTGLOB   0x1

Definition at line 1533 of file win32.c.

◆ NTMALLOC

#define NTMALLOC   0x2

Definition at line 1534 of file win32.c.

Referenced by cmdglob(), insert(), and w32_cmdvector().

◆ NTSTRING

#define NTSTRING   0x4

Definition at line 1535 of file win32.c.

◆ open_null

#define open_null (   fd)
Value:
(((nullfd < 0) ? \
(nullfd = open("NUL", O_RDWR)) : 0), \
((nullfd == (fd)) ? (keep = 1) : dup2(nullfd, fd)), \
(fd))
RUBY_EXTERN int dup2(int, int)
Definition: dup2.c:27

Referenced by init_stdhandle().

◆ pioinfo_extra

#define pioinfo_extra   0

Definition at line 2519 of file win32.c.

◆ rb_acrt_lowio_lock_fh

#define rb_acrt_lowio_lock_fh (   i)    EnterCriticalSection(&_pioinfo(i)->lock)

Definition at line 2430 of file win32.c.

Referenced by rb_w32_open_osfhandle(), rb_w32_pipe(), rb_w32_read(), rb_w32_write(), and w32_wopen().

◆ rb_acrt_lowio_unlock_fh

#define rb_acrt_lowio_unlock_fh (   i)    LeaveCriticalSection(&_pioinfo(i)->lock)

Definition at line 2431 of file win32.c.

Referenced by rb_w32_open_osfhandle(), rb_w32_pipe(), rb_w32_read(), rb_w32_write(), and w32_wopen().

◆ rb_w32_stati64

#define rb_w32_stati64 (   path,
  st 
)    w32_stati64(path, st, cp)

Definition at line 70 of file win32.c.

Referenced by rb_w32_access(), and rb_w32_stat().

◆ ROOT_GID

#define ROOT_GID   0

Definition at line 2705 of file win32.c.

Referenced by getegid(), getgid(), and setgid().

◆ ROOT_UID

#define ROOT_UID   0

Definition at line 2704 of file win32.c.

Referenced by geteuid(), getuid(), and setuid().

◆ RUBY_CRITICAL

#define RUBY_CRITICAL   if (0) {} else /* just remark */

◆ set_env_val

#define set_env_val (   vname)
Value:
do { \
typedef char wk_name_offset[(numberof(wk.name) - (numberof(vname) - 1)) * 2 + 1]; \
WCHAR *const buf = wk.name + sizeof(wk_name_offset) / 2; \
MEMCPY(buf, vname, WCHAR, numberof(vname) - 1); \
_wputenv(buf); \
} while (0)
#define numberof(array)
Definition: etc.c:616
unsigned char buf[MIME_BUF_SIZE]
Definition: nkf.c:4309

Referenced by init_env().

◆ set_new_std_fd

#define set_new_std_fd (   newfd)    set_new_std_handle(newfd, (HANDLE)rb_w32_get_osfhandle(newfd))

Definition at line 6092 of file win32.c.

Referenced by rb_w32_dup2().

◆ set_new_std_handle

#define set_new_std_handle (   newfd,
  handle 
)
Value:
do { \
if ((unsigned)(newfd) > 2) break; \
SetStdHandle(STD_INPUT_HANDLE+(STD_OUTPUT_HANDLE-STD_INPUT_HANDLE)*(newfd), \
(handle)); \
} while (0)

Definition at line 6087 of file win32.c.

◆ SetBit

#define SetBit (   bits,
 
)    ((bits)[(i) / CHAR_BIT] |= (1 << (i) % CHAR_BIT))

Definition at line 1924 of file win32.c.

Referenced by w32_wopendir().

◆ STRNDUPV

#define STRNDUPV (   ptr,
  v,
  src,
  len 
)    (((char *)memcpy(((ptr) = ALLOCV((v), (len) + 1)), (src), (len)))[len] = 0)

Definition at line 1144 of file win32.c.

Referenced by w32_aspawn_flags(), and w32_spawn().

◆ SYMBOLIC_LINK_FLAG_DIRECTORY

#define SYMBOLIC_LINK_FLAG_DIRECTORY   (0x1)

Definition at line 5037 of file win32.c.

Referenced by w32_symlink().

◆ TO_SOCKET

#define TO_SOCKET (   x)    _get_osfhandle(x)

◆ utf8_to_wstr

#define utf8_to_wstr (   str,
  plen 
)    mbstr_to_wstr(CP_UTF8, str, -1, plen)

◆ WSAID_WSARECVMSG

#define WSAID_WSARECVMSG   {0xf689d7c8,0x6f1f,0x436b,{0x8a,0x53,0xe5,0x4f,0xe3,0x51,0xc3,0x22}}

Definition at line 3570 of file win32.c.

Referenced by recvmsg().

◆ WSAID_WSASENDMSG

#define WSAID_WSASENDMSG   {0xa441e712,0x754f,0x43ca,{0x84,0xa7,0x0d,0xee,0x44,0xcf,0x60,0x6d}}

Definition at line 3573 of file win32.c.

Referenced by sendmsg().

◆ wstr_to_acp

#define wstr_to_acp (   str,
  plen 
)    wstr_to_mbstr(CP_ACP, str, -1, plen)

Definition at line 1277 of file win32.c.

◆ wstr_to_filecp

#define wstr_to_filecp (   str,
  plen 
)    wstr_to_mbstr(filecp(), str, -1, plen)

Definition at line 1279 of file win32.c.

Referenced by rb_w32_conv_from_wstr().

◆ wstr_to_mbstr

#define wstr_to_mbstr   rb_w32_wstr_to_mbstr

Definition at line 1275 of file win32.c.

Referenced by w32_getenv(), and win32_direct_conv().

◆ wstr_to_utf8

#define wstr_to_utf8 (   str,
  plen 
)    wstr_to_mbstr(CP_UTF8, str, -1, plen)

Definition at line 1281 of file win32.c.

Referenced by rb_w32_get_environ().

◆ yield_once

#define yield_once ( )    Sleep(0)

Definition at line 5909 of file win32.c.

Referenced by rb_w32_asynchronize().

◆ yield_until

#define yield_until (   condition)    do yield_once(); while (!(condition))

Definition at line 5910 of file win32.c.

Referenced by rb_w32_asynchronize().

Typedef Documentation

◆ cigl_t

typedef DWORD(WINAPI * cigl_t) (const GUID *, NET_LUID *)

Definition at line 4097 of file win32.c.

◆ cilnA_t

typedef DWORD(WINAPI * cilnA_t) (const NET_LUID *, char *, size_t)

Definition at line 4098 of file win32.c.

◆ get_final_path_func

typedef DWORD(WINAPI * get_final_path_func) (HANDLE, WCHAR *, DWORD, DWORD)

Definition at line 1884 of file win32.c.

◆ NtCmdLineElement

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
constat_init 
constat_esc 
constat_seq 

Definition at line 706 of file win32.c.

Function Documentation

◆ _pioinfo()

static ioinfo * _pioinfo ( int  fd)
inlinestatic

Definition at line 2523 of file win32.c.

References IOINFO_ARRAY_ELTS, and IOINFO_L2E.

◆ call_asynchronous()

static DWORD WINAPI call_asynchronous ( PVOID  argp)
static

◆ check_if_wdir()

static int check_if_wdir ( const WCHAR *  wfile)
static

Definition at line 6129 of file win32.c.

References check_valid_dir(), errno, FALSE, and TRUE.

Referenced by w32_wopen().

◆ check_spawn_mode()

static int check_spawn_mode ( int  mode)
static

Definition at line 1149 of file win32.c.

References errno, and P_NOWAIT.

Referenced by w32_aspawn_flags(), and w32_spawn().

◆ check_valid_dir()

static int check_valid_dir ( const WCHAR *  path)
static

Definition at line 5468 of file win32.c.

References errno, L, map_errno, open_dir_handle(), and PATH_MAX.

Referenced by check_if_wdir(), winnt_lstat(), and winnt_stat().

◆ child_result()

static rb_pid_t child_result ( struct ChildRecord child,
int  mode 
)
static

Definition at line 1163 of file win32.c.

References CloseChildHandle(), ChildRecord::hProcess, and ChildRecord::pid.

Referenced by w32_aspawn_flags(), and w32_spawn().

◆ chown()

int chown ( const char *  path,
int  owner,
int  group 
)

Definition at line 4698 of file win32.c.

Referenced by argf_next_argv(), chown_internal(), get_device_once(), and rb_file_chown().

◆ clock_getres()

int clock_getres ( clockid_t  clock_id,
struct timespec sp 
)

Definition at line 4630 of file win32.c.

References CLOCK_MONOTONIC, CLOCK_REALTIME, errno, map_errno, timespec::tv_nsec, and timespec::tv_sec.

Referenced by rb_clock_getres().

◆ clock_gettime()

int clock_gettime ( clockid_t  clock_id,
struct timespec sp 
)

◆ CloseChildHandle()

static void CloseChildHandle ( struct ChildRecord child)
static

Definition at line 914 of file win32.c.

References ChildRecord::hProcess, NULL, and ChildRecord::pid.

Referenced by child_result(), and poll_child_status().

◆ cmdglob()

static NtCmdLineElement** cmdglob ( NtCmdLineElement patt,
NtCmdLineElement **  tail,
UINT  cp,
rb_encoding enc 
)
static

◆ compare()

static int compare ( const struct timeval t1,
const struct timeval t2 
)
inlinestatic

Definition at line 3040 of file win32.c.

References rb_w32_check_interrupt(), timeval::tv_sec, and timeval::tv_usec.

Referenced by rb_w32_select_with_thread().

◆ console_emulator_p()

static int console_emulator_p ( void  )
static

Definition at line 6470 of file win32.c.

References FALSE, and func.

Referenced by constat_handle().

◆ constat_apply()

static void constat_apply ( HANDLE  handle,
struct constat s,
WCHAR  w 
)
static

◆ constat_attr()

static WORD constat_attr ( int  count,
const int *  seq,
WORD  attr,
WORD  default_attr,
int *  reverse 
)
static

Definition at line 6545 of file win32.c.

References constat::attr, COMMON_LVB_UNDERSCORE, constat_attr_color_reverse, and constat::reverse.

Referenced by constat_apply().

◆ constat_delete()

static void constat_delete ( HANDLE  h)
static

Definition at line 718 of file win32.c.

References conlist_disabled, key, st_data_t, st_delete, val, and xfree().

Referenced by rb_w32_close(), and rb_w32_unwrap_io_handle().

◆ constat_handle()

static struct constat* constat_handle ( HANDLE  h)
static

◆ constat_parse()

static long constat_parse ( HANDLE  h,
struct constat s,
const WCHAR **  ptrp,
long *  lenp 
)
static

◆ constat_reset()

static void constat_reset ( HANDLE  h)
static

Definition at line 6525 of file win32.c.

References conlist_disabled, constat_init, st_data_t, st_lookup, constat::state, and constat::vt100.

Referenced by rb_w32_read().

◆ copy_fd()

static int copy_fd ( fd_set *  dst,
fd_set *  src 
)
static

Definition at line 2880 of file win32.c.

Referenced by rb_w32_select_with_thread().

◆ CreateChild()

static struct ChildRecord * CreateChild ( const WCHAR *  cmd,
const WCHAR *  prog,
SECURITY_ATTRIBUTES *  psa,
HANDLE  hInput,
HANDLE  hOutput,
HANDLE  hError,
DWORD  dwCreationFlags 
)
static

◆ do_select()

static int do_select ( int  nfds,
fd_set *  rd,
fd_set *  wr,
fd_set *  ex,
struct timeval timeout 
)
static

◆ dupfd()

static int dupfd ( HANDLE  hDup,
int  flags,
int  minfd 
)
static

Definition at line 4262 of file win32.c.

References _set_osfhnd, errno, FOPEN, and numberof.

Referenced by fcntl().

◆ endhostent()

void endhostent ( void  )

Definition at line 4206 of file win32.c.

◆ endnetent()

void endnetent ( void  )

Definition at line 4207 of file win32.c.

◆ endprotoent()

void endprotoent ( void  )

Definition at line 4208 of file win32.c.

◆ endservent()

void endservent ( void  )

Definition at line 4209 of file win32.c.

◆ exit_handler()

static void exit_handler ( void  )
static

◆ extract_fd()

static int extract_fd ( rb_fdset_t dst,
fd_set *  src,
int(*)(SOCKET)  func 
)
static

Definition at line 2838 of file win32.c.

References func, memmove(), and xrealloc.

Referenced by rb_w32_select_with_thread().

◆ fchmod()

int fchmod ( int  fd,
int  mode 
)

Definition at line 7481 of file win32.c.

References errno, get_proc_address(), if(), map_errno, and NULL.

Referenced by argf_next_argv(), and rb_file_chmod().

◆ fcntl()

int fcntl ( int  fd,
int  cmd,
  ... 
)

◆ fileattr_to_unixmode()

static unsigned fileattr_to_unixmode ( DWORD  attr,
const WCHAR *  path 
)
static

Definition at line 5419 of file win32.c.

References L, rb_w32_reparse_symlink_p(), S_IFLNK, and S_IWUSR.

Referenced by stat_by_find(), winnt_lstat(), and winnt_stat().

◆ filecp()

UINT filecp ( void  )

Definition at line 2070 of file win32.c.

◆ filetime_to_clock()

static long filetime_to_clock ( FILETIME *  ft)
static

Definition at line 5877 of file win32.c.

Referenced by rb_w32_times().

◆ filetime_to_timeval()

static int filetime_to_timeval ( const FILETIME *  ft,
struct timeval tv 
)
static

Definition at line 4556 of file win32.c.

References lt, timeval::tv_sec, and timeval::tv_usec.

Referenced by filetime_to_unixtime(), and gettimeofday().

◆ filetime_to_unixtime()

static time_t filetime_to_unixtime ( const FILETIME *  ft)
static

Definition at line 5407 of file win32.c.

References filetime_to_timeval(), and timeval::tv_sec.

Referenced by rb_w32_fstat(), stat_by_find(), stati64_handle(), and winnt_lstat().

◆ FindChildSlot()

static struct ChildRecord* FindChildSlot ( rb_pid_t  pid)
static

Definition at line 888 of file win32.c.

References END_FOREACH_CHILD, FOREACH_CHILD, and NULL.

Referenced by kill(), and waitpid().

◆ FindChildSlotByHandle()

static struct ChildRecord* FindChildSlotByHandle ( HANDLE  h)
static

Definition at line 901 of file win32.c.

References END_FOREACH_CHILD, FOREACH_CHILD, and NULL.

Referenced by waitpid().

◆ FindFreeChildSlot()

static struct ChildRecord* FindFreeChildSlot ( void  )
static

Definition at line 924 of file win32.c.

References END_FOREACH_CHILD, FOREACH_CHILD, and NULL.

Referenced by CreateChild().

◆ finish_overlapped()

static void finish_overlapped ( OVERLAPPED *  ol,
int  fd,
DWORD  size 
)
static

Definition at line 6889 of file win32.c.

References _osfhnd, _osfile, FDEV, FPIPE, and size.

Referenced by rb_w32_read(), and rb_w32_write().

◆ finish_overlapped_socket()

static int finish_overlapped_socket ( BOOL  input,
SOCKET  s,
WSAOVERLAPPED *  wol,
int  result,
DWORD len,
DWORD  size 
)
static

Definition at line 3402 of file win32.c.

References err, errno, map_errno, rb_w32_wait_events_blocking(), result, RUBY_CRITICAL, size, and TRUE.

Referenced by overlapped_socket_io(), recvmsg(), and sendmsg().

◆ flock()

int flock ( int  fd,
int  oper 
)

Definition at line 384 of file win32.c.

References flock_winnt(), NULL, and rb_w32_asynchronize().

Referenced by ioctl_narg_len(), and rb_thread_flock().

◆ flock_winnt()

static uintptr_t flock_winnt ( uintptr_t  self,
int  argc,
uintptr_t argv 
)
static

Definition at line 345 of file win32.c.

References argc, errno, LK_ERR, LK_LEN, LOCK_EX, LOCK_NB, LOCK_SH, and LOCK_UN.

Referenced by flock().

◆ free_conlist()

static int free_conlist ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

Definition at line 710 of file win32.c.

References ST_DELETE, and xfree().

Referenced by exit_handler().

◆ freeifaddrs()

void freeifaddrs ( struct ifaddrs ifp)

Definition at line 4190 of file win32.c.

References ifaddrs::ifa_addr, ifaddrs::ifa_name, ifaddrs::ifa_next, and ruby_xfree().

Referenced by sock_s_unpack_sockaddr_in().

◆ get_attr_vsn()

static DWORD get_attr_vsn ( const WCHAR *  path,
DWORD atts,
DWORD vsn 
)
static

Definition at line 5156 of file win32.c.

References ASSUME, and open_special().

Referenced by wrename().

◆ get_final_path_fail()

static DWORD WINAPI get_final_path_fail ( HANDLE  f,
WCHAR *  buf,
DWORD  len,
DWORD  flag 
)
static

Definition at line 1888 of file win32.c.

Referenced by get_final_path_unknown().

◆ get_final_path_unknown()

static DWORD WINAPI get_final_path_unknown ( HANDLE  f,
WCHAR *  buf,
DWORD  len,
DWORD  flag 
)
static

Definition at line 1894 of file win32.c.

References func, get_final_path, get_final_path_fail(), get_proc_address(), and NULL.

◆ get_proc_address()

static FARPROC get_proc_address ( const char *  module,
const char *  func,
HANDLE *  mh 
)
static

◆ get_special_folder()

static BOOL get_special_folder ( int  n,
WCHAR *  buf,
size_t  len 
)
static

Definition at line 434 of file win32.c.

References f, FALSE, func, get_proc_address(), and NULL.

Referenced by init_env(), rb_w32_home_dir(), rb_w32_special_folder(), and rb_w32_system_tmpdir().

◆ get_version()

static void get_version ( void  )
static

Definition at line 301 of file win32.c.

References osver, and rb_w32_osid().

Referenced by rb_w32_sysinit().

◆ get_wsa_extension_function()

static FARPROC get_wsa_extension_function ( SOCKET  s,
GUID *  guid 
)
static

Definition at line 3205 of file win32.c.

References errno, and NULL.

Referenced by recvmsg(), and sendmsg().

◆ getegid()

rb_gid_t getegid ( void  )

◆ geteuid()

rb_uid_t geteuid ( void  )

◆ getgid()

rb_gid_t getgid ( void  )

◆ getifaddrs()

int getifaddrs ( struct ifaddrs **  ifap)

◆ getlogin()

char* getlogin ( void  )

Definition at line 867 of file win32.c.

References NTLoginName.

Referenced by establishShell(), etc_getlogin(), rb_default_home_dir(), and rb_home_dir_of().

◆ getnetbyaddr()

struct netent* getnetbyaddr ( long  net,
int  type 
)

Definition at line 4213 of file win32.c.

References NULL.

◆ getnetbyname()

struct netent* getnetbyname ( const char *  name)

Definition at line 4215 of file win32.c.

References NULL.

◆ getnetent()

struct netent* getnetent ( void  )

Definition at line 4211 of file win32.c.

References NULL.

◆ getprotoent()

struct protoent* getprotoent ( void  )

Definition at line 4217 of file win32.c.

References NULL.

◆ getservent()

struct servent* getservent ( void  )

Definition at line 4219 of file win32.c.

References NULL.

◆ gettimeofday()

int __cdecl gettimeofday ( struct timeval tv,
struct timezone tz 
)

◆ getuid()

rb_uid_t getuid ( void  )

◆ gmtime_r()

struct tm* gmtime_r ( const time_t *  tp,
struct tm *  rp 
)

Definition at line 7681 of file win32.c.

References errno, NULL, systemtime_to_tm(), and unixtime_to_systemtime().

◆ has_redirection()

static int has_redirection ( const char *  cmd,
UINT  cp 
)
static

Definition at line 1589 of file win32.c.

References FALSE, ISALNUM, ISALPHA, and TRUE.

Referenced by w32_spawn().

◆ init_env()

static void init_env ( void  )
static

◆ init_stdhandle()

static void init_stdhandle ( void  )
static

Definition at line 2595 of file win32.c.

References FILE_FILENO, fileno, NULL, O_BINARY, and open_null.

Referenced by init_env(), and rb_w32_sysinit().

◆ insert()

static int insert ( const char *  path,
VALUE  vinfo,
void *  enc 
)
static

◆ internal_cmd_match()

static int internal_cmd_match ( const char *  cmdname,
int  nt 
)
static

Definition at line 1049 of file win32.c.

References internal_match(), and szInternalCmds.

Referenced by is_command_com(), is_internal_cmd(), and w32_aspawn_flags().

◆ internal_match()

static int internal_match ( const void *  key,
const void *  elem 
)
static

Definition at line 998 of file win32.c.

References InternalCmdsMax.

Referenced by internal_cmd_match().

◆ ioctl()

int ioctl ( int  i,
int  u,
  ... 
)

Definition at line 2755 of file win32.c.

References errno.

Referenced by chfunc(), get_device_once(), io_nread(), and sock_s_unpack_sockaddr_in().

◆ is_batch()

static int is_batch ( const char *  cmd)
static

Definition at line 1262 of file win32.c.

References len, strcasecmp, and strlen().

Referenced by w32_aspawn_flags(), and w32_spawn().

◆ is_command_com()

static int is_command_com ( const char *  interp)
static

Definition at line 1005 of file win32.c.

References internal_cmd_match(), isdirsep, strcasecmp, and strlen().

Referenced by w32_aspawn_flags(), and w32_spawn().

◆ is_console()

static int is_console ( SOCKET  sock)
static

Definition at line 2941 of file win32.c.

References RUBY_CRITICAL.

Referenced by rb_w32_io_cancelable_p(), rb_w32_read(), and rb_w32_select_with_thread().

◆ is_internal_cmd()

static int is_internal_cmd ( const char *  cmd,
int  nt 
)
static

Definition at line 1020 of file win32.c.

References internal_cmd_match().

Referenced by w32_spawn().

◆ is_invalid_handle()

static int is_invalid_handle ( SOCKET  sock)
static

Definition at line 2979 of file win32.c.

Referenced by rb_w32_select_with_thread().

◆ is_not_socket()

static int is_not_socket ( SOCKET  sock)
static

Definition at line 2902 of file win32.c.

References is_socket().

Referenced by rb_w32_select_with_thread().

◆ is_pipe()

static int is_pipe ( SOCKET  sock)
static

Definition at line 2909 of file win32.c.

References RUBY_CRITICAL.

Referenced by rb_w32_select_with_thread(), and rb_w32_set_nonblock().

◆ is_readable_console()

static int is_readable_console ( SOCKET  sock)
static

Definition at line 2956 of file win32.c.

References RUBY_CRITICAL.

Referenced by rb_w32_select_with_thread().

◆ is_readable_pipe()

static int is_readable_pipe ( SOCKET  sock)
static

Definition at line 2922 of file win32.c.

References NULL, and RUBY_CRITICAL.

Referenced by rb_w32_select_with_thread().

◆ is_socket()

static int is_socket ( SOCKET  sock)
static

◆ isUNCRoot()

static int isUNCRoot ( const WCHAR *  path)
static

Definition at line 5265 of file win32.c.

References L.

Referenced by name_for_stat().

◆ join_argv()

static int join_argv ( char *  cmd,
char *const argv,
BOOL  escape,
UINT  cp,
int  backslash 
)
static

Definition at line 1071 of file win32.c.

References len, memcpy, and translate_char().

Referenced by w32_aspawn_flags().

◆ kill()

int kill ( int  pid,
int  sig 
)

◆ lchown()

int lchown ( const char *  path,
int  owner,
int  group 
)

Definition at line 4711 of file win32.c.

Referenced by rb_file_chown().

◆ link()

int link ( const char *  from,
const char *  to 
)

◆ localtime_r()

struct tm* localtime_r ( const time_t *  tp,
struct tm *  rp 
)

◆ move_to_next_entry()

static void move_to_next_entry ( DIR dirp)
static

Definition at line 2140 of file win32.c.

References DIR::curr, DIR::loc, NULL, DIR::size, and DIR::start.

Referenced by rb_w32_seekdir(), and readdir_internal().

◆ name_for_stat()

static WCHAR * name_for_stat ( WCHAR *  buf,
const WCHAR *  path 
)
static

Definition at line 5681 of file win32.c.

References errno, isUNCRoot(), len, and NULL.

Referenced by wlstati64(), and wstati64().

◆ open_dir_handle()

static HANDLE open_dir_handle ( const WCHAR *  filename,
WIN32_FIND_DATAW *  fd 
)
static

Definition at line 1932 of file win32.c.

References errno, get_final_path, isdirsep, L, len, map_errno, MEMCPY, open_special(), PATH_MAX, and rb_strlen_lit.

Referenced by check_valid_dir(), and w32_wopendir().

◆ open_ifs_socket()

static SOCKET open_ifs_socket ( int  af,
int  type,
int  protocol 
)
static

Definition at line 3739 of file win32.c.

References AF_UNSPEC, free(), malloc, and NULL.

Referenced by rb_w32_socket(), and socketpair_internal().

◆ open_special()

static HANDLE open_special ( const WCHAR *  path,
DWORD  access,
DWORD  flags 
)
static

Definition at line 1908 of file win32.c.

References NULL.

Referenced by get_attr_vsn(), open_dir_handle(), reparse_symlink(), winnt_stat(), wrename(), and wutime().

◆ overlapped_socket_io()

static int overlapped_socket_io ( BOOL  input,
int  fd,
char *  buf,
int  len,
int  flags,
struct sockaddr *  addr,
int *  addrlen 
)
static

◆ path_drive()

static int path_drive ( const WCHAR *  path)
static

Definition at line 5536 of file win32.c.

References L.

Referenced by rb_file_expand_path_internal(), winnt_lstat(), and winnt_stat().

◆ poll_child_status()

static rb_pid_t poll_child_status ( struct ChildRecord child,
int *  stat_loc 
)
static

◆ rb_chsize()

static int rb_chsize ( HANDLE  h,
off_t  size 
)
static

Definition at line 5801 of file win32.c.

References errno, map_errno, SEEK_CUR, and SEEK_SET.

Referenced by rb_w32_ftruncate(), and w32_truncate().

◆ rb_w32_accept()

int WSAAPI rb_w32_accept ( int  s,
struct sockaddr *  addr,
int *  addrlen 
)

◆ rb_w32_access()

int rb_w32_access ( const char *  path,
int  mode 
)

Definition at line 5771 of file win32.c.

References errno, and rb_w32_stati64.

◆ rb_w32_aspawn()

rb_pid_t rb_w32_aspawn ( int  mode,
const char *  prog,
char *const argv 
)

Definition at line 1509 of file win32.c.

References rb_w32_aspawn_flags().

◆ rb_w32_aspawn_flags()

rb_pid_t rb_w32_aspawn_flags ( int  mode,
const char *  prog,
char *const argv,
DWORD  flags 
)

Definition at line 1494 of file win32.c.

References filecp, and w32_aspawn_flags().

Referenced by rb_w32_aspawn().

◆ rb_w32_asynchronize()

uintptr_t rb_w32_asynchronize ( asynchronous_func_t  func,
uintptr_t  self,
int  argc,
uintptr_t argv,
uintptr_t  intrval 
)

◆ rb_w32_bind()

int WSAAPI rb_w32_bind ( int  s,
const struct sockaddr *  addr,
int  addrlen 
)

Definition at line 3251 of file win32.c.

References errno, map_errno, NtSocketsInitialized, RUBY_CRITICAL, StartSockets(), and TO_SOCKET.

◆ rb_w32_check_interrupt()

int rb_w32_check_interrupt ( void *  )

◆ rb_w32_close()

int rb_w32_close ( int  fd)

Definition at line 6834 of file win32.c.

References _set_osfhnd, constat_delete(), errno, is_socket(), LK_LEN, map_errno, NULL, socklist_delete(), and TO_SOCKET.

Referenced by rb_w32_pipe(), and socketpair().

◆ rb_w32_closedir()

void rb_w32_closedir ( DIR dirp)

Definition at line 2340 of file win32.c.

References DIR::bits, direct::d_altname, direct::d_name, DIR::dirstr, free(), and DIR::start.

Referenced by w32_wopendir().

◆ rb_w32_connect()

int WSAAPI rb_w32_connect ( int  s,
const struct sockaddr *  addr,
int  addrlen 
)

◆ rb_w32_conv_from_wchar()

VALUE rb_w32_conv_from_wchar ( const WCHAR *  wstr,
rb_encoding enc 
)

◆ rb_w32_conv_from_wstr()

char* rb_w32_conv_from_wstr ( const WCHAR *  wstr,
long *  lenp,
rb_encoding enc 
)

Definition at line 2204 of file win32.c.

References len, malloc, memcpy, NIL_P, rb_w32_conv_from_wchar(), RSTRING_LEN, RSTRING_PTR, and wstr_to_filecp.

Referenced by ruby_direct_conv().

◆ rb_w32_dup2()

int rb_w32_dup2 ( int  oldfd,
int  newfd 
)

Definition at line 6096 of file win32.c.

References dup2(), and set_new_std_fd.

◆ rb_w32_fclose()

int rb_w32_fclose ( FILE fp)

Definition at line 6351 of file win32.c.

References _set_osfhnd, errno, fileno, is_socket(), LK_LEN, map_errno, and TO_SOCKET.

◆ rb_w32_fd_copy()

void rb_w32_fd_copy ( rb_fdset_t dst,
const fd_set *  src,
int  max 
)

Definition at line 2801 of file win32.c.

References memcpy, and xrealloc.

◆ rb_w32_fd_dup()

void rb_w32_fd_dup ( rb_fdset_t dst,
const rb_fdset_t src 
)

Definition at line 2816 of file win32.c.

References memcpy, and xrealloc.

◆ rb_w32_fd_is_text()

char rb_w32_fd_is_text ( int  fd)

Definition at line 7599 of file win32.c.

References _osfile, and FTEXT.

◆ rb_w32_fdclr()

void rb_w32_fdclr ( int  fd,
fd_set *  set 
)

Definition at line 2771 of file win32.c.

References memmove(), and TO_SOCKET.

◆ rb_w32_fdisset()

int rb_w32_fdisset ( int  fd,
fd_set *  set 
)

Definition at line 2789 of file win32.c.

References RUBY_CRITICAL, and TO_SOCKET.

◆ rb_w32_fdset()

void rb_w32_fdset ( int  fd,
fd_set *  set 
)

Definition at line 2762 of file win32.c.

References FD_SET.

◆ rb_w32_free_environ()

void rb_w32_free_environ ( char **  env)

Definition at line 6039 of file win32.c.

References env, and free().

◆ rb_w32_fstat()

int rb_w32_fstat ( int  fd,
struct stat st 
)

Definition at line 5351 of file win32.c.

References filetime_to_unixtime(), fstat, L, and NULL.

◆ rb_w32_fstati64()

int rb_w32_fstati64 ( int  fd,
struct stati64 *  st 
)

Definition at line 5368 of file win32.c.

References COPY_STAT, fstat, L, NULL, stat, stati64_handle(), and stati64_set_inode_handle().

◆ rb_w32_ftruncate()

int rb_w32_ftruncate ( int  fd,
off_t  length 
)

Definition at line 5866 of file win32.c.

References rb_chsize().

◆ rb_w32_get_environ()

char** rb_w32_get_environ ( void  )

Definition at line 6002 of file win32.c.

References env, malloc, NULL, and wstr_to_utf8.

◆ rb_w32_get_osfhandle()

SOCKET rb_w32_get_osfhandle ( int  fh)

◆ rb_w32_getcwd()

char* rb_w32_getcwd ( char *  buffer,
int  size 
)

Definition at line 4658 of file win32.c.

References errno, filecp, free(), len, malloc, map_errno, NULL, and translate_char().

◆ rb_w32_getenv()

char* rb_w32_getenv ( const char *  name)

Definition at line 5149 of file win32.c.

References w32_getenv().

◆ rb_w32_gethostbyaddr()

struct hostent* WSAAPI rb_w32_gethostbyaddr ( const char *  addr,
int  len,
int  type 
)

Definition at line 3820 of file win32.c.

References errno, map_errno, NtSocketsInitialized, NULL, RUBY_CRITICAL, and StartSockets().

◆ rb_w32_gethostbyname()

struct hostent* WSAAPI rb_w32_gethostbyname ( const char *  name)

Definition at line 3838 of file win32.c.

References errno, map_errno, NtSocketsInitialized, NULL, RUBY_CRITICAL, and StartSockets().

◆ rb_w32_gethostname()

int WSAAPI rb_w32_gethostname ( char *  name,
int  len 
)

Definition at line 3856 of file win32.c.

References errno, map_errno, NtSocketsInitialized, RUBY_CRITICAL, and StartSockets().

◆ rb_w32_getpeername()

int WSAAPI rb_w32_getpeername ( int  s,
struct sockaddr *  addr,
int *  addrlen 
)

Definition at line 3294 of file win32.c.

References errno, map_errno, NtSocketsInitialized, RUBY_CRITICAL, StartSockets(), and TO_SOCKET.

◆ rb_w32_getpid()

rb_pid_t rb_w32_getpid ( void  )

Definition at line 6049 of file win32.c.

Referenced by rb_w32_pipe().

◆ rb_w32_getppid()

rb_pid_t rb_w32_getppid ( void  )

Definition at line 6057 of file win32.c.

References get_proc_address(), len, NULL, STATIC_ASSERT(), and ULONG().

◆ rb_w32_getprotobyname()

struct protoent* WSAAPI rb_w32_getprotobyname ( const char *  name)

Definition at line 3874 of file win32.c.

References errno, map_errno, NtSocketsInitialized, NULL, RUBY_CRITICAL, and StartSockets().

◆ rb_w32_getprotobynumber()

struct protoent* WSAAPI rb_w32_getprotobynumber ( int  num)

Definition at line 3892 of file win32.c.

References errno, map_errno, NtSocketsInitialized, NULL, RUBY_CRITICAL, and StartSockets().

◆ rb_w32_getservbyname()

struct servent* WSAAPI rb_w32_getservbyname ( const char *  name,
const char *  proto 
)

Definition at line 3910 of file win32.c.

References errno, map_errno, NtSocketsInitialized, NULL, RUBY_CRITICAL, and StartSockets().

◆ rb_w32_getservbyport()

struct servent* WSAAPI rb_w32_getservbyport ( int  port,
const char *  proto 
)

Definition at line 3928 of file win32.c.

References errno, map_errno, NtSocketsInitialized, NULL, RUBY_CRITICAL, and StartSockets().

◆ rb_w32_getsockname()

int WSAAPI rb_w32_getsockname ( int  fd,
struct sockaddr *  addr,
int *  addrlen 
)

◆ rb_w32_getsockopt()

int WSAAPI rb_w32_getsockopt ( int  s,
int  level,
int  optname,
char *  optval,
int *  optlen 
)

Definition at line 3345 of file win32.c.

References errno, map_errno, NtSocketsInitialized, RUBY_CRITICAL, StartSockets(), and TO_SOCKET.

◆ rb_w32_home_dir()

WCHAR* rb_w32_home_dir ( void  )

◆ rb_w32_inet_ntop()

const char* WSAAPI rb_w32_inet_ntop ( int  af,
const void *  addr,
char *  numaddr,
size_t  numaddr_len 
)

Definition at line 7566 of file win32.c.

References get_proc_address(), memcpy, NULL, and snprintf.

◆ rb_w32_inet_pton()

int WSAAPI rb_w32_inet_pton ( int  af,
const char *  src,
void *  dst 
)

Definition at line 7585 of file win32.c.

References get_proc_address(), and NULL.

◆ rb_w32_io_cancelable_p()

int rb_w32_io_cancelable_p ( int  fd)

Definition at line 2546 of file win32.c.

References is_console(), is_socket(), and TO_SOCKET.

◆ rb_w32_ioctlsocket()

int WSAAPI rb_w32_ioctlsocket ( int  s,
long  cmd,
u_long argp 
)

Definition at line 3363 of file win32.c.

References errno, map_errno, NtSocketsInitialized, RUBY_CRITICAL, StartSockets(), and TO_SOCKET.

◆ rb_w32_is_socket()

int rb_w32_is_socket ( int  fd)

Definition at line 2635 of file win32.c.

References is_socket(), and TO_SOCKET.

◆ rb_w32_isatty()

int rb_w32_isatty ( int  fd)

Definition at line 7522 of file win32.c.

References _osfhnd, and errno.

◆ rb_w32_listen()

int WSAAPI rb_w32_listen ( int  s,
int  backlog 
)

Definition at line 3381 of file win32.c.

References errno, map_errno, NtSocketsInitialized, RUBY_CRITICAL, StartSockets(), and TO_SOCKET.

◆ rb_w32_lstati64()

int rb_w32_lstati64 ( const char *  path,
struct stati64 *  st 
)

Definition at line 5750 of file win32.c.

References filecp, and w32_lstati64().

◆ rb_w32_map_errno()

int rb_w32_map_errno ( DWORD  winerr)

Definition at line 273 of file win32.c.

References errmap, and winerr.

Referenced by join_path(), rb_readlink(), and sock_s_unpack_sockaddr_in().

◆ rb_w32_mbstr_to_wstr()

WCHAR* rb_w32_mbstr_to_wstr ( UINT  cp,
const char *  str,
int  clen,
long *  plen 
)

Definition at line 2094 of file win32.c.

References len, malloc, and NULL.

Referenced by dln_load(), and join_path().

◆ rb_w32_mkdir()

int rb_w32_mkdir ( const char *  path,
int  mode 
)

Definition at line 7346 of file win32.c.

References filecp_to_wstr, free(), NULL, and wmkdir().

◆ rb_w32_open()

int rb_w32_open ( const char *  file,
int  oflag,
  ... 
)

Definition at line 6143 of file win32.c.

References filecp_to_wstr, free(), NULL, and w32_wopen().

◆ rb_w32_open_osfhandle()

static int rb_w32_open_osfhandle ( intptr_t  osfhandle,
int  flags 
)
static

◆ rb_w32_opendir()

DIR* rb_w32_opendir ( const char *  filename)

Definition at line 2110 of file win32.c.

References filecp_to_wstr, free(), NULL, and w32_wopendir().

◆ rb_w32_osver()

DWORD rb_w32_osver ( void  )

Definition at line 319 of file win32.c.

References osver.

◆ rb_w32_pipe()

int rb_w32_pipe ( int  fds[2])

◆ rb_w32_read()

ssize_t rb_w32_read ( int  fd,
void *  buf,
size_t  size 
)

◆ rb_w32_read_reparse_point()

int rb_w32_read_reparse_point ( const WCHAR *  path,
rb_w32_reparse_buffer_t rp,
size_t  bufsize,
WCHAR **  result,
DWORD len 
)

◆ rb_w32_readdir()

struct direct* rb_w32_readdir ( DIR dirp,
rb_encoding enc 
)

◆ rb_w32_recv()

int WSAAPI rb_w32_recv ( int  fd,
char *  buf,
int  len,
int  flags 
)

Definition at line 3529 of file win32.c.

References NULL, overlapped_socket_io(), and TRUE.

Referenced by rb_w32_read().

◆ rb_w32_recvfrom()

int WSAAPI rb_w32_recvfrom ( int  fd,
char *  buf,
int  len,
int  flags,
struct sockaddr *  from,
int *  fromlen 
)

Definition at line 3536 of file win32.c.

References overlapped_socket_io(), and TRUE.

◆ rb_w32_rename()

int rb_w32_rename ( const char *  from,
const char *  to 
)

Definition at line 5245 of file win32.c.

References filecp_to_wstr, free(), NULL, and wrename().

◆ rb_w32_reparse_symlink_p()

int rb_w32_reparse_symlink_p ( const WCHAR *  path)

◆ rb_w32_rewinddir()

void rb_w32_rewinddir ( DIR dirp)

Definition at line 2328 of file win32.c.

References DIR::curr, DIR::loc, and DIR::start.

Referenced by rb_w32_seekdir().

◆ rb_w32_rmdir()

int rb_w32_rmdir ( const char *  path)

Definition at line 7381 of file win32.c.

References filecp_to_wstr, free(), NULL, and wrmdir().

◆ rb_w32_seekdir()

void rb_w32_seekdir ( DIR dirp,
long  loc 
)

Definition at line 2313 of file win32.c.

References DIR::curr, DIR::loc, move_to_next_entry(), and rb_w32_rewinddir().

◆ rb_w32_select()

int WSAAPI rb_w32_select ( int  nfds,
fd_set *  rd,
fd_set *  wr,
fd_set *  ex,
struct timeval timeout 
)

Definition at line 3197 of file win32.c.

References rb_w32_select_with_thread().

◆ rb_w32_select_with_thread()

int rb_w32_select_with_thread ( int  nfds,
fd_set *  rd,
fd_set *  wr,
fd_set *  ex,
struct timeval timeout,
void *  th 
)

◆ rb_w32_send()

int WSAAPI rb_w32_send ( int  fd,
const char *  buf,
int  len,
int  flags 
)

Definition at line 3544 of file win32.c.

References FALSE, NULL, and overlapped_socket_io().

Referenced by rb_w32_write().

◆ rb_w32_sendto()

int WSAAPI rb_w32_sendto ( int  fd,
const char *  buf,
int  len,
int  flags,
const struct sockaddr *  to,
int  tolen 
)

Definition at line 3551 of file win32.c.

References FALSE, and overlapped_socket_io().

◆ rb_w32_set_nonblock()

int rb_w32_set_nonblock ( int  fd)

Definition at line 4373 of file win32.c.

References errno, is_pipe(), is_socket(), map_errno, NULL, O_NONBLOCK, setfl(), and TO_SOCKET.

Referenced by rb_io_set_nonblock().

◆ rb_w32_setsockopt()

int WSAAPI rb_w32_setsockopt ( int  s,
int  level,
int  optname,
const char *  optval,
int  optlen 
)

Definition at line 3705 of file win32.c.

References errno, map_errno, NtSocketsInitialized, RUBY_CRITICAL, StartSockets(), and TO_SOCKET.

◆ rb_w32_shutdown()

int WSAAPI rb_w32_shutdown ( int  s,
int  how 
)

Definition at line 3723 of file win32.c.

References errno, map_errno, NtSocketsInitialized, RUBY_CRITICAL, shutdown, StartSockets(), and TO_SOCKET.

◆ rb_w32_socket()

int WSAAPI rb_w32_socket ( int  af,
int  type,
int  protocol 
)

◆ rb_w32_spawn()

rb_pid_t rb_w32_spawn ( int  mode,
const char *  cmd,
const char *  prog 
)

Definition at line 1409 of file win32.c.

References filecp, and w32_spawn().

◆ rb_w32_special_folder()

VALUE rb_w32_special_folder ( int  type)

◆ rb_w32_stat()

int rb_w32_stat ( const char *  path,
struct stat st 
)

Definition at line 5624 of file win32.c.

References COPY_STAT, and rb_w32_stati64.

◆ rb_w32_stati64()

int rb_w32_stati64 ( const char *  path,
struct stati64 *  st 
)

Definition at line 5722 of file win32.c.

References filecp, and w32_stati64().

◆ rb_w32_strerror()

char* rb_w32_strerror ( int  e)

Definition at line 2650 of file win32.c.

References EADDRINUSE, err, errmap, EWOULDBLOCK, memmove(), NULL, strerror(), strlcpy(), strlen(), sys_nerr, and winerr.

◆ rb_w32_sysinit()

void rb_w32_sysinit ( int *  argc,
char ***  argv 
)

◆ rb_w32_system_tmpdir()

UINT rb_w32_system_tmpdir ( WCHAR *  path,
UINT  len 
)

Definition at line 515 of file win32.c.

References CSIDL_LOCAL_APPDATA, get_special_folder(), L, memcpy, numberof, and translate_wchar().

Referenced by etc_systmpdir(), and init_env().

◆ rb_w32_telldir()

long rb_w32_telldir ( DIR dirp)

Definition at line 2302 of file win32.c.

References DIR::loc.

◆ rb_w32_time_subtract()

int rb_w32_time_subtract ( struct timeval rest,
const struct timeval wait 
)

Definition at line 3021 of file win32.c.

References timeval::tv_sec, and timeval::tv_usec.

Referenced by rb_w32_select_with_thread().

◆ rb_w32_times()

int rb_w32_times ( struct tms tmbuf)

◆ rb_w32_truncate()

int rb_w32_truncate ( const char *  path,
off_t  length 
)

Definition at line 5859 of file win32.c.

References filecp, and w32_truncate().

◆ rb_w32_uaccess()

int rb_w32_uaccess ( const char *  path,
int  mode 
)

Definition at line 5786 of file win32.c.

References errno, and rb_w32_ustati64().

◆ rb_w32_uaspawn()

rb_pid_t rb_w32_uaspawn ( int  mode,
const char *  prog,
char *const argv 
)

Definition at line 1516 of file win32.c.

References rb_w32_uaspawn_flags().

Referenced by proc_exec_cmd().

◆ rb_w32_uaspawn_flags()

rb_pid_t rb_w32_uaspawn_flags ( int  mode,
const char *  prog,
char *const argv,
DWORD  flags 
)

Definition at line 1502 of file win32.c.

References w32_aspawn_flags().

Referenced by rb_w32_uaspawn().

◆ rb_w32_uchdir()

int rb_w32_uchdir ( const char *  path)

Definition at line 7298 of file win32.c.

References free(), NULL, and utf8_to_wstr.

◆ rb_w32_uchmod()

int rb_w32_uchmod ( const char *  path,
int  mode 
)

Definition at line 7467 of file win32.c.

References free(), NULL, and utf8_to_wstr.

◆ rb_w32_uchown()

int rb_w32_uchown ( const char *  path,
int  owner,
int  group 
)

Definition at line 4705 of file win32.c.

◆ rb_w32_ugetenv()

char* rb_w32_ugetenv ( const char *  name)

Definition at line 5142 of file win32.c.

References w32_getenv().

◆ rb_w32_ulchown()

int rb_w32_ulchown ( const char *  path,
int  owner,
int  group 
)

Definition at line 4717 of file win32.c.

◆ rb_w32_ulink()

int rb_w32_ulink ( const char *  from,
const char *  to 
)

Definition at line 4846 of file win32.c.

References free(), NULL, utf8_to_wstr, and wlink().

◆ rb_w32_ulstati64()

int rb_w32_ulstati64 ( const char *  path,
struct stati64 *  st 
)

Definition at line 5743 of file win32.c.

References w32_lstati64().

◆ rb_w32_umkdir()

int rb_w32_umkdir ( const char *  path,
int  mode 
)

Definition at line 7332 of file win32.c.

References free(), NULL, utf8_to_wstr, and wmkdir().

◆ rb_w32_unlink()

int rb_w32_unlink ( const char *  path)

Definition at line 7453 of file win32.c.

References filecp_to_wstr, free(), NULL, and wunlink().

◆ rb_w32_unwrap_io_handle()

int rb_w32_unwrap_io_handle ( int  fd)

Definition at line 7751 of file win32.c.

References _set_osfhnd, constat_delete(), is_socket(), LK_LEN, NULL, socklist_delete(), and TO_SOCKET.

◆ rb_w32_uopen()

int rb_w32_uopen ( const char *  file,
int  oflag,
  ... 
)

Definition at line 6109 of file win32.c.

References free(), NULL, utf8_to_wstr, and w32_wopen().

◆ rb_w32_uopendir()

DIR* rb_w32_uopendir ( const char *  filename)

Definition at line 2123 of file win32.c.

References free(), NULL, utf8_to_wstr, and w32_wopendir().

◆ rb_w32_ureadlink()

ssize_t rb_w32_ureadlink ( const char *  path,
char *  buf,
size_t  bufsize 
)

Definition at line 5024 of file win32.c.

References w32_readlink().

◆ rb_w32_urename()

int rb_w32_urename ( const char *  from,
const char *  to 
)

Definition at line 5226 of file win32.c.

References free(), NULL, utf8_to_wstr, and wrename().

◆ rb_w32_urmdir()

int rb_w32_urmdir ( const char *  path)

Definition at line 7395 of file win32.c.

References free(), NULL, utf8_to_wstr, and wrmdir().

◆ rb_w32_uspawn()

rb_pid_t rb_w32_uspawn ( int  mode,
const char *  cmd,
const char *  prog 
)

Definition at line 1417 of file win32.c.

References w32_spawn().

Referenced by proc_exec_sh().

◆ rb_w32_ustati64()

int rb_w32_ustati64 ( const char *  path,
struct stati64 *  st 
)

Definition at line 5715 of file win32.c.

References w32_stati64().

Referenced by rb_w32_uaccess().

◆ rb_w32_usymlink()

int rb_w32_usymlink ( const char *  src,
const char *  link 
)

Definition at line 5087 of file win32.c.

References w32_symlink().

◆ rb_w32_utime()

int rb_w32_utime ( const char *  path,
const struct utimbuf times 
)

Definition at line 7284 of file win32.c.

References filecp_to_wstr, free(), NULL, and wutime().

◆ rb_w32_utruncate()

int rb_w32_utruncate ( const char *  path,
off_t  length 
)

Definition at line 5852 of file win32.c.

References w32_truncate().

◆ rb_w32_uunlink()

int rb_w32_uunlink ( const char *  path)

Definition at line 7439 of file win32.c.

References free(), NULL, utf8_to_wstr, and wunlink().

◆ rb_w32_uutime()

int rb_w32_uutime ( const char *  path,
const struct utimbuf times 
)

Definition at line 7270 of file win32.c.

References free(), NULL, utf8_to_wstr, and wutime().

◆ rb_w32_wait_events()

int rb_w32_wait_events ( HANDLE *  events,
int  num,
DWORD  timeout 
)

Referenced by mustbe_callable().

◆ rb_w32_wopen()

int rb_w32_wopen ( const WCHAR *  file,
int  oflag,
  ... 
)

Definition at line 6163 of file win32.c.

References w32_wopen().

◆ rb_w32_wrap_io_handle()

int rb_w32_wrap_io_handle ( HANDLE  h,
int  flags 
)

Definition at line 7729 of file win32.c.

References errno, f, len, O_NONBLOCK, rb_w32_open_osfhandle(), and socklist_insert().

◆ rb_w32_write()

ssize_t rb_w32_write ( int  fd,
const void *  buf,
size_t  size 
)

◆ rb_w32_write_console()

long rb_w32_write_console ( uintptr_t  strarg,
int  fd 
)

◆ rb_w32_wstr_to_mbstr()

char* rb_w32_wstr_to_mbstr ( UINT  cp,
const WCHAR *  wstr,
int  clen,
long *  plen 
)

Definition at line 2078 of file win32.c.

References len, malloc, and NULL.

Referenced by init_env(), and w32_cmdvector().

◆ readdir_internal()

static struct direct* readdir_internal ( DIR dirp,
BOOL(*)(const WCHAR *, const WCHAR *, struct direct *, const void *)  conv,
const void *  enc 
)
static

◆ readlink()

ssize_t readlink ( const char *  path,
char *  buf,
size_t  bufsize 
)

Definition at line 5031 of file win32.c.

References filecp, and w32_readlink().

Referenced by stub_options().

◆ recvmsg()

int recvmsg ( int  fd,
struct msghdr msg,
int  flags 
)

◆ regulate_path()

static void regulate_path ( WCHAR *  path)
static

Definition at line 464 of file win32.c.

References L, and translate_wchar().

Referenced by init_env(), rb_w32_home_dir(), and rb_w32_special_folder().

◆ reparse_symlink()

static int reparse_symlink ( const WCHAR *  path,
rb_w32_reparse_buffer_t rp,
size_t  size 
)
static

◆ ruby_brace_glob_with_enc()

int ruby_brace_glob_with_enc ( const char *  str,
int  flags,
ruby_glob_func func,
VALUE  arg,
rb_encoding enc 
)

◆ ruby_direct_conv()

static BOOL ruby_direct_conv ( const WCHAR *  file,
const WCHAR *  alt,
struct direct entry,
const void *  enc 
)
static

◆ sendmsg()

int sendmsg ( int  fd,
const struct msghdr msg,
int  flags 
)

◆ setfl()

static int setfl ( SOCKET  sock,
int  arg 
)
static

◆ setgid()

int setgid ( rb_gid_t  gid)

◆ sethostent()

void sethostent ( int  stayopen)

Definition at line 4221 of file win32.c.

◆ setnetent()

void setnetent ( int  stayopen)

Definition at line 4223 of file win32.c.

◆ setprotoent()

void setprotoent ( int  stayopen)

Definition at line 4225 of file win32.c.

◆ setservent()

void setservent ( int  stayopen)

Definition at line 4227 of file win32.c.

◆ setuid()

int setuid ( rb_uid_t  uid)

◆ setup_overlapped()

static int setup_overlapped ( OVERLAPPED *  ol,
int  fd,
int  iswrite 
)
static

Definition at line 6856 of file win32.c.

References _osfhnd, _osfile, err, errno, FAPPEND, FDEV, FPIPE, INVALID_SET_FILE_POINTER, map_errno, NULL, and TRUE.

Referenced by rb_w32_read(), and rb_w32_write().

◆ signbit()

int signbit ( double  x)

◆ skipspace()

static WCHAR* skipspace ( WCHAR *  ptr)
inlinestatic

Definition at line 1638 of file win32.c.

Referenced by w32_cmdvector().

◆ socketpair()

int socketpair ( int  af,
int  type,
int  protocol,
int *  sv 
)

◆ socketpair_internal()

static int socketpair_internal ( int  af,
int  type,
int  protocol,
SOCKET *  sv 
)
static

◆ socklist_delete()

static int socklist_delete ( SOCKET *  sockp,
int *  flagp 
)
inlinestatic

Definition at line 804 of file win32.c.

References key, st_data_t, st_delete, and w32_cmdvector().

Referenced by rb_w32_close(), and rb_w32_unwrap_io_handle().

◆ socklist_insert()

static int socklist_insert ( SOCKET  sock,
int  flag 
)
inlinestatic

Definition at line 779 of file win32.c.

References st_data_t, st_init_numtable, and st_insert.

Referenced by rb_w32_accept(), rb_w32_socket(), rb_w32_wrap_io_handle(), setfl(), and socketpair().

◆ socklist_lookup()

static int socklist_lookup ( SOCKET  sock,
int *  flagp 
)
inlinestatic

Definition at line 788 of file win32.c.

References st_data_t, and st_lookup.

Referenced by is_socket(), overlapped_socket_io(), rb_w32_getsockname(), recvmsg(), sendmsg(), and setfl().

◆ StartSockets()

static void StartSockets ( void  )
static

◆ stat_by_find()

static int stat_by_find ( const WCHAR *  path,
struct stati64 *  st 
)
static

Definition at line 5505 of file win32.c.

References errno, fileattr_to_unixmode(), filetime_to_unixtime(), and map_errno.

Referenced by winnt_lstat(), and winnt_stat().

◆ stati64_handle()

static DWORD stati64_handle ( HANDLE  h,
struct stati64 *  st 
)
static

Definition at line 5388 of file win32.c.

References filetime_to_unixtime(), and stati64_set_inode().

Referenced by rb_w32_fstati64(), and winnt_stat().

◆ stati64_set_inode()

static void stati64_set_inode ( BY_HANDLE_FILE_INFORMATION *  pinfo,
struct stati64 *  st 
)
static

Definition at line 5308 of file win32.c.

Referenced by stati64_handle(), and stati64_set_inode_handle().

◆ stati64_set_inode_handle()

static DWORD stati64_set_inode_handle ( HANDLE  h,
struct stati64 *  st 
)
static

Definition at line 5337 of file win32.c.

References stati64_set_inode().

Referenced by rb_w32_fstati64().

◆ STATIC_ASSERT()

STATIC_ASSERT ( std_handle  ,
(STD_OUTPUT_HANDLE-STD_INPUT_HANDLE)  = =(STD_ERROR_HANDLE-STD_OUTPUT_HANDLE) 
)

Referenced by rb_w32_getppid().

◆ str2guid()

static void str2guid ( const char *  str,
GUID *  guid 
)
static

Definition at line 4063 of file win32.c.

References hex2byte.

Referenced by getifaddrs().

◆ symlink()

int symlink ( const char *  src,
const char *  link 
)

Definition at line 5094 of file win32.c.

References filecp, and w32_symlink().

◆ systemtime_to_localtime()

static int systemtime_to_localtime ( TIME_ZONE_INFORMATION *  tz,
SYSTEMTIME *  gst,
SYSTEMTIME *  lst 
)
static

Definition at line 7643 of file win32.c.

References _CRTIMP.

Referenced by localtime_r().

◆ systemtime_to_tm()

static void systemtime_to_tm ( const SYSTEMTIME *  st,
struct tm *  t 
)
static

Definition at line 7617 of file win32.c.

Referenced by gmtime_r(), and localtime_r().

◆ translate_char()

static char* translate_char ( char *  p,
int  from,
int  to,
UINT  cp 
)
inlinestatic

Definition at line 406 of file win32.c.

Referenced by cmdglob(), join_argv(), rb_w32_getcwd(), w32_aspawn_flags(), and w32_spawn().

◆ translate_wchar()

static WCHAR* translate_wchar ( WCHAR *  p,
int  from,
int  to 
)
inlinestatic

◆ unixtime_to_filetime()

static int unixtime_to_filetime ( time_t  time,
FILETIME *  ft 
)
static

Definition at line 7209 of file win32.c.

Referenced by unixtime_to_systemtime(), and wutime().

◆ unixtime_to_systemtime()

static int unixtime_to_systemtime ( const time_t  t,
SYSTEMTIME *  st 
)
static

Definition at line 7607 of file win32.c.

References unixtime_to_filetime().

Referenced by gmtime_r(), and localtime_r().

◆ w32_aspawn_flags()

static rb_pid_t w32_aspawn_flags ( int  mode,
const char *  prog,
char *const argv,
DWORD  flags,
UINT  cp 
)
static

◆ w32_cmdvector()

static int w32_cmdvector ( const WCHAR *  cmd,
char ***  vec,
UINT  cp,
rb_encoding enc 
)
static

◆ w32_getenv()

static char * w32_getenv ( const char *  name,
UINT  cp 
)
static

Definition at line 5108 of file win32.c.

References env, free(), len, map_errno, NULL, strlen(), strncasecmp, uenvarea, and wstr_to_mbstr.

Referenced by rb_w32_getenv(), and rb_w32_ugetenv().

◆ w32_lstati64()

static int w32_lstati64 ( const char *  path,
struct stati64 *  st,
UINT  cp 
)
static

Definition at line 5757 of file win32.c.

References free(), mbstr_to_wstr, NULL, and wlstati64().

Referenced by rb_w32_lstati64(), and rb_w32_ulstati64().

◆ w32_readlink()

static ssize_t w32_readlink ( UINT  cp,
const char *  path,
char *  buf,
size_t  bufsize 
)
static

◆ w32_spawn()

static rb_pid_t w32_spawn ( int  mode,
const char *  cmd,
const char *  prog,
UINT  cp 
)
static

◆ w32_stati64()

static int w32_stati64 ( const char *  path,
struct stati64 *  st,
UINT  cp 
)
static

Definition at line 5729 of file win32.c.

References free(), mbstr_to_wstr, NULL, and wstati64().

Referenced by rb_w32_stati64(), and rb_w32_ustati64().

◆ w32_symlink()

static int w32_symlink ( UINT  cp,
const char *  src,
const char *  link 
)
static

◆ w32_truncate()

static int w32_truncate ( const char *  path,
off_t  length,
UINT  cp 
)
static

Definition at line 5830 of file win32.c.

References errno, free(), map_errno, mbstr_to_wstr, NULL, and rb_chsize().

Referenced by rb_w32_truncate(), and rb_w32_utruncate().

◆ w32_wopen()

static int w32_wopen ( const WCHAR *  file,
int  oflag,
int  perm 
)
static

◆ w32_wopendir()

static DIR* w32_wopendir ( const WCHAR *  wpath)
static

◆ wait()

int wait ( int *  status)

Definition at line 5101 of file win32.c.

References waitpid().

Referenced by rb_w32_read(), rb_w32_select_with_thread(), and rb_w32_write().

◆ waitpid()

rb_pid_t waitpid ( rb_pid_t  pid,
int *  stat_loc,
int  options 
)

◆ win32_direct_conv()

static BOOL win32_direct_conv ( const WCHAR *  file,
const WCHAR *  alt,
struct direct entry,
const void *  enc 
)
static

Definition at line 2158 of file win32.c.

References direct::d_altlen, direct::d_altname, direct::d_name, direct::d_namlen, FALSE, TRUE, and wstr_to_mbstr.

Referenced by rb_w32_readdir().

◆ winnt_lstat()

static int winnt_lstat ( const WCHAR *  path,
struct stati64 *  st 
)
static

◆ winnt_stat()

static int winnt_stat ( const WCHAR *  path,
struct stati64 *  st 
)
static

◆ wlink()

static int wlink ( const WCHAR *  from,
const WCHAR *  to 
)
static

Definition at line 4834 of file win32.c.

References errno, map_errno, and NULL.

Referenced by link(), rb_w32_ulink(), and w32_symlink().

◆ wlstati64()

static int wlstati64 ( const WCHAR *  path,
struct stati64 *  st 
)
static

Definition at line 5658 of file win32.c.

References ALLOCV_END, ALLOCV_N, errno, name_for_stat(), size, and winnt_lstat().

Referenced by w32_lstati64().

◆ wmkdir()

static int wmkdir ( const WCHAR *  wpath,
int  mode 
)
static

Definition at line 7312 of file win32.c.

References errno, FALSE, map_errno, NULL, and RUBY_CRITICAL.

Referenced by rb_w32_mkdir(), and rb_w32_umkdir().

◆ wrename()

static int wrename ( const WCHAR *  oldpath,
const WCHAR *  newpath 
)
static

Definition at line 5179 of file win32.c.

References ELOOP, errno, get_attr_vsn(), map_errno, open_special(), and RUBY_CRITICAL.

Referenced by rb_w32_rename(), and rb_w32_urename().

◆ wrmdir()

static int wrmdir ( const WCHAR *  wpath)
static

Definition at line 7360 of file win32.c.

References errno, FALSE, map_errno, and RUBY_CRITICAL.

Referenced by rb_w32_rmdir(), and rb_w32_urmdir().

◆ wstati64()

static int wstati64 ( const WCHAR *  path,
struct stati64 *  st 
)
static

Definition at line 5635 of file win32.c.

References ALLOCV_END, ALLOCV_N, errno, name_for_stat(), size, and winnt_stat().

Referenced by w32_stati64(), w32_wopendir(), and wutime().

◆ wunlink()

static int wunlink ( const WCHAR *  path)
static

Definition at line 7409 of file win32.c.

References errno, map_errno, and RUBY_CRITICAL.

Referenced by rb_w32_unlink(), and rb_w32_uunlink().

◆ wutime()

static int wutime ( const WCHAR *  path,
const struct utimbuf times 
)
static

Variable Documentation

◆ __pioinfo

EXTERN_C _CRTIMP ioinfo* __pioinfo[]

Definition at line 2422 of file win32.c.

◆ ChildRecord

◆ conlist

st_table* conlist = NULL
static

Definition at line 694 of file win32.c.

◆ err

int err

Definition at line 135 of file win32.c.

Referenced by append_compile_error(), argf_next_argv(), BSD__sprint(), cleanup_iseq_build(), clsid_from_remote(), date_strftime_with_tmx(), errat_getter(), errat_setter(), execarg_parent_end(), expand_case_fold_string(), fetch_name(), fetch_name_with_level(), fiddle_handle_sym(), finish_overlapped_socket(), foletype_s_progids(), foletypelib_s_typelibs(), fptr_finalize_flush(), init_libraries(), init_libraries_if_necessary(), Init_syslog(), inspect_errno(), kill(), lock_func(), make_econv_exception(), Messaging_HandleMessage(), mustbe_callable(), mutex_free(), new_xstring_gen(), node_extended_grapheme_cluster(), node_linebreak(), oletypelib_path(), oletypelib_search_registry(), oletypelib_search_registry2(), onig_compile_ruby(), onig_new(), onig_new_with_source(), ossl_ocspbres_add_status(), ossl_pkcs12_initialize(), ossl_pkcs7_add_data(), ossl_raise(), ossl_x509stctx_get_err_string(), ossl_x509stctx_set_error(), overlapped_socket_io(), parse_char_class(), parse_enclose(), parse_subexp(), poll_child_status(), raise_loaderror(), rb_check_backtrace(), rb_deflate_init_copy(), rb_deflate_initialize(), rb_deflate_params(), rb_deflate_s_deflate(), rb_deflate_set_dictionary(), rb_enc_reg_new(), rb_exec_async_signal_safe(), rb_exec_fail(), rb_f_exec(), rb_f_raise(), rb_f_spawn(), rb_fiber_start(), rb_fiddle_handle_initialize(), rb_gzreader_initialize(), rb_gzwriter_initialize(), rb_inflate_initialize(), rb_inflate_s_inflate(), rb_inflate_set_dictionary(), rb_inflate_sync_point_p(), rb_io_reopen(), rb_iterate0(), rb_mutex_unlock(), rb_mutex_unlock_th(), rb_notify_fd_close(), rb_pipe(), rb_reg_check_preprocess(), rb_reg_compile(), rb_reg_fixed_encoding_p(), rb_reg_init_str(), rb_reg_init_str_enc(), rb_reg_match_p(), rb_reg_prepare_re(), rb_reg_preprocess_dregexp(), rb_reg_search0(), rb_reg_to_s(), rb_set_errinfo(), rb_strftime_with_timespec(), rb_thread_pending_interrupt_p(), rb_threadptr_execute_interrupts(), rb_threadptr_pending_interrupt_deque(), rb_threadptr_unlock_all_locking_mutexes(), rb_vm_get_insns_address_table(), rb_w32_connect(), rb_w32_pipe(), rb_w32_read(), rb_w32_strerror(), rb_w32_write(), reg_compile_gen(), reg_enum_key(), reg_fragment_check_gen(), reg_get_val(), reg_get_val2(), ruby_cleanup(), ruby_close(), ruby_float_step_size(), ruby_getpeername(), ruby_getsockname(), ruby_kill(), ruby_shutdown(), sdbm_prep(), setup_overlapped(), syserr_initialize(), thread_create_core(), thread_join(), typelib_file_from_clsid(), typelib_file_from_typelib(), vm_exec(), vm_throw_continue(), zlib_gunzip(), zlib_s_gzip(), zstream_end(), zstream_finalize(), zstream_reset(), zstream_run(), zstream_run_func(), and zstream_sync().

◆ errmap

struct { ... } errmap[]

◆ get_final_path

static get_final_path_func get_final_path = get_final_path_unknown
static

Definition at line 1885 of file win32.c.

Referenced by get_final_path_unknown(), open_dir_handle(), and winnt_stat().

◆ namespace_prefix

const WCHAR namespace_prefix[] = {L'\\', L'\\', L'?', L'\\'}
static

Definition at line 5542 of file win32.c.

◆ NTLoginName

const char* NTLoginName
static

Definition at line 295 of file win32.c.

Referenced by getlogin(), and init_env().

◆ NtSocketsInitialized

int NtSocketsInitialized = 0
static

◆ osver

OSVERSIONINFO osver
static

Definition at line 297 of file win32.c.

Referenced by get_version(), rb_w32_osver(), and rb_w32_read().

◆ pConvertInterfaceGuidToLuid

cigl_t pConvertInterfaceGuidToLuid = (cigl_t)-1
static

Definition at line 4099 of file win32.c.

Referenced by getifaddrs().

◆ pConvertInterfaceLuidToNameA

cilnA_t pConvertInterfaceLuidToNameA = (cilnA_t)-1
static

Definition at line 4100 of file win32.c.

Referenced by getifaddrs().

◆ rb_f_notimplement_

VALUE(*const rb_f_notimplement_) (int, const VALUE *, VALUE) = rb_f_notimplement

Definition at line 7784 of file win32.c.

◆ select_mutex

CRITICAL_SECTION select_mutex
static

Definition at line 691 of file win32.c.

Referenced by do_select(), exit_handler(), and StartSockets().

◆ socklist

st_table* socklist = NULL
static

Definition at line 693 of file win32.c.

◆ szInternalCmds

const char szInternalCmds[][InternalCmdsMax+2]
static

Definition at line 944 of file win32.c.

Referenced by internal_cmd_match().

◆ uenvarea

char* uenvarea
static

Definition at line 696 of file win32.c.

Referenced by exit_handler(), and w32_getenv().

◆ winerr

DWORD winerr

Definition at line 134 of file win32.c.

Referenced by rb_w32_map_errno(), and rb_w32_strerror().