win32/win32.c File Reference

#include "ruby/ruby.h"
#include "ruby/encoding.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 "internal.h"
#include "dln.h"
#include "dln_find.c"
#include <sys/timeb.h>

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

Defines

#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 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 enough_to_get(n)   (--(n) >= 0)
#define enough_to_put(n)   (--(n) >= 0)
#define Debug(something)
#define TO_SOCKET(x)   _get_osfhandle(x)
#define RUBY_CRITICAL(expr)   do { expr; } while (0)
#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
#define FOREACH_CHILD(v)
#define END_FOREACH_CHILD   } while (0)
#define MAXPATHLEN   512
#define STRNDUPV(ptr, v, src, len)   (((char *)memcpy(((ptr) = ALLOCV((v), (len) + 1)), (src), (len)))[len] = 0)
#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 MTHREAD_ONLY(x)
#define STHREAD_ONLY(x)   x
#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 _pipech(i)   (_pioinfo(i)->pipech)
#define pioinfo_extra   0
#define _set_osfhnd(fh, osfh)   (void)(_osfhnd(fh) = osfh)
#define _set_osflags(fh, flags)   (_osfile(fh) = (flags))
#define FOPEN   0x01
#define FEOFLAG   0x02
#define FPIPE   0x08
#define FNOINHERIT   0x10
#define FAPPEND   0x20
#define FDEV   0x40
#define FTEXT   0x80
#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 COPY_STAT(src, dest, size_cast)
#define yield_once()   Sleep(0)
#define yield_until(condition)   do yield_once(); while (!(condition))
#define FILE_COUNT   _cnt
#define FILE_READPTR   _ptr
#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)
#define BACKGROUND_MASK   (BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED)
#define COMMON_LVB_UNDERSCORE   0x8000
#define INVALID_SET_FILE_POINTER   ((DWORD)-1)

Typedefs

typedef BOOL(WINAPI *) cancel_io_t (HANDLE)
typedef _NtCmdLineElement NtCmdLineElement
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_stati64 (const char *path, struct stati64 *st, UINT cp)
static char * w32_getenv (const char *name, UINT cp)
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)
VALUE rb_w32_conv_from_wchar (const WCHAR *wstr, rb_encoding *enc)
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 *env)
static void regulate_path (WCHAR *path)
static FARPROC get_proc_address (const char *module, const char *func, HANDLE *mh)
static UINT get_system_directory (WCHAR *path, UINT len)
VALUE rb_w32_special_folder (int type)
UINT rb_w32_system_tmpdir (WCHAR *path, UINT len)
static void init_env (void)
static void init_func (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)
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 UINT filecp (void)
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)
static char * skipspace (char *ptr)
int rb_w32_cmdvector (const char *cmd, char ***vec)
static HANDLE open_dir_handle (const WCHAR *filename, WIN32_FIND_DATAW *fd)
static DIRopendir_internal (WCHAR *wpath, const char *filename)
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, struct direct *entry, rb_encoding *dummy)
char * rb_w32_conv_from_wstr (const WCHAR *wstr, long *lenp, rb_encoding *enc)
static BOOL ruby_direct_conv (const WCHAR *file, struct direct *entry, rb_encoding *enc)
static struct directreaddir_internal (DIR *dirp, BOOL(*conv)(const WCHAR *, struct direct *, rb_encoding *), rb_encoding *enc)
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)
hostent *WSAAPI rb_w32_gethostbyaddr (const char *addr, int len, int type)
hostent *WSAAPI rb_w32_gethostbyname (const char *name)
int WSAAPI rb_w32_gethostname (char *name, int len)
protoent *WSAAPI rb_w32_getprotobyname (const char *name)
protoent *WSAAPI rb_w32_getprotobynumber (int num)
servent *WSAAPI rb_w32_getservbyname (const char *name, const char *proto)
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)
netent * getnetent (void)
netent * getnetbyaddr (long net, int type)
netent * getnetbyname (const char *name)
protoent * getprotoent (void)
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, char flags, int minfd)
int fcntl (int fd, int cmd,...)
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 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)
int wait (int *status)
char * rb_w32_ugetenv (const char *name)
char * rb_w32_getenv (const char *name)
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)
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 winnt_stat (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_access (const char *path, int mode)
int rb_w32_uaccess (const char *path, int mode)
static int rb_chsize (HANDLE h, off_t size)
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 void catch_interrupt (void)
int rb_w32_getc (FILE *stream)
int rb_w32_putc (int c, FILE *stream)
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)
static int check_if_dir (const char *file)
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)
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)
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 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)
tm * gmtime_r (const time_t *tp, struct tm *rp)
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 cancel_io_t cancel_io = NULL
static CRITICAL_SECTION select_mutex
static int NtSocketsInitialized = 0
static st_tablesocklist = NULL
static st_tableconlist = NULL
static char * envarea
static char * uenvarea
static const char *const szInternalCmds []
EXTERN_C _CRTIMP ioinfo__pioinfo []
static cigl_t pConvertInterfaceGuidToLuid = NULL
static cilnA_t pConvertInterfaceLuidToNameA = NULL


Define Documentation

#define _CRTIMP   __declspec(dllimport)

Definition at line 2234 of file win32.c.

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

Definition at line 2243 of file win32.c.

Referenced by dupfd(), finish_overlapped(), rb_w32_isatty(), rb_w32_read(), rb_w32_write(), rb_w32_write_console(), and setup_overlapped().

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

Definition at line 2244 of file win32.c.

Referenced by fcntl(), finish_overlapped(), rb_w32_fd_is_text(), rb_w32_read(), rb_w32_wopen(), rb_w32_write(), and setup_overlapped().

#define _pipech (  )     (_pioinfo(i)->pipech)

Definition at line 2245 of file win32.c.

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

Definition at line 2281 of file win32.c.

Referenced by rb_w32_accept(), rb_w32_close(), rb_w32_fclose(), rb_w32_open_osfhandle(), rb_w32_pipe(), rb_w32_unwrap_io_handle(), and rb_w32_wopen().

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

Definition at line 2282 of file win32.c.

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

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

Definition at line 1202 of file win32.c.

#define BACKGROUND_MASK   (BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED)

Referenced by constat_attr().

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

Definition at line 1823 of file win32.c.

Referenced by opendir_internal(), and readdir_internal().

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

Definition at line 1824 of file win32.c.

Referenced by opendir_internal(), and readdir_internal().

#define COMMON_LVB_UNDERSCORE   0x8000

Referenced by constat_attr().

#define conlist_disabled   ((st_table *)-1)

Definition at line 609 of file win32.c.

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

#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 4767 of file win32.c.

Referenced by rb_w32_fstati64(), and rb_w32_stat().

#define CSIDL_COMMON_APPDATA   35

Definition at line 397 of file win32.c.

Referenced by etc_sysconfdir().

#define CSIDL_LOCAL_APPDATA   28

Definition at line 394 of file win32.c.

Referenced by rb_w32_system_tmpdir().

#define CSIDL_PROFILE   40

Definition at line 406 of file win32.c.

Referenced by init_env().

#define CSIDL_SYSTEM   37

Definition at line 403 of file win32.c.

#define CSIDL_WINDOWS   36

Definition at line 400 of file win32.c.

#define Debug ( something   ) 

Definition at line 97 of file win32.c.

Referenced by rb_w32_asynchronize().

#define DIRENT_PER_CHAR   (CHAR_BIT / 2)

Definition at line 1825 of file win32.c.

Referenced by opendir_internal().

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

Definition at line 75 of file win32.c.

#define dln_find_exe_r   rb_w32_udln_find_exe_r

Definition at line 75 of file win32.c.

Referenced by proc_exec_cmd(), proc_exec_sh(), proc_exec_v(), w32_aspawn_flags(), and w32_spawn().

#define DLN_FIND_EXTRA_ARG   ,cp

Definition at line 64 of file win32.c.

Referenced by dln_find_exe_r(), and dln_find_file_r().

#define DLN_FIND_EXTRA_ARG_DECL   ,UINT cp

Definition at line 63 of file win32.c.

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

Definition at line 76 of file win32.c.

#define dln_find_file_r   rb_w32_udln_find_file_r

Definition at line 76 of file win32.c.

Referenced by process_options(), and ruby_init_loadpath_safe().

#define END_FOREACH_CHILD   } while (0)

Definition at line 805 of file win32.c.

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

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

Definition at line 90 of file win32.c.

Referenced by rb_w32_getc().

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

Definition at line 91 of file win32.c.

