summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-03 15:40:03 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-03 15:40:03 +0000
commitd7c026d05806f706d43a8d86694dd957d04c7a61 (patch)
tree77bad505e90635a82d9e8478ee952330cc0e74c0 /win32
parent9dd559a73a467697aaf08f3e5cb54e0488abd587 (diff)
Mark a code is GPL or not.
This is made the comparison between current and initial commit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c220
1 files changed, 219 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 6cadc1e96d..f95b53e568 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -209,6 +209,7 @@ static struct {
{ WSAEREMOTE, EREMOTE },
};
+/* non GPL */
int
rb_w32_map_errno(DWORD winerr)
{
@@ -236,6 +237,7 @@ static const char *NTLoginName;
static OSVERSIONINFO osver;
+/* GPL */
static void
get_version(void)
{
@@ -245,6 +247,7 @@ get_version(void)
}
#ifdef _M_IX86
+/* GPL */
DWORD
rb_w32_osid(void)
{
@@ -252,6 +255,7 @@ rb_w32_osid(void)
}
#endif
+/* GPL */
DWORD
rb_w32_osver(void)
{
@@ -266,6 +270,7 @@ rb_w32_osver(void)
#define IfWin95(win95, winnt) (winnt)
#endif
+/* non GPL */
HANDLE
GetCurrentThreadHandle(void)
{
@@ -284,6 +289,7 @@ GetCurrentThreadHandle(void)
/* simulate flock by locking a range on the file */
+/* GPL */
#define LK_ERR(f,i) \
do { \
if (f) \
@@ -300,6 +306,7 @@ GetCurrentThreadHandle(void)
} while (0)
#define LK_LEN ULONG_MAX
+/* GPL */
static uintptr_t
flock_winnt(uintptr_t self, int argc, uintptr_t* argv)
{
@@ -337,6 +344,7 @@ flock_winnt(uintptr_t self, int argc, uintptr_t* argv)
}
#ifdef WIN95
+/* GPL */
static uintptr_t
flock_win95(uintptr_t self, int argc, uintptr_t* argv)
{
@@ -367,6 +375,7 @@ flock_win95(uintptr_t self, int argc, uintptr_t* argv)
#undef LK_ERR
+/* GPL */
int
flock(int fd, int oper)
{
@@ -388,6 +397,7 @@ flock(int fd, int oper)
(DWORD)-1);
}
+/* non GPL */
static inline WCHAR *
translate_wchar(WCHAR *p, int from, int to)
{
@@ -398,6 +408,7 @@ translate_wchar(WCHAR *p, int from, int to)
return p;
}
+/* non GPL */
static inline char *
translate_char(char *p, int from, int to)
{
@@ -425,6 +436,7 @@ translate_char(char *p, int from, int to)
#define CSIDL_PROFILE 40
#endif
+/* non GPL */
static BOOL
get_special_folder(int n, WCHAR *env)
{
@@ -440,6 +452,7 @@ get_special_folder(int n, WCHAR *env)
return f;
}
+/* non GPL */
static void
regulate_path(WCHAR *path)
{
@@ -450,6 +463,7 @@ regulate_path(WCHAR *path)
}
}
+/* non GPL */
static FARPROC
get_proc_address(const char *module, const char *func, HANDLE *mh)
{
@@ -473,6 +487,7 @@ get_proc_address(const char *module, const char *func, HANDLE *mh)
return ptr;
}
+/* non GPL */
static UINT
get_system_directory(WCHAR *path, UINT len)
{
@@ -486,6 +501,7 @@ get_system_directory(WCHAR *path, UINT len)
#define numberof(array) (sizeof(array) / sizeof(*array))
+/* non GPL */
VALUE
rb_w32_special_folder(int type)
{
@@ -496,6 +512,7 @@ rb_w32_special_folder(int type)
return rb_w32_conv_from_wchar(path, rb_filesystem_encoding());
}
+/* non GPL */
UINT
rb_w32_system_tmpdir(WCHAR *path, UINT len)
{
@@ -512,6 +529,7 @@ rb_w32_system_tmpdir(WCHAR *path, UINT len)
return p - path + numberof(temp) - 1;
}
+/* non GPL */
static void
init_env(void)
{
@@ -578,6 +596,7 @@ init_env(void)
typedef BOOL (WINAPI *cancel_io_t)(HANDLE);
static cancel_io_t cancel_io = NULL;
+/* non GPL */
static void
init_func(void)
{
@@ -588,6 +607,7 @@ init_func(void)
static void init_stdhandle(void);
#if RT_VER >= 80
+/* non GPL */
static void
invalid_parameter(const wchar_t *expr, const wchar_t *func, const wchar_t *file, unsigned int line, uintptr_t dummy)
{
@@ -596,6 +616,7 @@ invalid_parameter(const wchar_t *expr, const wchar_t *func, const wchar_t *file,
int ruby_w32_rtc_error;
+/* non GPL */
static int __cdecl
rtc_error_handler(int e, const char *src, int line, const char *exe, const char *fmt, ...)
{
@@ -618,6 +639,7 @@ static int NtSocketsInitialized = 0;
static st_table *socklist = NULL;
static char *envarea;
+/* non GPL */
static void
exit_handler(void)
{
@@ -634,6 +656,7 @@ exit_handler(void)
DeleteCriticalSection(&select_mutex);
}
+/* GPL */
static void
StartSockets(void)
{
@@ -658,6 +681,7 @@ StartSockets(void)
//
// Initialization stuff
//
+/* non GPL */
void
rb_w32_sysinit(int *argc, char ***argv)
{
@@ -705,16 +729,19 @@ getlogin(void)
#define MAXCHILDNUM 256 /* max num of child processes */
+/* non GPL */
static struct ChildRecord {
HANDLE hProcess; /* process handle */
rb_pid_t pid; /* process id */
} ChildRecord[MAXCHILDNUM];
+/* non GPL */
#define FOREACH_CHILD(v) do { \
struct ChildRecord* v; \
for (v = ChildRecord; v < ChildRecord + sizeof(ChildRecord) / sizeof(ChildRecord[0]); ++v)
#define END_FOREACH_CHILD } while (0)
+/* non GPL */
static struct ChildRecord *
FindChildSlot(rb_pid_t pid)
{
@@ -727,6 +754,7 @@ FindChildSlot(rb_pid_t pid)
return NULL;
}
+/* non GPL */
static struct ChildRecord *
FindChildSlotByHandle(HANDLE h)
{
@@ -739,6 +767,7 @@ FindChildSlotByHandle(HANDLE h)
return NULL;
}
+/* non GPL */
static void
CloseChildHandle(struct ChildRecord *child)
{
@@ -748,6 +777,7 @@ CloseChildHandle(struct ChildRecord *child)
CloseHandle(h);
}
+/* non GPL */
static struct ChildRecord *
FindFreeChildSlot(void)
{
@@ -820,12 +850,14 @@ static const char *const szInternalCmds[] = {
"\3" "vol" + 1,
};
+/* non GPL */
static int
internal_match(const void *key, const void *elem)
{
return strcmp(key, *(const char *const *)elem);
}
+/* non GPL */
static int
is_command_com(const char *interp)
{
@@ -840,6 +872,7 @@ is_command_com(const char *interp)
static int internal_cmd_match(const char *cmdname, int nt);
+/* non GPL */
static int
is_internal_cmd(const char *cmd, int nt)
{
@@ -868,6 +901,7 @@ is_internal_cmd(const char *cmd, int nt)
return internal_cmd_match(cmdname, nt);
}
+/* non GPL */
static int
internal_cmd_match(const char *cmdname, int nt)
{
@@ -882,12 +916,14 @@ internal_cmd_match(const char *cmdname, int nt)
return 1;
}
+/* non GPL */
SOCKET
rb_w32_get_osfhandle(int fh)
{
return _get_osfhandle(fh);
}
+/* non GPL */
static int
join_argv(char *cmd, char *const *argv, BOOL escape)
{
@@ -962,9 +998,11 @@ join_argv(char *cmd, char *const *argv, BOOL escape)
# define MAXPATHLEN 512
#endif
+/* non GPL */
#define STRNDUPV(ptr, v, src, len) \
(((char *)memcpy(((ptr) = ALLOCV((v), (len) + 1)), (src), (len)))[len] = 0)
+/* non GPL */
static int
check_spawn_mode(int mode)
{
@@ -978,6 +1016,7 @@ check_spawn_mode(int mode)
}
}
+/* non GPL */
static rb_pid_t
child_result(struct ChildRecord *child, int mode)
{
@@ -1000,6 +1039,7 @@ child_result(struct ChildRecord *child, int mode)
}
}
+/* non GPL */
static struct ChildRecord *
CreateChild(const WCHAR *cmd, const WCHAR *prog, SECURITY_ATTRIBUTES *psa,
HANDLE hInput, HANDLE hOutput, HANDLE hError)
@@ -1085,6 +1125,7 @@ CreateChild(const WCHAR *cmd, const WCHAR *prog, SECURITY_ATTRIBUTES *psa,
return child;
}
+/* non GPL */
static int
is_batch(const char *cmd)
{
@@ -1107,6 +1148,7 @@ static char *wstr_to_mbstr(UINT, const WCHAR *, int, long *);
#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)
+/* GPL */
rb_pid_t
rb_w32_spawn(int mode, const char *cmd, const char *prog)
{
@@ -1209,6 +1251,7 @@ rb_w32_spawn(int mode, const char *cmd, const char *prog)
return ret;
}
+/* GPL */
rb_pid_t
rb_w32_aspawn(int mode, const char *prog, char *const *argv)
{
@@ -1275,6 +1318,7 @@ rb_w32_aspawn(int mode, const char *prog, char *const *argv)
return ret;
}
+/* GPL */
typedef struct _NtCmdLineElement {
struct _NtCmdLineElement *next;
char *str;
@@ -1290,6 +1334,7 @@ typedef struct _NtCmdLineElement {
#define NTMALLOC 0x2 // string in element was malloc'ed
#define NTSTRING 0x4 // element contains a quoted string
+/* non GPL */
static int
insert(const char *path, VALUE vinfo, void *enc)
{
@@ -1309,7 +1354,7 @@ insert(const char *path, VALUE vinfo, void *enc)
return 0;
}
-
+/* GPL */
static NtCmdLineElement **
cmdglob(NtCmdLineElement *patt, NtCmdLineElement **tail)
{
@@ -1342,6 +1387,7 @@ cmdglob(NtCmdLineElement *patt, NtCmdLineElement **tail)
// characters that require it to be executed by a command interpreter
//
+/* GPL */
static int
has_redirection(const char *cmd)
{
@@ -1389,6 +1435,7 @@ has_redirection(const char *cmd)
return FALSE;
}
+/* non GPL */
static inline char *
skipspace(char *ptr)
{
@@ -1397,6 +1444,7 @@ skipspace(char *ptr)
return ptr;
}
+/* GPL */
int
rb_w32_cmdvector(const char *cmd, char ***vec)
{
@@ -1643,6 +1691,7 @@ rb_w32_cmdvector(const char *cmd, char ***vec)
// return the pointer to the current file name.
//
+/* non GPL */
#define GetBit(bits, i) ((bits)[(i) / CHAR_BIT] & (1 << (i) % CHAR_BIT))
#define SetBit(bits, i) ((bits)[(i) / CHAR_BIT] |= (1 << (i) % CHAR_BIT))
@@ -1650,6 +1699,7 @@ rb_w32_cmdvector(const char *cmd, char ***vec)
#define BitOfIsRep(n) ((n) * 2 + 1)
#define DIRENT_PER_CHAR (CHAR_BIT / 2)
+/* GPL */
static HANDLE
open_dir_handle(const WCHAR *filename, WIN32_FIND_DATAW *fd)
{
@@ -1683,6 +1733,7 @@ open_dir_handle(const WCHAR *filename, WIN32_FIND_DATAW *fd)
return fh;
}
+/* GPL */
static DIR *
opendir_internal(WCHAR *wpath, const char *filename)
{
@@ -1767,6 +1818,7 @@ opendir_internal(WCHAR *wpath, const char *filename)
return p;
}
+/* non GPL */
static inline UINT
filecp(void)
{
@@ -1774,6 +1826,7 @@ filecp(void)
return cp;
}
+/* non GPL */
static char *
wstr_to_mbstr(UINT cp, const WCHAR *wstr, int clen, long *plen)
{
@@ -1785,6 +1838,7 @@ wstr_to_mbstr(UINT cp, const WCHAR *wstr, int clen, long *plen)
return ptr;
}
+/* non GPL */
static WCHAR *
mbstr_to_wstr(UINT cp, const char *str, int clen, long *plen)
{
@@ -1796,6 +1850,7 @@ mbstr_to_wstr(UINT cp, const char *str, int clen, long *plen)
return ptr;
}
+/* non GPL */
DIR *
rb_w32_opendir(const char *filename)
{
@@ -1808,6 +1863,7 @@ rb_w32_opendir(const char *filename)
return ret;
}
+/* non GPL */
DIR *
rb_w32_uopendir(const char *filename)
{
@@ -1824,6 +1880,7 @@ rb_w32_uopendir(const char *filename)
// Move to next entry
//
+/* GPL */
static void
move_to_next_entry(DIR *dirp)
{
@@ -1840,6 +1897,7 @@ move_to_next_entry(DIR *dirp)
// Readdir just returns the current string pointer and bumps the
// string pointer to the next entry.
//
+/* non GPL */
static BOOL
win32_direct_conv(const WCHAR *file, struct direct *entry, rb_encoding *dummy)
{
@@ -1848,6 +1906,7 @@ win32_direct_conv(const WCHAR *file, struct direct *entry, rb_encoding *dummy)
return TRUE;
}
+/* non GPL */
VALUE
rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc)
{
@@ -1867,6 +1926,7 @@ rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc)
return rb_str_encode(src, rb_enc_from_encoding(enc), ECONV_UNDEF_REPLACE, Qnil);
}
+/* non GPL */
char *
rb_w32_conv_from_wstr(const WCHAR *wstr, long *lenp, rb_encoding *enc)
{
@@ -1881,6 +1941,7 @@ rb_w32_conv_from_wstr(const WCHAR *wstr, long *lenp, rb_encoding *enc)
return ptr;
}
+/* non GPL */
static BOOL
ruby_direct_conv(const WCHAR *file, struct direct *entry, rb_encoding *enc)
{
@@ -1889,6 +1950,7 @@ ruby_direct_conv(const WCHAR *file, struct direct *entry, rb_encoding *enc)
return TRUE;
}
+/* GPL */
static struct direct *
readdir_internal(DIR *dirp, BOOL (*conv)(const WCHAR *, struct direct *, rb_encoding *), rb_encoding *enc)
{
@@ -1927,12 +1989,14 @@ readdir_internal(DIR *dirp, BOOL (*conv)(const WCHAR *, struct direct *, rb_enco
return NULL;
}
+/* non GPL */
struct direct *
rb_w32_readdir(DIR *dirp)
{
return readdir_internal(dirp, win32_direct_conv, NULL);
}
+/* non GPL */
struct direct *
rb_w32_readdir_with_enc(DIR *dirp, rb_encoding *enc)
{
@@ -1946,6 +2010,7 @@ rb_w32_readdir_with_enc(DIR *dirp, rb_encoding *enc)
// Telldir returns the current string pointer position
//
+/* GPL */
long
rb_w32_telldir(DIR *dirp)
{
@@ -1956,6 +2021,7 @@ rb_w32_telldir(DIR *dirp)
// Seekdir moves the string pointer to a previously saved position
// (Saved by telldir).
+/* non GPL */
void
rb_w32_seekdir(DIR *dirp, long loc)
{
@@ -1970,6 +2036,7 @@ rb_w32_seekdir(DIR *dirp, long loc)
// Rewinddir resets the string pointer to the start
//
+/* GPL */
void
rb_w32_rewinddir(DIR *dirp)
{
@@ -1981,6 +2048,7 @@ rb_w32_rewinddir(DIR *dirp)
// This just free's the memory allocated by opendir
//
+/* GPL */
void
rb_w32_closedir(DIR *dirp)
{
@@ -2009,6 +2077,7 @@ rb_w32_closedir(DIR *dirp)
# define STHREAD_ONLY(x) x
#endif
+/* non GPL */
typedef struct {
intptr_t osfhnd; /* underlying OS file HANDLE */
char osfile; /* attributes of file (e.g., open in text mode?) */
@@ -2041,6 +2110,7 @@ EXTERN_C _CRTIMP ioinfo * __pioinfo[];
#if RT_VER >= 80
static size_t pioinfo_extra = 0; /* workaround for VC++8 SP1 */
+/* non GPL */
static void
set_pioinfo_extra(void)
{
@@ -2077,12 +2147,14 @@ set_pioinfo_extra(void)
static int is_socket(SOCKET);
static int is_console(SOCKET);
+/* non GPL */
int
rb_w32_io_cancelable_p(int fd)
{
return cancel_io != NULL && (is_socket(TO_SOCKET(fd)) || !is_console(TO_SOCKET(fd)));
}
+/* non GPL */
static int
rb_w32_open_osfhandle(intptr_t osfhandle, int flags)
{
@@ -2124,6 +2196,7 @@ rb_w32_open_osfhandle(intptr_t osfhandle, int flags)
return fh; /* return handle */
}
+/* non GPL */
static void
init_stdhandle(void)
{
@@ -2161,12 +2234,14 @@ init_stdhandle(void)
#define _set_osfhnd(fh, osfh) (void)((fh), (osfh))
#define _set_osflags(fh, flags) (void)((fh), (flags))
+/* non GPL */
static void
init_stdhandle(void)
{
}
#endif
+/* non GPL */
#ifdef __BORLANDC__
static int
rb_w32_open_osfhandle(intptr_t osfhandle, int flags)
@@ -2182,6 +2257,7 @@ rb_w32_open_osfhandle(intptr_t osfhandle, int flags)
#undef getsockopt
+/* non GPL */
static int
is_socket(SOCKET sock)
{
@@ -2191,6 +2267,7 @@ is_socket(SOCKET sock)
return FALSE;
}
+/* non GPL */
int
rb_w32_is_socket(int fd)
{
@@ -2205,6 +2282,7 @@ rb_w32_is_socket(int fd)
#undef strerror
+/* GPL */
char *
rb_w32_strerror(int e)
{
@@ -2272,36 +2350,42 @@ rb_w32_strerror(int e)
#define ROOT_UID 0
#define ROOT_GID 0
+/* GPL */
rb_uid_t
getuid(void)
{
return ROOT_UID;
}
+/* GPL */
rb_uid_t
geteuid(void)
{
return ROOT_UID;
}
+/* GPL */
rb_gid_t
getgid(void)
{
return ROOT_GID;
}
+/* GPL */
rb_gid_t
getegid(void)
{
return ROOT_GID;
}
+/* GPL */
int
setuid(rb_uid_t uid)
{
return (uid == ROOT_UID ? 0 : -1);
}
+/* GPL */
int
setgid(rb_gid_t gid)
{
@@ -2312,6 +2396,7 @@ setgid(rb_gid_t gid)
// File system stuff
//
+/* GPL */
int
ioctl(int i, int u, ...)
{
@@ -2342,6 +2427,7 @@ rb_w32_fdset(int fd, fd_set *set)
#undef FD_CLR
+/* non GPL */
void
rb_w32_fdclr(int fd, fd_set *set)
{
@@ -2359,6 +2445,7 @@ rb_w32_fdclr(int fd, fd_set *set)
#undef FD_ISSET
+/* non GPL */
int
rb_w32_fdisset(int fd, fd_set *set)
{
@@ -2370,6 +2457,7 @@ rb_w32_fdisset(int fd, fd_set *set)
return ret;
}
+/* non GPL */
void
rb_w32_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src)
{
@@ -2390,6 +2478,7 @@ rb_w32_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src)
#undef select
+/* non GPL */
static int
extract_fd(rb_fdset_t *dst, fd_set *src, int (*func)(SOCKET))
{
@@ -2431,6 +2520,7 @@ extract_fd(rb_fdset_t *dst, fd_set *src, int (*func)(SOCKET))
return dst ? dst->fdset->fd_count : m;
}
+/* non GPL */
static int
copy_fd(fd_set *dst, fd_set *src)
{
@@ -2452,12 +2542,14 @@ copy_fd(fd_set *dst, fd_set *src)
return dst->fd_count;
}
+/* non GPL */
static int
is_not_socket(SOCKET sock)
{
return !is_socket(sock);
}
+/* non GPL */
static int
is_pipe(SOCKET sock) /* DONT call this for SOCKET! it clains it is PIPE. */
{
@@ -2470,6 +2562,7 @@ is_pipe(SOCKET sock) /* DONT call this for SOCKET! it clains it is PIPE. */
return ret;
}
+/* non GPL */
static int
is_readable_pipe(SOCKET sock) /* call this for pipe only */
{
@@ -2488,6 +2581,7 @@ is_readable_pipe(SOCKET sock) /* call this for pipe only */
return ret;
}
+/* non GPL */
static int
is_console(SOCKET sock) /* DONT call this for SOCKET! */
{
@@ -2502,6 +2596,7 @@ is_console(SOCKET sock) /* DONT call this for SOCKET! */
return ret;
}
+/* non GPL */
static int
is_readable_console(SOCKET sock) /* call this for console only */
{
@@ -2524,12 +2619,14 @@ is_readable_console(SOCKET sock) /* call this for console only */
return ret;
}
+/* non GPL */
static int
is_invalid_handle(SOCKET sock)
{
return (HANDLE)sock == INVALID_HANDLE_VALUE;
}
+/* GPL */
static int
do_select(int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
struct timeval *timeout)
@@ -2561,6 +2658,7 @@ do_select(int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
* rest -= wait
* return 0 if rest is smaller than wait.
*/
+/* non GPL */
int
rb_w32_time_subtract(struct timeval *rest, const struct timeval *wait)
{
@@ -2579,6 +2677,7 @@ rb_w32_time_subtract(struct timeval *rest, const struct timeval *wait)
return rest->tv_sec != 0 || rest->tv_usec != 0;
}
+/* non GPL */
static inline int
compare(const struct timeval *t1, const struct timeval *t2)
{
@@ -2598,6 +2697,7 @@ compare(const struct timeval *t1, const struct timeval *t2)
int rb_w32_check_interrupt(void *); /* @internal */
/* @internal */
+/* non GPL */
int
rb_w32_select_with_thread(int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
struct timeval *timeout, void *th)
@@ -2735,6 +2835,7 @@ rb_w32_select_with_thread(int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
return r;
}
+/* non GPL */
int WSAAPI
rb_w32_select(int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
struct timeval *timeout)
@@ -2742,6 +2843,7 @@ rb_w32_select(int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
return rb_w32_select_with_thread(nfds, rd, wr, ex, timeout, 0);
}
+/* non GPL */
static FARPROC
get_wsa_extension_function(SOCKET s, GUID *guid)
{
@@ -2757,6 +2859,7 @@ get_wsa_extension_function(SOCKET s, GUID *guid)
#undef accept
+/* GPL */
int WSAAPI
rb_w32_accept(int s, struct sockaddr *addr, int *addrlen)
{
@@ -2792,6 +2895,7 @@ rb_w32_accept(int s, struct sockaddr *addr, int *addrlen)
#undef bind
+/* GPL */
int WSAAPI
rb_w32_bind(int s, const struct sockaddr *addr, int addrlen)
{
@@ -2810,6 +2914,7 @@ rb_w32_bind(int s, const struct sockaddr *addr, int addrlen)
#undef connect
+/* GPL */
int WSAAPI
rb_w32_connect(int s, const struct sockaddr *addr, int addrlen)
{
@@ -2833,6 +2938,7 @@ rb_w32_connect(int s, const struct sockaddr *addr, int addrlen)
#undef getpeername
+/* GPL */
int WSAAPI
rb_w32_getpeername(int s, struct sockaddr *addr, int *addrlen)
{
@@ -2850,6 +2956,7 @@ rb_w32_getpeername(int s, struct sockaddr *addr, int *addrlen)
#undef getsockname
+/* GPL */
int WSAAPI
rb_w32_getsockname(int s, struct sockaddr *addr, int *addrlen)
{
@@ -2865,6 +2972,7 @@ rb_w32_getsockname(int s, struct sockaddr *addr, int *addrlen)
return r;
}
+/* GPL */
int WSAAPI
rb_w32_getsockopt(int s, int level, int optname, char *optval, int *optlen)
{
@@ -2882,6 +2990,7 @@ rb_w32_getsockopt(int s, int level, int optname, char *optval, int *optlen)
#undef ioctlsocket
+/* GPL */
int WSAAPI
rb_w32_ioctlsocket(int s, long cmd, u_long *argp)
{
@@ -2899,6 +3008,7 @@ rb_w32_ioctlsocket(int s, long cmd, u_long *argp)
#undef listen
+/* GPL */
int WSAAPI
rb_w32_listen(int s, int backlog)
{
@@ -2919,6 +3029,7 @@ rb_w32_listen(int s, int backlog)
#undef send
#undef sendto
+/* non GPL */
static int
finish_overlapped_socket(SOCKET s, WSAOVERLAPPED *wol, int result, DWORD *len, DWORD size)
{
@@ -2957,6 +3068,7 @@ finish_overlapped_socket(SOCKET s, WSAOVERLAPPED *wol, int result, DWORD *len, D
return result;
}
+/* GPL */
static int
overlapped_socket_io(BOOL input, int fd, char *buf, int len, int flags,
struct sockaddr *addr, int *addrlen)
@@ -3026,12 +3138,14 @@ overlapped_socket_io(BOOL input, int fd, char *buf, int len, int flags,
return r;
}
+/* non GPL */
int WSAAPI
rb_w32_recv(int fd, char *buf, int len, int flags)
{
return overlapped_socket_io(TRUE, fd, buf, len, flags, NULL, NULL);
}
+/* non GPL */
int WSAAPI
rb_w32_recvfrom(int fd, char *buf, int len, int flags,
struct sockaddr *from, int *fromlen)
@@ -3039,12 +3153,14 @@ rb_w32_recvfrom(int fd, char *buf, int len, int flags,
return overlapped_socket_io(TRUE, fd, buf, len, flags, from, fromlen);
}
+/* non GPL */
int WSAAPI
rb_w32_send(int fd, const char *buf, int len, int flags)
{
return overlapped_socket_io(FALSE, fd, (char *)buf, len, flags, NULL, NULL);
}
+/* non GPL */
int WSAAPI
rb_w32_sendto(int fd, const char *buf, int len, int flags,
const struct sockaddr *to, int tolen)
@@ -3054,6 +3170,7 @@ rb_w32_sendto(int fd, const char *buf, int len, int flags,
}
#if !defined(MSG_TRUNC) && !defined(__MINGW32__)
+/* non GPL */
typedef struct {
SOCKADDR *name;
int namelen;
@@ -3070,6 +3187,7 @@ typedef struct {
#define WSAID_WSASENDMSG {0xa441e712,0x754f,0x43ca,{0x84,0xa7,0x0d,0xee,0x44,0xcf,0x60,0x6d}}
#endif
+/* non GPL */
#define msghdr_to_wsamsg(msg, wsamsg) \
do { \
int i; \
@@ -3086,6 +3204,7 @@ typedef struct {
(wsamsg)->dwFlags = (msg)->msg_flags; \
} while (0)
+/* non GPL */
int
recvmsg(int fd, struct msghdr *msg, int flags)
{
@@ -3145,6 +3264,7 @@ recvmsg(int fd, struct msghdr *msg, int flags)
return len;
}
+/* non GPL */
int
sendmsg(int fd, const struct msghdr *msg, int flags)
{
@@ -3198,6 +3318,7 @@ sendmsg(int fd, const struct msghdr *msg, int flags)
#undef setsockopt
+/* GPL */
int WSAAPI
rb_w32_setsockopt(int s, int level, int optname, const char *optval, int optlen)
{
@@ -3215,6 +3336,7 @@ rb_w32_setsockopt(int s, int level, int optname, const char *optval, int optlen)
#undef shutdown
+/* GPL */
int WSAAPI
rb_w32_shutdown(int s, int how)
{
@@ -3230,6 +3352,7 @@ rb_w32_shutdown(int s, int how)
return r;
}
+/* non GPL */
static SOCKET
open_ifs_socket(int af, int type, int protocol)
{
@@ -3279,6 +3402,7 @@ open_ifs_socket(int af, int type, int protocol)
#undef socket
+/* GPL */
int WSAAPI
rb_w32_socket(int af, int type, int protocol)
{
@@ -3307,6 +3431,7 @@ rb_w32_socket(int af, int type, int protocol)
#undef gethostbyaddr
+/* GPL */
struct hostent * WSAAPI
rb_w32_gethostbyaddr(const char *addr, int len, int type)
{
@@ -3324,6 +3449,7 @@ rb_w32_gethostbyaddr(const char *addr, int len, int type)
#undef gethostbyname
+/* GPL */
struct hostent * WSAAPI
rb_w32_gethostbyname(const char *name)
{
@@ -3341,6 +3467,7 @@ rb_w32_gethostbyname(const char *name)
#undef gethostname
+/* GPL */
int WSAAPI
rb_w32_gethostname(char *name, int len)
{
@@ -3358,6 +3485,7 @@ rb_w32_gethostname(char *name, int len)
#undef getprotobyname
+/* GPL */
struct protoent * WSAAPI
rb_w32_getprotobyname(const char *name)
{
@@ -3375,6 +3503,7 @@ rb_w32_getprotobyname(const char *name)
#undef getprotobynumber
+/* GPL */
struct protoent * WSAAPI
rb_w32_getprotobynumber(int num)
{
@@ -3392,6 +3521,7 @@ rb_w32_getprotobynumber(int num)
#undef getservbyname
+/* GPL */
struct servent * WSAAPI
rb_w32_getservbyname(const char *name, const char *proto)
{
@@ -3409,6 +3539,7 @@ rb_w32_getservbyname(const char *name, const char *proto)
#undef getservbyport
+/* GPL */
struct servent * WSAAPI
rb_w32_getservbyport(int port, const char *proto)
{
@@ -3424,6 +3555,7 @@ rb_w32_getservbyport(int port, const char *proto)
return r;
}
+/* non GPL */
static int
socketpair_internal(int af, int type, int protocol, SOCKET *sv)
{
@@ -3514,6 +3646,7 @@ socketpair_internal(int af, int type, int protocol, SOCKET *sv)
return ret;
}
+/* non GPL */
int
rb_w32_socketpair(int af, int type, int protocol, int *sv)
{
@@ -3566,6 +3699,7 @@ void setprotoent (int stayopen) {}
void setservent (int stayopen) {}
+/* non GPL */
int
fcntl(int fd, int cmd, ...)
{
@@ -3614,6 +3748,7 @@ fcntl(int fd, int cmd, ...)
#define WNOHANG -1
#endif
+/* non GPL */
static rb_pid_t
poll_child_status(struct ChildRecord *child, int *stat_loc)
{
@@ -3649,17 +3784,20 @@ poll_child_status(struct ChildRecord *child, int *stat_loc)
return 0;
}
+/* GPL */
rb_pid_t
waitpid(rb_pid_t pid, int *stat_loc, int options)
{
DWORD timeout;
+ /* GPL start */
if (options == WNOHANG) {
timeout = 0;
}
else {
timeout = INFINITE;
}
+ /* GPL end */
if (pid == -1) {
int count = 0;
@@ -3710,6 +3848,7 @@ waitpid(rb_pid_t pid, int *stat_loc, int options)
#include <sys/timeb.h>
+/* non GPL */
static int
filetime_to_timeval(const FILETIME* ft, struct timeval *tv)
{
@@ -3733,6 +3872,7 @@ filetime_to_timeval(const FILETIME* ft, struct timeval *tv)
return tv->tv_sec > 0 ? 0 : -1;
}
+/* non GPL */
int _cdecl
gettimeofday(struct timeval *tv, struct timezone *tz)
{
@@ -3744,6 +3884,7 @@ gettimeofday(struct timeval *tv, struct timezone *tz)
return 0;
}
+/* non GPL */
char *
rb_w32_getcwd(char *buffer, int size)
{
@@ -3783,18 +3924,21 @@ rb_w32_getcwd(char *buffer, int size)
return p;
}
+/* GPL */
int
chown(const char *path, int owner, int group)
{
return 0;
}
+/* GPL */
int
rb_w32_uchown(const char *path, int owner, int group)
{
return 0;
}
+/* non GPL */
int
kill(int pid, int sig)
{
@@ -3899,6 +4043,7 @@ kill(int pid, int sig)
return ret;
}
+/* non GPL */
static int
wlink(const WCHAR *from, const WCHAR *to)
{
@@ -3924,6 +4069,7 @@ wlink(const WCHAR *from, const WCHAR *to)
return 0;
}
+/* non GPL */
int
rb_w32_ulink(const char *from, const char *to)
{
@@ -3943,6 +4089,7 @@ rb_w32_ulink(const char *from, const char *to)
return ret;
}
+/* non GPL */
int
link(const char *from, const char *to)
{
@@ -3962,12 +4109,14 @@ link(const char *from, const char *to)
return ret;
}
+/* non GPL */
int
wait(int *status)
{
return waitpid(-1, status, 0);
}
+/* non GPL */
char *
rb_w32_getenv(const char *name)
{
@@ -3989,6 +4138,7 @@ rb_w32_getenv(const char *name)
return NULL;
}
+/* GPL */
static int
wrename(const WCHAR *oldpath, const WCHAR *newpath)
{
@@ -4041,6 +4191,7 @@ wrename(const WCHAR *oldpath, const WCHAR *newpath)
return res;
}
+/* non GPL */
int rb_w32_urename(const char *from, const char *to)
{
WCHAR *wfrom;
@@ -4059,6 +4210,7 @@ int rb_w32_urename(const char *from, const char *to)
return ret;
}
+/* non GPL */
int rb_w32_rename(const char *from, const char *to)
{
WCHAR *wfrom;
@@ -4077,6 +4229,7 @@ int rb_w32_rename(const char *from, const char *to)
return ret;
}
+/* non GPL */
static int
isUNCRoot(const WCHAR *path)
{
@@ -4114,6 +4267,7 @@ isUNCRoot(const WCHAR *path)
#ifdef __BORLANDC__
#undef fstat
+/* non GPL */
int
rb_w32_fstat(int fd, struct stat *st)
{
@@ -4129,6 +4283,7 @@ rb_w32_fstat(int fd, struct stat *st)
return ret;
}
+/* non GPL */
int
rb_w32_fstati64(int fd, struct stati64 *st)
{
@@ -4149,6 +4304,7 @@ rb_w32_fstati64(int fd, struct stati64 *st)
}
#endif
+/* non GPL */
static time_t
filetime_to_unixtime(const FILETIME *ft)
{
@@ -4160,6 +4316,7 @@ filetime_to_unixtime(const FILETIME *ft)
return tv.tv_sec;
}
+/* non GPL */
static unsigned
fileattr_to_unixmode(DWORD attr, const WCHAR *path)
{
@@ -4201,6 +4358,7 @@ fileattr_to_unixmode(DWORD attr, const WCHAR *path)
return mode;
}
+/* non GPL */
static int
check_valid_dir(const WCHAR *path)
{
@@ -4212,6 +4370,7 @@ check_valid_dir(const WCHAR *path)
return 0;
}
+/* non GPL */
static int
winnt_stat(const WCHAR *path, struct stati64 *st)
{
@@ -4255,6 +4414,7 @@ winnt_stat(const WCHAR *path, struct stati64 *st)
}
#ifdef WIN95
+/* non GPL */
static int
win95_stat(const WCHAR *path, struct stati64 *st)
{
@@ -4269,6 +4429,7 @@ win95_stat(const WCHAR *path, struct stati64 *st)
#define win95_stat(path, st) -1
#endif
+/* non GPL */
int
rb_w32_stat(const char *path, struct stat *st)
{
@@ -4279,6 +4440,7 @@ rb_w32_stat(const char *path, struct stat *st)
return 0;
}
+/* non GPL */
static int
wstati64(const WCHAR *path, struct stati64 *st)
{
@@ -4327,6 +4489,7 @@ wstati64(const WCHAR *path, struct stati64 *st)
return ret;
}
+/* non GPL */
int
rb_w32_ustati64(const char *path, struct stati64 *st)
{
@@ -4340,6 +4503,7 @@ rb_w32_ustati64(const char *path, struct stati64 *st)
return ret;
}
+/* non GPL */
int
rb_w32_stati64(const char *path, struct stati64 *st)
{
@@ -4353,6 +4517,7 @@ rb_w32_stati64(const char *path, struct stati64 *st)
return ret;
}
+/* non GPL */
int
rb_w32_access(const char *path, int mode)
{
@@ -4367,6 +4532,7 @@ rb_w32_access(const char *path, int mode)
return 0;
}
+/* non GPL */
int
rb_w32_uaccess(const char *path, int mode)
{
@@ -4381,6 +4547,7 @@ rb_w32_uaccess(const char *path, int mode)
return 0;
}
+/* non GPL */
static int
rb_chsize(HANDLE h, off_t size)
{
@@ -4412,6 +4579,7 @@ rb_chsize(HANDLE h, off_t size)
return ret;
}
+/* non GPL */
int
rb_w32_truncate(const char *path, off_t length)
{
@@ -4438,6 +4606,7 @@ rb_w32_truncate(const char *path, off_t length)
return ret;
}
+/* non GPL */
int
rb_w32_ftruncate(int fd, off_t length)
{
@@ -4454,6 +4623,7 @@ rb_w32_ftruncate(int fd, off_t length)
}
#ifdef __BORLANDC__
+/* non GPL */
off_t
_filelengthi64(int fd)
{
@@ -4468,6 +4638,7 @@ _filelengthi64(int fd)
return ((off_t)u << 32) | l;
}
+/* non GPL */
off_t
_lseeki64(int fd, off_t offset, int whence)
{
@@ -4489,6 +4660,7 @@ _lseeki64(int fd, off_t offset, int whence)
}
#endif
+/* non GPL */
int
fseeko(FILE *stream, off_t offset, int whence)
{
@@ -4511,6 +4683,7 @@ fseeko(FILE *stream, off_t offset, int whence)
return fsetpos(stream, (fpos_t *)&pos);
}
+/* non GPL */
off_t
rb_w32_ftello(FILE *stream)
{
@@ -4519,6 +4692,7 @@ rb_w32_ftello(FILE *stream)
return pos;
}
+/* non GPL */
static long
filetime_to_clock(FILETIME *ft)
{
@@ -4529,6 +4703,7 @@ filetime_to_clock(FILETIME *ft)
return (long) qw;
}
+/* non GPL */
int
rb_w32_times(struct tms *tmbuf)
{
@@ -4552,6 +4727,7 @@ rb_w32_times(struct tms *tmbuf)
#define yield_once() Sleep(0)
#define yield_until(condition) do yield_once(); while (!(condition))
+/* non GPL */
static void
catch_interrupt(void)
{
@@ -4561,6 +4737,7 @@ catch_interrupt(void)
#if defined __BORLANDC__
#undef read
+/* non GPL */
int
read(int fd, void *buf, size_t size)
{
@@ -4575,6 +4752,7 @@ read(int fd, void *buf, size_t size)
#endif
#undef fgetc
+/* non GPL */
int
rb_w32_getc(FILE* stream)
{
@@ -4595,6 +4773,7 @@ rb_w32_getc(FILE* stream)
}
#undef fputc
+/* non GPL */
int
rb_w32_putc(int c, FILE* stream)
{
@@ -4608,6 +4787,7 @@ rb_w32_putc(int c, FILE* stream)
return c;
}
+/* non GPL */
struct asynchronous_arg_t {
/* output field */
void* stackaddr;
@@ -4620,6 +4800,7 @@ struct asynchronous_arg_t {
uintptr_t* argv;
};
+/* non GPL */
static DWORD WINAPI
call_asynchronous(PVOID argp)
{
@@ -4631,6 +4812,7 @@ call_asynchronous(PVOID argp)
return ret;
}
+/* non GPL */
uintptr_t
rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self,
int argc, uintptr_t* argv, uintptr_t intrval)
@@ -4693,6 +4875,7 @@ rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self,
return val;
}
+/* non GPL */
char **
rb_w32_get_environ(void)
{
@@ -4728,6 +4911,7 @@ rb_w32_get_environ(void)
return myenvtop;
}
+/* non GPL */
void
rb_w32_free_environ(char **env)
{
@@ -4737,6 +4921,7 @@ rb_w32_free_environ(char **env)
free(env);
}
+/* non GPL */
rb_pid_t
rb_w32_getpid(void)
{
@@ -4750,6 +4935,7 @@ rb_w32_getpid(void)
}
+/* non GPL */
rb_pid_t
rb_w32_getppid(void)
{
@@ -4780,6 +4966,7 @@ rb_w32_getppid(void)
return ppid;
}
+/* non GPL */
int
rb_w32_uopen(const char *file, int oflag, ...)
{
@@ -4799,6 +4986,7 @@ rb_w32_uopen(const char *file, int oflag, ...)
return ret;
}
+/* non GPL */
int
rb_w32_open(const char *file, int oflag, ...)
{
@@ -4988,6 +5176,7 @@ rb_w32_wopen(const WCHAR *file, int oflag, ...)
return fd;
}
+/* non GPL */
int
rb_w32_fclose(FILE *fp)
{
@@ -5010,6 +5199,7 @@ rb_w32_fclose(FILE *fp)
return 0;
}
+/* non GPL */
int
rb_w32_pipe(int fds[2])
{
@@ -5102,6 +5292,7 @@ rb_w32_pipe(int fds[2])
return 0;
}
+/* non GPL */
int
rb_w32_close(int fd)
{
@@ -5127,6 +5318,7 @@ rb_w32_close(int fd)
}
#undef read
+/* non GPL */
ssize_t
rb_w32_read(int fd, void *buf, size_t size)
{
@@ -5283,6 +5475,7 @@ rb_w32_read(int fd, void *buf, size_t size)
}
#undef write
+/* non GPL */
ssize_t
rb_w32_write(int fd, const void *buf, size_t size)
{
@@ -5408,6 +5601,7 @@ rb_w32_write(int fd, const void *buf, size_t size)
return ret;
}
+/* non GPL */
long
rb_w32_write_console(uintptr_t strarg, int fd)
{
@@ -5433,6 +5627,7 @@ rb_w32_write_console(uintptr_t strarg, int fd)
return (long)reslen;
}
+/* non GPL */
static int
unixtime_to_filetime(time_t time, FILETIME *ft)
{
@@ -5457,6 +5652,7 @@ unixtime_to_filetime(time_t time, FILETIME *ft)
return 0;
}
+/* non GPL */
static int
wutime(const WCHAR *path, const struct utimbuf *times)
{
@@ -5506,6 +5702,7 @@ wutime(const WCHAR *path, const struct utimbuf *times)
return ret;
}
+/* non GPL */
int
rb_w32_uutime(const char *path, const struct utimbuf *times)
{
@@ -5519,6 +5716,7 @@ rb_w32_uutime(const char *path, const struct utimbuf *times)
return ret;
}
+/* non GPL */
int
rb_w32_utime(const char *path, const struct utimbuf *times)
{
@@ -5532,6 +5730,7 @@ rb_w32_utime(const char *path, const struct utimbuf *times)
return ret;
}
+/* non GPL */
int
rb_w32_uchdir(const char *path)
{
@@ -5545,6 +5744,7 @@ rb_w32_uchdir(const char *path)
return ret;
}
+/* non GPL */
static int
wmkdir(const WCHAR *wpath, int mode)
{
@@ -5564,6 +5764,7 @@ wmkdir(const WCHAR *wpath, int mode)
return ret;
}
+/* non GPL */
int
rb_w32_umkdir(const char *path, int mode)
{
@@ -5577,6 +5778,7 @@ rb_w32_umkdir(const char *path, int mode)
return ret;
}
+/* non GPL */
int
rb_w32_mkdir(const char *path, int mode)
{
@@ -5590,6 +5792,7 @@ rb_w32_mkdir(const char *path, int mode)
return ret;
}
+/* non GPL */
static int
wrmdir(const WCHAR *wpath)
{
@@ -5610,6 +5813,7 @@ wrmdir(const WCHAR *wpath)
return ret;
}
+/* non GPL */
int
rb_w32_rmdir(const char *path)
{
@@ -5623,6 +5827,7 @@ rb_w32_rmdir(const char *path)
return ret;
}
+/* non GPL */
int
rb_w32_urmdir(const char *path)
{
@@ -5636,6 +5841,7 @@ rb_w32_urmdir(const char *path)
return ret;
}
+/* non GPL */
static int
wunlink(const WCHAR *path)
{
@@ -5656,6 +5862,7 @@ wunlink(const WCHAR *path)
return ret;
}
+/* non GPL */
int
rb_w32_uunlink(const char *path)
{
@@ -5669,6 +5876,7 @@ rb_w32_uunlink(const char *path)
return ret;
}
+/* non GPL */
int
rb_w32_unlink(const char *path)
{
@@ -5682,6 +5890,7 @@ rb_w32_unlink(const char *path)
return ret;
}
+/* non GPL */
int
rb_w32_uchmod(const char *path, int mode)
{
@@ -5696,6 +5905,7 @@ rb_w32_uchmod(const char *path, int mode)
}
#if !defined(__BORLANDC__)
+/* non GPL */
int
rb_w32_isatty(int fd)
{
@@ -5718,6 +5928,7 @@ rb_w32_isatty(int fd)
//
#ifdef __BORLANDC__
+/* non GPL */
static int
too_many_files(void)
{
@@ -5729,6 +5940,7 @@ too_many_files(void)
}
#undef fopen
+/* non GPL */
FILE *
rb_w32_fopen(const char *path, const char *mode)
{
@@ -5740,6 +5952,7 @@ rb_w32_fopen(const char *path, const char *mode)
return f;
}
+/* non GPL */
FILE *
rb_w32_fdopen(int handle, const char *type)
{
@@ -5753,6 +5966,7 @@ rb_w32_fdopen(int handle, const char *type)
return f;
}
+/* non GPL */
FILE *
rb_w32_fsopen(const char *path, const char *mode, int shflags)
{
@@ -5767,11 +5981,13 @@ rb_w32_fsopen(const char *path, const char *mode, int shflags)
#if defined(_MSC_VER) && RT_VER <= 60
extern long _ftol(double);
+/* non GPL */
long
_ftol2(double d)
{
return _ftol(d);
}
+/* non GPL */
long
_ftol2_sse(double d)
{
@@ -5780,6 +5996,7 @@ _ftol2_sse(double d)
#endif
#ifndef signbit
+/* non GPL */
int
signbit(double x)
{
@@ -5788,6 +6005,7 @@ signbit(double x)
}
#endif
+/* non GPL */
char * WSAAPI
rb_w32_inet_ntop(int af, void *addr, char *numaddr, size_t numaddr_len)
{