Referenced by rb_w32_putc().

#define env   wk.val

Referenced by check_env_value(), check_exec_env_i(), env_alloc(), env_fetch(), env_free(), env_mark(), env_memsize(), eval_string_with_cref(), get_local_variable_ptr(), init_env(), rb_binding_add_dynavars(), rb_check_exec_env(), rb_execarg_init(), rb_f_getenv(), rb_io_s_popen(), rb_vmdebug_proc_dump_raw(), rb_w32_get_environ(), save_env(), toplevel_context(), vm_collect_local_variables_in_heap(), vm_make_env_each(), vm_set_main_stack(), and w32_getenv().

#define ERROR_PIPE_LOCAL   229L

#define FAPPEND   0x20

Definition at line 2288 of file win32.c.

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

#define FDEV   0x40

Definition at line 2289 of file win32.c.

Referenced by finish_overlapped(), rb_w32_open_osfhandle(), rb_w32_wopen(), rb_w32_write(), and setup_overlapped().

#define FEOFLAG   0x02

Definition at line 2285 of file win32.c.

Referenced by rb_w32_read(), and rb_w32_write().

#define FILE_COUNT   _cnt

Definition at line 5260 of file win32.c.

#define FILE_READPTR   _ptr

Definition at line 5261 of file win32.c.

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

Definition at line 1204 of file win32.c.

Referenced by check_if_dir(), link(), rb_w32_mkdir(), rb_w32_open(), rb_w32_opendir(), rb_w32_rename(), rb_w32_rmdir(), rb_w32_unlink(), and rb_w32_utime().

#define FNOINHERIT   0x10

Definition at line 2287 of file win32.c.

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

#define FOPEN   0x01

Definition at line 2284 of file win32.c.

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

#define FOREACH_CHILD (  ) 

Value:

do { \
    struct ChildRecord* v; \
    for (v = ChildRecord; v < ChildRecord + sizeof(ChildRecord) / sizeof(ChildRecord[0]); ++v)

Definition at line 802 of file win32.c.

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

#define FOREGROUND_MASK   (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)

Referenced by constat_attr().

#define FPIPE   0x08

Definition at line 2286 of file win32.c.

Referenced by finish_overlapped(), rb_w32_pipe(), rb_w32_wopen(), rb_w32_write(), and setup_overlapped().

#define FTEXT   0x80

Definition at line 2290 of file win32.c.

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

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

Definition at line 693 of file win32.c.

Referenced by rb_w32_getsockname(), and setfl().

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

Definition at line 694 of file win32.c.

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

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

Definition at line 1820 of file win32.c.

Referenced by readdir_internal().

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

Definition at line 66 of file win32.c.

Referenced by CONF_get1_default_config_file(), dir_s_chdir(), dln_find_1(), dln_find_exe_r(), do_spawn(), env_assoc(), env_delete(), env_fetch(), env_has_key(), env_shift(), establishShell(), etc_getlogin(), get_envparam_double(), get_envparam_int(), get_param(), getaddrinfo(), main(), nl_langinfo_codeset(), process_options(), rb_default_home_dir(), rb_env_path_tainted(), rb_f_getenv(), ruby_init_loadpath_safe(), st_init_table_with_size(), w32_aspawn_flags(), and w32_spawn().

#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().

#define INVALID_SET_FILE_POINTER   ((DWORD)-1)

Referenced by setup_overlapped().

#define IOINFO_ARRAY_ELTS   (1 << IOINFO_L2E)

Definition at line 2242 of file win32.c.

Referenced by _pioinfo().

#define IOINFO_L2E   5

Definition at line 2241 of file win32.c.

Referenced by _pioinfo().

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

Definition at line 53 of file win32.c.

#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)

Definition at line 304 of file win32.c.

Referenced by flock_winnt().

#define LK_LEN   ULONG_MAX

Definition at line 318 of file win32.c.

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

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

Definition at line 692 of file win32.c.

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

#define map_errno   rb_w32_map_errno

Definition at line 270 of file win32.c.

Referenced by check_valid_dir(), clock_getres(), clock_gettime(), CreateChild(), do_select(), fcntl(), finish_overlapped_socket(), getifaddrs(), kill(), open_dir_handle(), overlapped_socket_io(), poll_child_status(), rb_chsize(), rb_w32_accept(), rb_w32_bind(), rb_w32_close(), rb_w32_connect(), rb_w32_fclose(), rb_w32_getcwd(), rb_w32_gethostbyaddr(), rb_w32_gethostbyname(), rb_w32_gethostname(), rb_w32_getpeername(), rb_w32_getprotobyname(), rb_w32_getprotobynumber(), rb_w32_getservbyname(), rb_w32_getservbyport(), rb_w32_getsockname(), rb_w32_getsockopt(), rb_w32_ioctlsocket(), rb_w32_listen(), rb_w32_pipe(), rb_w32_read(), rb_w32_setsockopt(), rb_w32_shutdown(), rb_w32_socket(), rb_w32_truncate(), rb_w32_wopen(), rb_w32_write(), recvmsg(), sendmsg(), setfl(), setup_overlapped(), socketpair_internal(), w32_getenv(), waitpid(), winnt_stat(), wlink(), wmkdir(), wrename(), wrmdir(), wunlink(), and wutime().

#define MAXCHILDNUM   256

Definition at line 793 of file win32.c.

Referenced by waitpid().

#define MAXPATHLEN   512

Definition at line 1066 of file win32.c.

#define mbstr_to_wstr   rb_w32_mbstr_to_wstr

Definition at line 1200 of file win32.c.

Referenced by rb_w32_write_console(), w32_aspawn_flags(), w32_spawn(), and w32_stati64().

#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)

Definition at line 3362 of file win32.c.

Referenced by recvmsg(), and sendmsg().

#define MTHREAD_ONLY (  ) 

Definition at line 2213 of file win32.c.

Referenced by rb_w32_accept(), rb_w32_open_osfhandle(), rb_w32_pipe(), rb_w32_read(), rb_w32_wopen(), and rb_w32_write().

#define NTGLOB   0x1

Definition at line 1459 of file win32.c.

#define NTMALLOC   0x2

Definition at line 1460 of file win32.c.

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

#define NTSTRING   0x4

Definition at line 1461 of file win32.c.

#define open_null ( fd   ) 

Value:

(((nullfd < 0) ?                                                \
      (nullfd = open("NUL", O_RDWR)) : 0),              \
     ((nullfd == (fd)) ? (keep = 1) : dup2(nullfd, fd)),        \
     (fd))

Referenced by init_stdhandle().

#define pioinfo_extra   0

Definition at line 2270 of file win32.c.

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

Definition at line 65 of file win32.c.

Referenced by rb_w32_access(), and rb_w32_stat().

#define ROOT_GID   0

Definition at line 2490 of file win32.c.

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

#define ROOT_UID   0

Definition at line 2489 of file win32.c.

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

#define RUBY_CRITICAL ( expr   )     do { expr; } while (0)

Definition at line 109 of file win32.c.

#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)

Referenced by init_env().

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

Definition at line 5481 of file win32.c.

Referenced by rb_w32_dup2().

#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 5476 of file win32.c.

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

Definition at line 1821 of file win32.c.

Referenced by opendir_internal().

#define STHREAD_ONLY (  )     x

Definition at line 2214 of file win32.c.

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

Definition at line 1070 of file win32.c.

Referenced by w32_aspawn_flags(), and w32_spawn().

#define TO_SOCKET (  )     _get_osfhandle(x)

Definition at line 100 of file win32.c.

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

Definition at line 1206 of file win32.c.

Referenced by rb_w32_uchdir(), rb_w32_uchmod(), rb_w32_ulink(), rb_w32_umkdir(), rb_w32_uopen(), rb_w32_uopendir(), rb_w32_urename(), rb_w32_urmdir(), rb_w32_uunlink(), and rb_w32_uutime().

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

Definition at line 3355 of file win32.c.

Referenced by recvmsg().

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

Definition at line 3358 of file win32.c.

Referenced by sendmsg().

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

Definition at line 1203 of file win32.c.

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

Definition at line 1205 of file win32.c.

Referenced by rb_w32_conv_from_wstr(), and win32_direct_conv().

#define wstr_to_mbstr   rb_w32_wstr_to_mbstr

Definition at line 1201 of file win32.c.

Referenced by w32_getenv().

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

Definition at line 1207 of file win32.c.

Referenced by rb_w32_get_environ().

 
#define yield_once (  )     Sleep(0)

Definition at line 5232 of file win32.c.

Referenced by catch_interrupt(), and rb_w32_asynchronize().

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

Definition at line 5233 of file win32.c.

Referenced by rb_w32_asynchronize().


Typedef Documentation

typedef BOOL(WINAPI *) cancel_io_t(HANDLE)

Definition at line 564 of file win32.c.

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

Definition at line 3882 of file win32.c.

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

Definition at line 3883 of file win32.c.

typedef struct _NtCmdLineElement NtCmdLineElement


Enumeration Type Documentation

anonymous enum

Enumerator:
constat_init 
constat_esc 
constat_seq 

Definition at line 621 of file win32.c.


Function Documentation

static ioinfo * _pioinfo ( int   )  [inline, static]

Definition at line 2274 of file win32.c.

References IOINFO_ARRAY_ELTS, and IOINFO_L2E.

Referenced by rb_w32_accept(), rb_w32_open_osfhandle(), rb_w32_pipe(), rb_w32_read(), rb_w32_wopen(), and rb_w32_write().

static DWORD WINAPI call_asynchronous ( PVOID  argp  )  [static]

Definition at line 5314 of file win32.c.

References asynchronous_arg_t::argc, asynchronous_arg_t::argv, errno, asynchronous_arg_t::errnum, asynchronous_arg_t::func, asynchronous_arg_t::self, and asynchronous_arg_t::stackaddr.

Referenced by rb_w32_asynchronize().

static void catch_interrupt ( void   )  [static]

Definition at line 5237 of file win32.c.

References NULL, rb_w32_wait_events(), RUBY_CRITICAL, and yield_once.

Referenced by rb_w32_getc(), and rb_w32_putc().

static int check_if_dir ( const char *  file  )  [static]

Definition at line 5531 of file win32.c.

References check_if_wdir(), FALSE, filecp_to_wstr, free, and NULL.

Referenced by rb_w32_open().

static int check_if_wdir ( const WCHAR *  wfile  )  [static]

Definition at line 5517 of file win32.c.

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

Referenced by check_if_dir(), and rb_w32_wopen().

static int check_spawn_mode ( int  mode  )  [static]

Definition at line 1075 of file win32.c.

References errno, and P_NOWAIT.

Referenced by w32_aspawn_flags(), and w32_spawn().

static int check_valid_dir ( const WCHAR *  path  )  [static]

Definition at line 4891 of file win32.c.

References errno, map_errno, and open_dir_handle().

Referenced by check_if_wdir(), and winnt_stat().

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

Definition at line 1089 of file win32.c.

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

Referenced by w32_aspawn_flags(), and w32_spawn().

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

Definition at line 4425 of file win32.c.

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

int clock_getres ( clockid_t  clock_id,
struct timespec sp 
)

Definition at line 4357 of file win32.c.

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

Referenced by rb_clock_getres().

int clock_gettime ( clockid_t  clock_id,
struct timespec sp 
)

Definition at line 4319 of file win32.c.

References CLOCK_MONOTONIC, CLOCK_REALTIME, count, errno, gettimeofday(), map_errno, NULL, timespec::tv_nsec, and timespec::tv_sec.

Referenced by getclockofday(), getrusage_time(), rb_clock_gettime(), time_init_0(), and timeofday().

static void CloseChildHandle ( struct ChildRecord child  )  [static]

Definition at line 835 of file win32.c.

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

Referenced by child_result(), and poll_child_status().

static NtCmdLineElement** cmdglob ( NtCmdLineElement patt,
NtCmdLineElement **  tail 
) [static]

Definition at line 1485 of file win32.c.

References buf, CharNext, _NtCmdLineElement::flags, free, insert(), last, _NtCmdLineElement::len, malloc, MAXPATHLEN, NTMALLOC, ruby_brace_glob(), _NtCmdLineElement::str, strlcpy(), tail, and VALUE.

Referenced by rb_w32_cmdvector().

static int compare ( const struct timeval t1,
const struct timeval t2 
) [inline, static]

Definition at line 2825 of file win32.c.

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

Referenced by rb_w32_select_with_thread().

static int console_emulator_p ( void   )  [static]

Definition at line 5865 of file win32.c.

References FALSE, and func.

Referenced by constat_handle().

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

Definition at line 6027 of file win32.c.

References constat::attr, constat_attr(), count, FALSE, constat::saved, constat::seq, constat::state, TRUE, and constat::vt100.

Referenced by constat_parse().

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

Definition at line 5931 of file win32.c.

References BACKGROUND_MASK, COMMON_LVB_UNDERSCORE, and FOREGROUND_MASK.

Referenced by constat_apply().

static void constat_delete ( HANDLE  h  )  [static]

Definition at line 633 of file win32.c.

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

Referenced by rb_w32_close(), and rb_w32_unwrap_io_handle().

static struct constat* constat_handle ( HANDLE  h  )  [static]

Definition at line 5886 of file win32.c.

References ALLOC, constat::attr, conlist, conlist_disabled, console_emulator_p(), constat_init, NULL, constat::saved, st_data_t, st_init_numtable(), st_insert(), st_lookup(), constat::state, and constat::vt100.

Referenced by rb_w32_write_console().

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

Definition at line 6152 of file win32.c.

References constat_apply(), constat_esc, constat_init, constat_seq, len, numberof, constat::seq, constat::state, and constat::vt100.

Referenced by rb_w32_write_console().

static void constat_reset ( HANDLE  h  )  [static]

Definition at line 5919 of file win32.c.

References conlist, constat_init, st_data_t, st_lookup(), constat::state, and constat::vt100.

Referenced by rb_w32_read().

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

Definition at line 2665 of file win32.c.

Referenced by rb_w32_select_with_thread().

static struct ChildRecord * CreateChild ( const WCHAR *  ,
const WCHAR *  ,
SECURITY_ATTRIBUTES *  ,
HANDLE  ,
HANDLE  ,
HANDLE  ,
DWORD   
) [static]

Definition at line 1108 of file win32.c.

References errno, FindFreeChildSlot(), ChildRecord::hProcess, map_errno, NULL, ChildRecord::pid, rb_pid_t, RUBY_CRITICAL, and TRUE.

Referenced by w32_aspawn_flags(), and w32_spawn().

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

Definition at line 2771 of file win32.c.

References errno, map_errno, rb_w32_sleep(), RUBY_CRITICAL, select(), StartSockets(), timeval::tv_sec, and timeval::tv_usec.

static int dupfd ( HANDLE  hDup,
char  flags,
int  minfd 
) [static]

Definition at line 4051 of file win32.c.

References _osfhnd, errno, FOPEN, and numberof.

Referenced by fcntl().

void endhostent ( void   ) 

Definition at line 3995 of file win32.c.

void endnetent ( void   ) 

Definition at line 3996 of file win32.c.

void endprotoent ( void   ) 

Definition at line 3997 of file win32.c.

void endservent ( void   ) 

Definition at line 3998 of file win32.c.

static void exit_handler ( void   )  [static]

Definition at line 644 of file win32.c.

References conlist, conlist_disabled, free, free_conlist(), NULL, socklist, st_foreach(), and st_free_table().

Referenced by rb_w32_sysinit().

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

Definition at line 2623 of file win32.c.

References if(), memmove(), and xrealloc.

Referenced by rb_w32_select_with_thread().

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

Definition at line 4085 of file win32.c.

References _osfile, dupfd(), errno, F_DUPFD, F_SETFL, FNOINHERIT, is_socket, map_errno, setfl(), and TO_SOCKET.

Referenced by dup2(), fd_set_cloexec(), make_fd_nonblock(), rb_cloexec_fcntl_dupfd(), rb_io_initialize(), rb_io_set_nonblock(), rb_maygvl_fd_fix_cloexec(), run_exec_dup2(), and wsplit_p().

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

Definition at line 4849 of file win32.c.

References S_IWUSR.

Referenced by winnt_stat().

static UINT filecp ( void   )  [inline, static]

Definition at line 1948 of file win32.c.

Referenced by rb_w32_aspawn_flags(), rb_w32_getcwd(), rb_w32_spawn(), and rb_w32_stati64().

static long filetime_to_clock ( FILETIME *  ft  )  [static]

Definition at line 5202 of file win32.c.

Referenced by rb_w32_times().

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

Definition at line 4283 of file win32.c.

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

Referenced by filetime_to_unixtime(), and gettimeofday().

static time_t filetime_to_unixtime ( const FILETIME *  ft  )  [static]

Definition at line 4837 of file win32.c.

References filetime_to_timeval(), and timeval::tv_sec.

Referenced by rb_w32_fstat(), rb_w32_fstati64(), and winnt_stat().

static struct ChildRecord* FindChildSlot ( rb_pid_t  pid  )  [static]

Definition at line 809 of file win32.c.

References END_FOREACH_CHILD, FOREACH_CHILD, and NULL.

Referenced by kill(), and waitpid().

static struct ChildRecord* FindChildSlotByHandle ( HANDLE  h  )  [static]

Definition at line 822 of file win32.c.

References END_FOREACH_CHILD, FOREACH_CHILD, and NULL.

Referenced by waitpid().

static struct ChildRecord* FindFreeChildSlot ( void   )  [static]

Definition at line 845 of file win32.c.

References END_FOREACH_CHILD, FOREACH_CHILD, and NULL.

Referenced by CreateChild().

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

Definition at line 6271 of file win32.c.

References _osfhnd, _osfile, FDEV, and FPIPE.

Referenced by rb_w32_read(), and rb_w32_write().

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

Definition at line 3194 of file win32.c.

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

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

int flock ( int  fd,
int  oper 
)

Definition at line 361 of file win32.c.

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

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

Definition at line 322 of file win32.c.

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

Referenced by flock().

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

Definition at line 625 of file win32.c.

References ST_DELETE, and xfree.

Referenced by exit_handler().

void freeifaddrs ( struct ifaddrs ifp  ) 

Definition at line 3979 of file win32.c.

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

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

Definition at line 438 of file win32.c.

References NULL.

Referenced by get_system_directory(), getifaddrs(), init_func(), rb_w32_getppid(), rb_w32_inet_ntop(), rb_w32_inet_pton(), and wlink().

static BOOL get_special_folder ( int  n,
WCHAR *  env 
) [static]

Definition at line 411 of file win32.c.

References f, FALSE, and NULL.

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

static UINT get_system_directory ( WCHAR *  path,
UINT  len 
) [static]

Definition at line 462 of file win32.c.

References get_proc_address(), and NULL.

Referenced by rb_w32_system_tmpdir().

static void get_version ( void   )  [static]

Definition at line 278 of file win32.c.

References osver.

Referenced by rb_w32_sysinit().

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

Definition at line 2990 of file win32.c.

References errno, and NULL.

Referenced by recvmsg(), and sendmsg().

rb_gid_t getegid ( void   ) 

Definition at line 2515 of file win32.c.

References ROOT_GID.

Referenced by eaccess(), init_ids(), Init_process(), p_gid_change_privilege(), p_gid_exchange(), p_gid_switch(), proc_getegid(), and rb_group_member().

rb_uid_t geteuid ( void   ) 

Definition at line 2501 of file win32.c.

References ROOT_UID.

Referenced by eaccess(), init_ids(), Init_process(), p_gid_change_privilege(), p_uid_change_privilege(), p_uid_exchange(), p_uid_switch(), proc_geteuid(), rb_file_owned_p(), rb_setegid_core(), rb_seteuid_core(), rb_stat_owned(), rb_stat_r(), rb_stat_w(), and rb_stat_x().

rb_gid_t getgid ( void   ) 

Definition at line 2508 of file win32.c.

References ROOT_GID.

Referenced by eaccess(), etc_getgrgid(), get_device_once(), init_ids(), p_gid_change_privilege(), p_gid_exchange(), p_gid_switch(), proc_getgid(), rb_group_member(), and rb_setegid_core().

int getifaddrs ( struct ifaddrs **  ifap  ) 

Definition at line 3888 of file win32.c.

References added, AF_UNSPEC, errno, get_proc_address(), if(), IFNAMSIZ, map_errno, name, NULL, pConvertInterfaceGuidToLuid, pConvertInterfaceLuidToNameA, prev, ruby_xcalloc(), ruby_xfree(), ruby_xmalloc(), size, str2guid(), and ULONG().

char* getlogin ( void   ) 

Definition at line 788 of file win32.c.

References NTLoginName.

Referenced by etc_getlogin().

struct netent* getnetbyaddr ( long  net,
int  type 
)

Definition at line 4002 of file win32.c.

References NULL.

struct netent* getnetbyname ( const char *  name  ) 

Definition at line 4004 of file win32.c.

References NULL.

struct netent* getnetent ( void   ) 

Definition at line 4000 of file win32.c.

References NULL.

struct protoent* getprotoent ( void   ) 

Definition at line 4006 of file win32.c.

References NULL.

struct servent* getservent ( void   ) 

Definition at line 4008 of file win32.c.

References NULL.

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

Definition at line 4307 of file win32.c.

References filetime_to_timeval().

Referenced by clock_gettime(), fill_random_seed(), getclockofday(), rb_clock_gettime(), rb_w32_select_with_thread(), time_init_0(), and timeofday().

rb_uid_t getuid ( void   ) 

Definition at line 2494 of file win32.c.

References ROOT_UID.

Referenced by argf_next_argv(), chfunc(), eaccess(), establishShell(), etc_getpwuid(), get_device_once(), init_ids(), p_uid_change_privilege(), p_uid_exchange(), p_uid_switch(), proc_getuid(), rb_file_rowned_p(), rb_seteuid_core(), rb_stat_R(), rb_stat_rowned(), rb_stat_W(), and rb_stat_X().

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

Definition at line 7062 of file win32.c.

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

static int has_redirection ( const char *  ,
UINT   
) [static]

Definition at line 1518 of file win32.c.

References FALSE, ISALNUM, ISALPHA, and TRUE.

Referenced by w32_spawn().

static void init_env ( void   )  [static]

Definition at line 502 of file win32.c.

References CSIDL_PROFILE, env, eq(), f, FALSE, get_special_folder(), len, name, NTLoginName, numberof, rb_w32_getenv(), rb_w32_system_tmpdir(), regulate_path(), set_env_val, strdup, TRUE, and val.

Referenced by rb_w32_sysinit().

static void init_func ( void   )  [static]

Definition at line 569 of file win32.c.

References cancel_io, get_proc_address(), and NULL.

Referenced by rb_w32_sysinit().

static void init_stdhandle ( void   )  [static]

Definition at line 2346 of file win32.c.

References fileno, NULL, O_BINARY, and open_null.

Referenced by rb_w32_sysinit().

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

Definition at line 1465 of file win32.c.

References _NtCmdLineElement::flags, _NtCmdLineElement::len, malloc, MEMZERO, _NtCmdLineElement::next, NTMALLOC, _NtCmdLineElement::str, strdup, strlen(), and tail.

Referenced by cmdglob().

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

Definition at line 969 of file win32.c.

References internal_match().

Referenced by is_internal_cmd(), and w32_aspawn_flags().

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

Definition at line 918 of file win32.c.

Referenced by internal_cmd_match().

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

Definition at line 2540 of file win32.c.

References errno.

static int is_batch ( const char *  cmd  )  [static]

Definition at line 1188 of file win32.c.

References len, strcasecmp, and strlen().

Referenced by w32_aspawn_flags(), and w32_spawn().

static int is_command_com ( const char *  interp  )  [static]

Definition at line 925 of file win32.c.

References isdirsep, strcasecmp, and strlen().

Referenced by w32_aspawn_flags(), and w32_spawn().

static int is_console ( SOCKET   )  [static]

Definition at line 2726 of file win32.c.

References RUBY_CRITICAL.

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

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

Definition at line 940 of file win32.c.

References internal_cmd_match().

Referenced by w32_spawn().

static int is_invalid_handle ( SOCKET  sock  )  [static]

Definition at line 2764 of file win32.c.

Referenced by rb_w32_select_with_thread().

static int is_not_socket ( SOCKET  sock  )  [static]

Definition at line 2687 of file win32.c.

References is_socket.

Referenced by rb_w32_select_with_thread().

static int is_pipe ( SOCKET  sock  )  [static]

Definition at line 2694 of file win32.c.

References RUBY_CRITICAL.

Referenced by rb_w32_select_with_thread().

static int is_readable_console ( SOCKET  sock  )  [static]

Definition at line 2741 of file win32.c.

References RUBY_CRITICAL.

Referenced by rb_w32_select_with_thread().

static int is_readable_pipe ( SOCKET  sock  )  [static]

Definition at line 2707 of file win32.c.

References NULL, and RUBY_CRITICAL.

Referenced by rb_w32_select_with_thread().

static int is_socket ( SOCKET   )  [static]

Definition at line 2401 of file win32.c.

References FALSE, NULL, socklist_lookup(), and TRUE.

static int isUNCRoot ( const WCHAR *  path  )  [static]

Definition at line 4744 of file win32.c.

Referenced by wstati64().

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

Definition at line 991 of file win32.c.

References len, and translate_char().

Referenced by w32_aspawn_flags().

int kill ( int  pid,
int  sig 
)

Definition at line 4439 of file win32.c.

References EPERM, err, errno, FALSE, FindChildSlot(), ChildRecord::hProcess, map_errno, NULL, RUBY_CRITICAL, SIGINT, and SIGKILL.

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

Definition at line 4595 of file win32.c.

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

Referenced by dump_disasm_list(), exec_end_procs_chain(), r_object0(), rb_mark_end_proc(), rb_set_end_proc(), and realpath_rec().

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

Definition at line 7086 of file win32.c.

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

static void move_to_next_entry ( DIR dirp  )  [static]

Definition at line 2018 of file win32.c.

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

Referenced by rb_w32_seekdir(), and readdir_internal().

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

Definition at line 1829 of file win32.c.

References ALLOCV_END, ALLOCV_N, errno, len, map_errno, and VALUE.

Referenced by check_valid_dir(), and opendir_internal().

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

Definition at line 3524 of file win32.c.

References AF_UNSPEC, free, malloc, and NULL.

Referenced by rb_w32_socket(), and socketpair_internal().

static DIR* opendir_internal ( WCHAR *  wpath,
const char *  filename 
) [static]

Definition at line 1863 of file win32.c.

References BitOfIsDir, BitOfIsRep, DIR::bits, calloc, DIR::curr, DIRENT_PER_CHAR, errno, ISALPHA, len, DIR::nfiles, NULL, open_dir_handle(), rb_w32_closedir(), realloc, SetBit, DIR::size, DIR::start, and wstati64().

Referenced by rb_w32_opendir(), and rb_w32_uopendir().

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

Definition at line 3239 of file win32.c.

References cancel_io, err, errno, FALSE, finish_overlapped_socket(), GET_FLAGS, map_errno, NtSocketsInitialized, NULL, O_NONBLOCK, RUBY_CRITICAL, size, socklist_lookup(), StartSockets(), TO_SOCKET, and TRUE.

Referenced by rb_w32_recv(), rb_w32_recvfrom(), rb_w32_send(), and rb_w32_sendto().

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

Definition at line 4133 of file win32.c.

References CloseChildHandle(), err, errno, ChildRecord::hProcess, map_errno, numberof, ChildRecord::pid, rb_pid_t, rb_w32_wait_events_blocking(), and SIGINT.

Referenced by waitpid().

static int rb_chsize ( HANDLE  h,
off_t  size 
) [static]

Definition at line 5108 of file win32.c.

References errno, long, map_errno, SEEK_CUR, and SEEK_SET.

Referenced by rb_w32_ftruncate(), and rb_w32_truncate().

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

Definition at line 3006 of file win32.c.

References _pioinfo(), _set_osfhnd, errno, map_errno, MTHREAD_ONLY, NtSocketsInitialized, NULL, O_BINARY, rb_w32_open_osfhandle(), RUBY_CRITICAL, socklist_insert(), StartSockets(), and TO_SOCKET.

int rb_w32_access ( const char *  path,
int  mode 
)

Definition at line 5078 of file win32.c.

References errno, and rb_w32_stati64.

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

Definition at line 1435 of file win32.c.

References rb_w32_aspawn_flags().

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

Definition at line 1420 of file win32.c.

References filecp(), and w32_aspawn_flags().

Referenced by rb_w32_aspawn().

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

Definition at line 5326 of file win32.c.

References call_asynchronous(), Debug, errno, FALSE, NULL, rb_fatal(), rb_w32_wait_events_blocking(), RUBY_CRITICAL, TRUE, val, yield_once, and yield_until.

Referenced by flock().

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

Definition at line 3043 of file win32.c.

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

int rb_w32_check_interrupt ( void *   ) 

Referenced by rb_w32_select_with_thread().

int rb_w32_close ( int  fd  ) 

Definition at line 6220 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().

void rb_w32_closedir ( DIR dirp  ) 

Definition at line 2190 of file win32.c.

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

Referenced by opendir_internal().

int rb_w32_cmdvector ( const char *  cmd,
char ***  vec 
)

Definition at line 1576 of file win32.c.

References calloc, CharNext, cmdglob(), _NtCmdLineElement::flags, free, if(), ISSPACE, _NtCmdLineElement::len, len, malloc, _NtCmdLineElement::next, NTMALLOC, NULL, skipspace(), _NtCmdLineElement::str, strdup, strlcpy(), and tail.

Referenced by rb_w32_sysinit().

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

Definition at line 3062 of file win32.c.

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

VALUE rb_w32_conv_from_wchar ( const WCHAR *  wstr,
rb_encoding enc 
)

Definition at line 2044 of file win32.c.

References ECONV_UNDEF_REPLACE, ENC_TO_ENCINDEX, len, NULL, Qnil, rb_enc_from_index(), rb_enc_str_new(), rb_long2int, rb_str_conv_enc_opts(), RSTRING_PTR, and VALUE.

Referenced by etc_systmpdir(), rb_w32_conv_from_wstr(), and rb_w32_special_folder().

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

Definition at line 2075 of file win32.c.

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

Referenced by ruby_direct_conv().

int rb_w32_dup2 ( int  oldfd,
int  newfd 
)

Definition at line 5485 of file win32.c.

References dup2(), and set_new_std_fd.

int rb_w32_fclose ( FILE fp  ) 

Definition at line 5742 of file win32.c.

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

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

Definition at line 2586 of file win32.c.

References xrealloc.

void rb_w32_fd_dup ( rb_fdset_t dst,
const rb_fdset_t src 
)

Definition at line 2601 of file win32.c.

References xrealloc.

char rb_w32_fd_is_text ( int  fd  ) 

Definition at line 6980 of file win32.c.

References _osfile, and FTEXT.

void rb_w32_fdclr ( int  fd,
fd_set *  set 
)

Definition at line 2556 of file win32.c.

References memmove(), and TO_SOCKET.

int rb_w32_fdisset ( int  fd,
fd_set *  set 
)

Definition at line 2574 of file win32.c.

References RUBY_CRITICAL, and TO_SOCKET.

void rb_w32_fdset ( int  fd,
fd_set *  set 
)

Definition at line 2547 of file win32.c.

References FD_SET.

void rb_w32_free_environ ( char **  env  ) 

Definition at line 5426 of file win32.c.

References free.

int rb_w32_fstat ( int  fd,
struct stat *  st 
)

Definition at line 4786 of file win32.c.

References filetime_to_unixtime(), fstat, S_IWGRP, S_IWOTH, and S_IWUSR.

int rb_w32_fstati64 ( int  fd,
struct stati64 *  st 
)

Definition at line 4810 of file win32.c.

References COPY_STAT, filetime_to_unixtime(), fstat, S_IWGRP, S_IWOTH, S_IWUSR, and stat.

int rb_w32_ftruncate ( int  fd,
off_t  length 
)

Definition at line 5153 of file win32.c.

References rb_chsize().

char** rb_w32_get_environ ( void   ) 

Definition at line 5389 of file win32.c.

References env, malloc, NULL, and wstr_to_utf8.

SOCKET rb_w32_get_osfhandle ( int  fh  ) 

Definition at line 984 of file win32.c.

Referenced by rb_io_flush_raw().

int rb_w32_getc ( FILE stream  ) 

Definition at line 5266 of file win32.c.

References catch_interrupt(), clearerr, enough_to_get, EOF, and errno.

char* rb_w32_getcwd ( char *  buffer,
int  size 
)

Definition at line 4385 of file win32.c.

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

char* rb_w32_getenv ( const char *  name  ) 

Definition at line 4667 of file win32.c.

References w32_getenv().

Referenced by init_env().

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

Definition at line 3605 of file win32.c.

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

struct hostent* WSAAPI rb_w32_gethostbyname ( const char *  name  ) 

Definition at line 3623 of file win32.c.

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

int WSAAPI rb_w32_gethostname ( char *  name,
int  len 
)

Definition at line 3641 of file win32.c.

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

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

Definition at line 3086 of file win32.c.

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

rb_pid_t rb_w32_getpid ( void   ) 

Definition at line 5436 of file win32.c.

Referenced by rb_w32_pipe().

rb_pid_t rb_w32_getppid ( void   ) 

Definition at line 5444 of file win32.c.

References get_proc_address(), len, long, NULL, rb_pid_t, rb_w32_osver(), and ULONG().

struct protoent* WSAAPI rb_w32_getprotobyname ( const char *  name  ) 

Definition at line 3659 of file win32.c.

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

struct protoent* WSAAPI rb_w32_getprotobynumber ( int  num  ) 

Definition at line 3677 of file win32.c.

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

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

Definition at line 3695 of file win32.c.

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

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

Definition at line 3713 of file win32.c.

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

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

Definition at line 3104 of file win32.c.

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

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

Definition at line 3137 of file win32.c.

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

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

Definition at line 6949 of file win32.c.

References get_proc_address(), NULL, and snprintf.

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

Definition at line 6967 of file win32.c.

References get_proc_address(), and NULL.

int rb_w32_io_cancelable_p ( int  fd  ) 

Definition at line 2297 of file win32.c.

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

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

Definition at line 3155 of file win32.c.

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

int rb_w32_is_socket ( int  fd  ) 

Definition at line 2411 of file win32.c.

References is_socket, and TO_SOCKET.

Referenced by rsock_init_sock().

int rb_w32_isatty ( int  fd  ) 

Definition at line 6848 of file win32.c.

References _osfhnd, and errno.

int WSAAPI rb_w32_listen ( int  s,
int  backlog 
)

Definition at line 3173 of file win32.c.

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

int rb_w32_map_errno ( DWORD  winerr  ) 

Definition at line 250 of file win32.c.

References err, and errmap.

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

Definition at line 1972 of file win32.c.

References len, malloc, and NULL.

Referenced by dln_load().

int rb_w32_mkdir ( const char *  path,
int  mode 
)

Definition at line 6721 of file win32.c.

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

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

Definition at line 5545 of file win32.c.

References check_if_dir(), errno, filecp_to_wstr, free, NULL, O_BINARY, and rb_w32_wopen().

static int rb_w32_open_osfhandle ( intptr_t  osfhandle,
int  flags 
) [static]

Definition at line 2304 of file win32.c.

References _pioinfo(), _set_osfhnd, _set_osflags, errno, FAPPEND, FDEV, FNOINHERIT, FOPEN, FTEXT, MTHREAD_ONLY, and NULL.

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

DIR* rb_w32_opendir ( const char *  filename  ) 

Definition at line 1988 of file win32.c.

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

DWORD rb_w32_osver ( void   ) 

Definition at line 296 of file win32.c.

References osver.

Referenced by rb_w32_getppid().

int rb_w32_pipe ( int  fds[2]  ) 

Definition at line 5765 of file win32.c.

References _pioinfo(), _set_osfhnd, _set_osflags, cancel_io, err, errno, FALSE, FNOINHERIT, FOPEN, FPIPE, map_errno, MTHREAD_ONLY, name, NULL, PRI_PIDT_PREFIX, rb_pid_t, rb_w32_close(), rb_w32_getpid(), RUBY_CRITICAL, and snprintf.

int rb_w32_putc ( int  c,
FILE stream 
)

Definition at line 5287 of file win32.c.

References catch_interrupt(), and enough_to_put.

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

Definition at line 6287 of file win32.c.

References _osfhnd, _osfile, _pioinfo(), _set_osflags, cancel_io, constat_reset(), err, errno, FALSE, FEOFLAG, finish_overlapped(), FTEXT, is_console(), is_socket, len, map_errno, MTHREAD_ONLY, NULL, osver, rb_w32_recv(), rb_w32_wait_events_blocking(), setup_overlapped(), TO_SOCKET, TRUE, and wait().

struct direct* rb_w32_readdir ( DIR dirp,
rb_encoding enc 
)

Definition at line 2138 of file win32.c.

References NULL, rb_ascii8bit_encoding(), readdir_internal(), ruby_direct_conv(), and win32_direct_conv().

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

Definition at line 3314 of file win32.c.

References NULL, overlapped_socket_io(), and TRUE.

Referenced by rb_w32_read().

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

Definition at line 3321 of file win32.c.

References overlapped_socket_io(), and TRUE.

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

Definition at line 4724 of file win32.c.

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

void rb_w32_rewinddir ( DIR dirp  ) 

Definition at line 2178 of file win32.c.

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

Referenced by rb_w32_seekdir().

int rb_w32_rmdir ( const char *  path  ) 

Definition at line 6756 of file win32.c.

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

void rb_w32_seekdir ( DIR dirp,
long  loc 
)

Definition at line 2163 of file win32.c.

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

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

Definition at line 2982 of file win32.c.

References 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 
)

Definition at line 2845 of file win32.c.

References compare(), copy_fd(), do_select(), errno, extract_fd(), gettimeofday(), if(), is_console(), is_invalid_handle(), is_not_socket(), is_pipe(), is_readable_console(), is_readable_pipe(), NULL, rb_fd_init, rb_fd_term, rb_w32_check_interrupt(), rb_w32_time_subtract(), timeval::tv_sec, timeval::tv_usec, wait(), and zero().

Referenced by rb_w32_select().

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

Definition at line 3329 of file win32.c.

References FALSE, NULL, and overlapped_socket_io().

Referenced by rb_w32_write().

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

Definition at line 3336 of file win32.c.

References FALSE, and overlapped_socket_io().

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

Definition at line 3490 of file win32.c.

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

int WSAAPI rb_w32_shutdown ( int  s,
int  how 
)

Definition at line 3508 of file win32.c.

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

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

Definition at line 3576 of file win32.c.

References errno, MAKE_SOCKDATA, map_errno, NtSocketsInitialized, O_BINARY, open_ifs_socket(), rb_w32_open_osfhandle(), RUBY_CRITICAL, socklist_insert(), and StartSockets().

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

Definition at line 1335 of file win32.c.

References filecp(), and w32_spawn().

VALUE rb_w32_special_folder ( int  type  ) 

Definition at line 474 of file win32.c.

References get_special_folder(), Qnil, rb_filesystem_encoding(), rb_w32_conv_from_wchar(), and regulate_path().

Referenced by etc_sysconfdir().

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

Definition at line 4990 of file win32.c.

References COPY_STAT, and rb_w32_stati64.

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

Definition at line 5057 of file win32.c.

References filecp(), and w32_stati64().

char* rb_w32_strerror ( int  e  ) 

Definition at line 2426 of file win32.c.

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

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

Definition at line 749 of file win32.c.

References exit_handler(), get_version(), init_env(), init_func(), init_stdhandle(), rb_w32_cmdvector(), and StartSockets().

Referenced by ruby_sysinit().

UINT rb_w32_system_tmpdir ( WCHAR *  path,
UINT  len 
)

Definition at line 485 of file win32.c.

References CSIDL_LOCAL_APPDATA, get_special_folder(), get_system_directory(), numberof, and translate_wchar().

Referenced by etc_systmpdir(), and init_env().

long rb_w32_telldir ( DIR dirp  ) 

Definition at line 2152 of file win32.c.

References DIR::loc.

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

Definition at line 2806 of file win32.c.

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

Referenced by rb_w32_select_with_thread().

int rb_w32_times ( struct tms tmbuf  ) 

Definition at line 5213 of file win32.c.

References filetime_to_clock(), tms::tms_cstime, tms::tms_cutime, tms::tms_stime, and tms::tms_utime.

int rb_w32_truncate ( const char *  path,
off_t  length 
)

Definition at line 5137 of file win32.c.

References errno, map_errno, and rb_chsize().

int rb_w32_uaccess ( const char *  path,
int  mode 
)

Definition at line 5093 of file win32.c.

References errno, and rb_w32_ustati64().

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

Definition at line 1442 of file win32.c.

References rb_w32_uaspawn_flags().

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

Definition at line 1428 of file win32.c.

References w32_aspawn_flags().

Referenced by rb_w32_uaspawn().

int rb_w32_uchdir ( const char *  path  ) 

Definition at line 6673 of file win32.c.

References free, NULL, and utf8_to_wstr.

int rb_w32_uchmod ( const char *  path,
int  mode 
)

Definition at line 6833 of file win32.c.

References free, NULL, and utf8_to_wstr.

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

Definition at line 4432 of file win32.c.

char* rb_w32_ugetenv ( const char *  name  ) 

Definition at line 4660 of file win32.c.

References w32_getenv().

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

Definition at line 4575 of file win32.c.

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

int rb_w32_umkdir ( const char *  path,
int  mode 
)

Definition at line 6707 of file win32.c.

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

int rb_w32_unlink ( const char *  path  ) 

Definition at line 6819 of file win32.c.

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

int rb_w32_unwrap_io_handle ( int  fd  ) 

Definition at line 7132 of file win32.c.

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

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

Definition at line 5497 of file win32.c.

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

DIR* rb_w32_uopendir ( const char *  filename  ) 

Definition at line 2001 of file win32.c.

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

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

Definition at line 4705 of file win32.c.

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

int rb_w32_urmdir ( const char *  path  ) 

Definition at line 6770 of file win32.c.

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

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

Definition at line 1343 of file win32.c.

References w32_spawn().

Referenced by proc_exec_sh().

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

Definition at line 5050 of file win32.c.

References w32_stati64().

Referenced by rb_w32_uaccess().

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

Definition at line 6659 of file win32.c.

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

int rb_w32_uunlink ( const char *  path  ) 

Definition at line 6805 of file win32.c.

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

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

Definition at line 6645 of file win32.c.

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

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

Referenced by catch_interrupt().

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

Definition at line 5570 of file win32.c.

References _osfile, _pioinfo(), _set_osfhnd, _set_osflags, access, check_if_wdir(), errno, FALSE, FAPPEND, FDEV, FNOINHERIT, FOPEN, FPIPE, map_errno, MTHREAD_ONLY, NULL, O_BINARY, RUBY_CRITICAL, and TRUE.

Referenced by rb_w32_open(), and rb_w32_uopen().

int rb_w32_wrap_io_handle ( HANDLE  h,
int  flags 
)

Definition at line 7110 of file win32.c.

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

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

Definition at line 6424 of file win32.c.

References _osfhnd, _osfile, _pioinfo(), cancel_io, err, errno, FDEV, FEOFLAG, fileno, finish_overlapped(), FPIPE, FTEXT, is_socket, len, map_errno, MTHREAD_ONLY, NULL, rb_w32_send(), rb_w32_wait_events_blocking(), setup_overlapped(), TO_SOCKET, TRUE, and wait().

long rb_w32_write_console ( uintptr_t  strarg,
int  fd 
)

Definition at line 6525 of file win32.c.

References _osfhnd, constat_handle(), constat_parse(), ECONV_INVALID_REPLACE, ECONV_UNDEF_REPLACE, ENCODING_GET, free, len, mbstr_to_wstr, NULL, 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, TRUE, and VALUE.

Referenced by io_fwrite().

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

Definition at line 1956 of file win32.c.

References len, malloc, and NULL.

static struct direct* readdir_internal ( DIR dirp,
BOOL(*)(const WCHAR *, struct direct *, rb_encoding *)  conv,
rb_encoding enc 
) [static]

Definition at line 2099 of file win32.c.

References BitOfIsDir, BitOfIsRep, DIR::bits, DIR::curr, direct::d_ino, direct::d_isdir, direct::d_isrep, direct::d_name, DIR::dirstr, free, GetBit, DIR::loc, move_to_next_entry(), and NULL.

Referenced by rb_w32_readdir().

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

Definition at line 3380 of file win32.c.

References cancel_io, WSAMSG::dwFlags, errno, FALSE, finish_overlapped_socket(), GET_FLAGS, get_wsa_extension_function(), len, map_errno, msg, msghdr_to_wsamsg, WSAMSG::name, WSAMSG::namelen, NtSocketsInitialized, NULL, O_NONBLOCK, RUBY_CRITICAL, size, socklist_lookup(), StartSockets(), TO_SOCKET, TRUE, and WSAID_WSARECVMSG.

static void regulate_path ( WCHAR *  path  )  [static]

Definition at line 427 of file win32.c.

References translate_wchar().

Referenced by init_env(), and rb_w32_special_folder().

static BOOL ruby_direct_conv ( const WCHAR *  file,
struct direct entry,
rb_encoding enc 
) [static]

Definition at line 2090 of file win32.c.

References direct::d_name, direct::d_namlen, FALSE, rb_w32_conv_from_wstr(), and TRUE.

Referenced by rb_w32_readdir().

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

Definition at line 3438 of file win32.c.

References cancel_io, errno, FALSE, finish_overlapped_socket(), GET_FLAGS, get_wsa_extension_function(), len, map_errno, msg, msghdr_to_wsamsg, NtSocketsInitialized, NULL, O_NONBLOCK, RUBY_CRITICAL, size, socklist_lookup(), StartSockets(), TO_SOCKET, TRUE, and WSAID_WSASENDMSG.

static int setfl ( SOCKET  sock,
int  arg 
) [static]

Definition at line 4020 of file win32.c.

References errno, GET_FAMILY, GET_FLAGS, MAKE_SOCKDATA, map_errno, O_NONBLOCK, RUBY_CRITICAL, socklist_insert(), socklist_lookup(), and u_long.

Referenced by fcntl().

int setgid ( rb_gid_t  gid  ) 

Definition at line 2529 of file win32.c.

References ROOT_GID.

Referenced by p_gid_change_privilege(), rb_execarg_run_options(), and rb_setegid_core().

void sethostent ( int  stayopen  ) 

Definition at line 4010 of file win32.c.

void setnetent ( int  stayopen  ) 

Definition at line 4012 of file win32.c.

void setprotoent ( int  stayopen  ) 

Definition at line 4014 of file win32.c.

void setservent ( int  stayopen  ) 

Definition at line 4016 of file win32.c.

int setuid ( rb_uid_t  uid  ) 

Definition at line 2522 of file win32.c.

References ROOT_UID.

Referenced by p_uid_change_privilege(), rb_execarg_run_options(), and rb_seteuid_core().

static int setup_overlapped ( OVERLAPPED *  ol,
int  fd 
) [static]

Definition at line 6242 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().

int signbit ( double  x  ) 

Definition at line 6940 of file win32.c.

Referenced by f_signbit(), math_atan2(), math_gamma(), math_lgamma(), and num_step().

static char* skipspace ( char *  ptr  )  [inline, static]

Definition at line 1567 of file win32.c.

References ISSPACE.

Referenced by rb_w32_cmdvector().

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

Definition at line 3821 of file win32.c.

References MAKE_SOCKDATA, O_BINARY, rb_w32_close(), rb_w32_open_osfhandle(), socketpair_internal(), and socklist_insert().

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

Definition at line 3729 of file win32.c.

References EAFNOSUPPORT, EPROTOTYPE, errno, INADDR_LOOPBACK, len, map_errno, NtSocketsInitialized, open_ifs_socket(), PF_INET, RUBY_CRITICAL, and StartSockets().

Referenced by socketpair().

static int socklist_delete ( SOCKET *  sockp,
int *  flagp 
) [inline, static]

Definition at line 723 of file win32.c.

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

Referenced by rb_w32_close(), and rb_w32_unwrap_io_handle().

static int socklist_insert ( SOCKET  sock,
int  flag 
) [inline, static]

Definition at line 698 of file win32.c.

References socklist, 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().

static int socklist_lookup ( SOCKET  sock,
int *  flagp 
) [inline, static]

Definition at line 707 of file win32.c.

References socklist, st_data_t, and st_lookup().

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

static void StartSockets ( void   )  [static]

Definition at line 672 of file win32.c.

References rb_fatal(), and version().

Referenced by do_select(), overlapped_socket_io(), rb_w32_accept(), rb_w32_bind(), rb_w32_connect(), rb_w32_gethostbyaddr(), rb_w32_gethostbyname(), rb_w32_gethostname(), rb_w32_getpeername(), rb_w32_getprotobyname(), rb_w32_getprotobynumber(), rb_w32_getservbyname(), rb_w32_getservbyport(), rb_w32_getsockname(), rb_w32_getsockopt(), rb_w32_ioctlsocket(), rb_w32_listen(), rb_w32_setsockopt(), rb_w32_shutdown(), rb_w32_socket(), rb_w32_sysinit(), recvmsg(), sendmsg(), and socketpair_internal().

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

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

Definition at line 3848 of file win32.c.

References hex2byte, and long.

Referenced by getifaddrs().

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

Definition at line 7024 of file win32.c.

Referenced by localtime_r().

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

Definition at line 6998 of file win32.c.

Referenced by gmtime_r(), and localtime_r().

static char* translate_char ( char *  p,
int  from,
int  to,
UINT  cp 
) [inline, static]

Definition at line 383 of file win32.c.

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

static WCHAR* translate_wchar ( WCHAR *  p,
int  from,
int  to 
) [inline, static]

Definition at line 372 of file win32.c.

Referenced by rb_w32_system_tmpdir(), and regulate_path().

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

Definition at line 6583 of file win32.c.

Referenced by unixtime_to_systemtime(), and wutime().

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

Definition at line 6988 of file win32.c.

References unixtime_to_filetime().

Referenced by gmtime_r(), and localtime_r().

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

Definition at line 1350 of file win32.c.

References ALLOCV, ALLOCV_END, check_spawn_mode(), child_result(), CreateChild(), dln_find_exe_r, errno, FALSE, free, getenv, internal_cmd_match(), is_batch(), is_command_com(), join_argv(), len, MAXPATHLEN, mbstr_to_wstr, NULL, rb_pid_t, strchr(), strlcat(), strlcpy(), strlen(), STRNDUPV, translate_char(), and VALUE.

Referenced by rb_w32_aspawn_flags(), and rb_w32_uaspawn_flags().

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

Definition at line 4622 of file win32.c.

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

Referenced by rb_w32_getenv(), and rb_w32_ugetenv().

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

Definition at line 1211 of file win32.c.

References ALLOCV, ALLOCV_END, check_spawn_mode(), child_result(), CreateChild(), dln_find_exe_r, errno, free, getenv, has_redirection(), is_batch(), is_command_com(), is_internal_cmd(), ISSPACE, len, MAXPATHLEN, mbstr_to_wstr, NULL, rb_pid_t, strchr(), strlen(), STRNDUPV, translate_char(), and VALUE.

Referenced by rb_w32_spawn(), and rb_w32_uspawn().

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

Definition at line 5064 of file win32.c.

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

Referenced by rb_w32_stati64(), and rb_w32_ustati64().

int wait ( int *  status  ) 

Definition at line 4615 of file win32.c.

References waitpid().

Referenced by proc_waitall(), rb_w32_read(), rb_w32_select_with_thread(), rb_w32_time_subtract(), rb_w32_write(), and rb_waitpid_blocking().

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

Definition at line 4208 of file win32.c.

References count, END_FOREACH_CHILD, errno, FindChildSlot(), FindChildSlotByHandle(), FOREACH_CHILD, ChildRecord::hProcess, map_errno, MAXCHILDNUM, poll_child_status(), rb_w32_wait_events_blocking(), and WNOHANG.

Referenced by rb_waitpid_blocking(), and wait().

static BOOL win32_direct_conv ( const WCHAR *  file,
struct direct entry,
rb_encoding dummy 
) [static]

Definition at line 2035 of file win32.c.

References direct::d_name, direct::d_namlen, FALSE, TRUE, and wstr_to_filecp.

Referenced by rb_w32_readdir().

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

Definition at line 4928 of file win32.c.

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

Referenced by wstati64().

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

Definition at line 4549 of file win32.c.

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

Referenced by link(), and rb_w32_ulink().

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

Definition at line 6687 of file win32.c.

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

Referenced by rb_w32_mkdir(), and rb_w32_umkdir().

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

Definition at line 4674 of file win32.c.

References errno, map_errno, and RUBY_CRITICAL.

Referenced by rb_w32_rename(), and rb_w32_urename().

static int wrmdir ( const WCHAR *  wpath  )  [static]

Definition at line 6735 of file win32.c.

References errno, FALSE, map_errno, and RUBY_CRITICAL.

Referenced by rb_w32_rmdir(), and rb_w32_urmdir().

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

Definition at line 5001 of file win32.c.

References ALLOCV_END, ALLOCV_N, errno, isUNCRoot(), len, S_IWGRP, S_IWOTH, size, VALUE, and winnt_stat().

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

static int wunlink ( const WCHAR *  path  )  [static]

Definition at line 6784 of file win32.c.

References errno, map_errno, and RUBY_CRITICAL.

Referenced by rb_w32_unlink(), and rb_w32_uunlink().

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

Definition at line 6595 of file win32.c.

References utimbuf::actime, errno, map_errno, utimbuf::modtime, NULL, RUBY_CRITICAL, unixtime_to_filetime(), and wstati64().

Referenced by rb_w32_utime(), and rb_w32_uutime().


Variable Documentation

EXTERN_C _CRTIMP ioinfo* __pioinfo[]

Definition at line 2238 of file win32.c.

cancel_io_t cancel_io = NULL [static]

Definition at line 565 of file win32.c.

Referenced by finish_overlapped_socket(), init_func(), overlapped_socket_io(), rb_w32_io_cancelable_p(), rb_w32_pipe(), rb_w32_read(), rb_w32_write(), recvmsg(), and sendmsg().

st_table* conlist = NULL [static]

Definition at line 608 of file win32.c.

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

char* envarea [static]

Definition at line 610 of file win32.c.

Referenced by w32_getenv().

int err

Definition at line 114 of file win32.c.

Referenced by argf_next_argv(), BSD__sprint(), cleanup_iseq_build(), clsid_from_remote(), compile_err_append(), date_strftime_with_tmx(), dlhandle_sym(), errat_getter(), errat_setter(), expand_case_fold_string(), fetch_name(), fetch_name_with_level(), fiddle_handle_sym(), finish_overlapped_socket(), foletype_s_progids(), foletypelib_s_typelibs(), fptr_finalize(), heap_prepare_freepage(), init_libraries(), init_libraries_if_necessary(), Init_syslog(), inspect_errno(), kill(), lock_func(), make_econv_exception(), Messaging_HandleMessage(), mutex_free(), node_extended_grapheme_cluster(), node_linebreak(), oletypelib_path(), oletypelib_search_registry(), oletypelib_search_registry2(), onig_compile(), onig_new(), onig_new_with_source(), ossl_exc_new(), ossl_pkcs12_initialize(), ossl_pkcs7_add_data(), ossl_raise(), ossl_x509stctx_get_err_string(), 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_dlhandle_initialize(), rb_enc_reg_new(), rb_f_raise(), 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_iterate(), rb_mutex_unlock(), rb_mutex_unlock_th(), rb_reg_check_preprocess(), rb_reg_compile(), rb_reg_init_copy(), rb_reg_init_str(), rb_reg_initialize_m(), rb_reg_prepare_re(), rb_reg_preprocess_dregexp(), rb_reg_search(), rb_reg_to_s(), 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_w32_connect(), rb_w32_map_errno(), 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_fd_close_i(), thread_join(), typelib_file_from_clsid(), typelib_file_from_typelib(), vm_exec(), zstream_end(), zstream_finalize(), zstream_reset(), zstream_run(), zstream_run_func(), and zstream_sync().

struct { ... } errmap[] [static]

Referenced by rb_w32_map_errno(), and rb_w32_strerror().

const char* NTLoginName [static]

Definition at line 272 of file win32.c.

Referenced by getlogin(), and init_env().

int NtSocketsInitialized = 0 [static]

Definition at line 606 of file win32.c.

Referenced by overlapped_socket_io(), rb_w32_accept(), rb_w32_bind(), rb_w32_connect(), rb_w32_gethostbyaddr(), rb_w32_gethostbyname(), rb_w32_gethostname(), rb_w32_getpeername(), rb_w32_getprotobyname(), rb_w32_getprotobynumber(), rb_w32_getservbyname(), rb_w32_getservbyport(), rb_w32_getsockname(), rb_w32_getsockopt(), rb_w32_ioctlsocket(), rb_w32_listen(), rb_w32_setsockopt(), rb_w32_shutdown(), rb_w32_socket(), recvmsg(), sendmsg(), and socketpair_internal().

OSVERSIONINFO osver [static]

Definition at line 274 of file win32.c.

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

cigl_t pConvertInterfaceGuidToLuid = NULL [static]

Definition at line 3884 of file win32.c.

Referenced by getifaddrs().

cilnA_t pConvertInterfaceLuidToNameA = NULL [static]

Definition at line 3885 of file win32.c.

Referenced by getifaddrs().

CRITICAL_SECTION select_mutex [static]

Definition at line 605 of file win32.c.

st_table* socklist = NULL [static]

Definition at line 607 of file win32.c.

Referenced by exit_handler(), socklist_delete(), socklist_insert(), and socklist_lookup().

const char* const szInternalCmds[] [static]

Definition at line 864 of file win32.c.

char* uenvarea [static]

Definition at line 611 of file win32.c.

Referenced by w32_getenv().

DWORD winerr

Definition at line 113 of file win32.c.

Referenced by rb_w32_strerror().


Generated on 19 Jul 2016 for Ruby by  doxygen 1.4.7