rktio: use -Wall
and fix warnings
This commit is contained in:
parent
a929c58712
commit
2f5797f1d5
9
racket/src/rktio/configure
vendored
9
racket/src/rktio/configure
vendored
|
@ -3036,6 +3036,11 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
|
||||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||||
|
|
||||||
|
|
||||||
|
# If using gcc, we want all warnings:
|
||||||
|
if test "$CC" = "gcc" ; then
|
||||||
|
CFLAGS="$CFLAGS -Wall"
|
||||||
|
fi
|
||||||
|
|
||||||
if test -n "$ac_tool_prefix"; then
|
if test -n "$ac_tool_prefix"; then
|
||||||
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
|
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
|
||||||
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
|
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
|
||||||
|
@ -4188,11 +4193,11 @@ if test "${enable_shared}" = "yes" ; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AR="${LIBTOOLPROG} --mode=link --tag=CC $CC${need_gcc_static_libgcc}${ar_libtool_no_undefined} -release ${plt_lib_version} -rpath ${abslibdir} \$(ARLIBFLAGS) -o"
|
AR="${LIBTOOLPROG} --mode=link --tag=CC $CC${need_gcc_static_libgcc}${ar_libtool_no_undefined} -release ${plt_lib_version} \$(ARLIBFLAGS) -o"
|
||||||
STATIC_AR="${LIBTOOLPROG} --mode=link --tag=CC $CC -o"
|
STATIC_AR="${LIBTOOLPROG} --mode=link --tag=CC $CC -o"
|
||||||
ARFLAGS=""
|
ARFLAGS=""
|
||||||
RANLIB=":"
|
RANLIB=":"
|
||||||
RKTLINKER="${LIBTOOLPROG} --mode=link --tag=CC $CC${need_gcc_static_libgcc} -rpath ${abslibdir}"
|
RKTLINKER="${LIBTOOLPROG} --mode=link --tag=CC $CC${need_gcc_static_libgcc}"
|
||||||
CC="${LIBTOOLPROG} --mode=compile --tag=CC $CC"
|
CC="${LIBTOOLPROG} --mode=compile --tag=CC $CC"
|
||||||
LIBSFX=la
|
LIBSFX=la
|
||||||
LTO="lo"
|
LTO="lo"
|
||||||
|
|
|
@ -16,6 +16,11 @@ AC_ARG_ENABLE(shared, [ --enable-shared create shared libraries (ok, b
|
||||||
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
|
||||||
|
# If using gcc, we want all warnings:
|
||||||
|
if test "$CC" = "gcc" ; then
|
||||||
|
CFLAGS="$CFLAGS -Wall"
|
||||||
|
fi
|
||||||
|
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
if test "$AR" = '' ; then
|
if test "$AR" = '' ; then
|
||||||
AR="${ac_tool_prefix}ar"
|
AR="${ac_tool_prefix}ar"
|
||||||
|
|
|
@ -242,7 +242,7 @@ void rktio_poll_add_fs_change(rktio_t *rktio, rktio_fs_change_t *fc, rktio_poll_
|
||||||
void rktio_poll_set_add_nosleep(rktio_t *rktio, rktio_poll_set_t *fds);
|
void rktio_poll_set_add_nosleep(rktio_t *rktio, rktio_poll_set_t *fds);
|
||||||
|
|
||||||
#ifdef RKTIO_SYSTEM_WINDOWS
|
#ifdef RKTIO_SYSTEM_WINDOWS
|
||||||
void rktio_poll_set_add_handle(rktio_t *rktio, HANDLE h, rktio_poll_set_t *fds, int repost);
|
void rktio_poll_set_add_handle(rktio_t *rktio, intptr_t h, rktio_poll_set_t *fds, int repost);
|
||||||
void rktio_poll_set_add_eventmask(rktio_t *rktio, rktio_poll_set_t *fds, int mask);
|
void rktio_poll_set_add_eventmask(rktio_t *rktio, rktio_poll_set_t *fds, int mask);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
#if ((defined(_MSC_VER) || defined(__MINGW32__)) \
|
||||||
|
&& (defined(__WIN32__) || defined(WIN32) || defined(_WIN32)))
|
||||||
|
# define RKTIO_SYSTEM_WINDOWS
|
||||||
|
#else
|
||||||
|
# define RKTIO_SYSTEM_UNIX
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Whether `intptr_t' is available. */
|
/* Whether `intptr_t' is available. */
|
||||||
#undef HAVE_INTPTR_T
|
#undef HAVE_INTPTR_T
|
||||||
|
|
||||||
|
|
|
@ -66,13 +66,13 @@ typedef struct Win_FD_Output_Thread {
|
||||||
works. We still use a thread to detect when the
|
works. We still use a thread to detect when the
|
||||||
write has ben flushed, which in turn is needed to
|
write has ben flushed, which in turn is needed to
|
||||||
know whether future writes will immediately succeed. */
|
know whether future writes will immediately succeed. */
|
||||||
volatile flushed, needflush; /* Used for non-blocking, only. The flushed
|
volatile int flushed, needflush; /* Used for non-blocking, only. The flushed
|
||||||
flag communicates from the flush-testing thread
|
flag communicates from the flush-testing thread
|
||||||
to the main thread. For efficiency, we request
|
to the main thread. For efficiency, we request
|
||||||
flush checking only when needed (instead of
|
flush checking only when needed (instead of
|
||||||
after every write); needflush indicates that
|
after every write); needflush indicates that
|
||||||
a flush check is currently needed, but hasn't
|
a flush check is currently needed, but hasn't
|
||||||
been started. */
|
been started. */
|
||||||
volatile int done, err_no;
|
volatile int done, err_no;
|
||||||
volatile unsigned int buflen, bufstart, bufend; /* used for blocking, only */
|
volatile unsigned int buflen, bufstart, bufend; /* used for blocking, only */
|
||||||
unsigned char *buffer; /* used for blocking, only */
|
unsigned char *buffer; /* used for blocking, only */
|
||||||
|
@ -147,7 +147,7 @@ static void init_read_fd(rktio_t *rktio, rktio_fd_t *rfd)
|
||||||
/* Replace buffer with a malloced one: */
|
/* Replace buffer with a malloced one: */
|
||||||
bfr = malloc(RKTIO_FD_BUFFSIZE);
|
bfr = malloc(RKTIO_FD_BUFFSIZE);
|
||||||
rfd->buffer = bfr;
|
rfd->buffer = bfr;
|
||||||
th->buffer = bfr;
|
th->buffer = (unsigned char *)bfr;
|
||||||
|
|
||||||
th->fd = rfd->fd;
|
th->fd = rfd->fd;
|
||||||
th->avail = 0;
|
th->avail = 0;
|
||||||
|
@ -286,8 +286,6 @@ void rktio_reliably_close(intptr_t s) {
|
||||||
int rktio_close(rktio_t *rktio, rktio_fd_t *rfd)
|
int rktio_close(rktio_t *rktio, rktio_fd_t *rfd)
|
||||||
{
|
{
|
||||||
#ifdef RKTIO_SYSTEM_UNIX
|
#ifdef RKTIO_SYSTEM_UNIX
|
||||||
int cr;
|
|
||||||
|
|
||||||
# ifdef USE_FCNTL_AND_FORK_FOR_FILE_LOCKS
|
# ifdef USE_FCNTL_AND_FORK_FOR_FILE_LOCKS
|
||||||
if (!(rfd->modes & RKTIO_OPEN_SOCKET))
|
if (!(rfd->modes & RKTIO_OPEN_SOCKET))
|
||||||
release_lockf(rfd->fd);
|
release_lockf(rfd->fd);
|
||||||
|
@ -613,28 +611,28 @@ void rktio_poll_add(rktio_t *rktio, rktio_fd_t *rfd, rktio_poll_set_t *fds, int
|
||||||
if (rfd->th->avail || rfd->th->err || rfd->th->eof) {
|
if (rfd->th->avail || rfd->th->err || rfd->th->eof) {
|
||||||
/* Data is ready. We shouldn't be trying to sleep, so force an
|
/* Data is ready. We shouldn't be trying to sleep, so force an
|
||||||
immediate wake-up: */
|
immediate wake-up: */
|
||||||
rktio_fdset_add_nosleep(fds);
|
rktio_poll_set_add_nosleep(rktio, fds);
|
||||||
} else {
|
} else {
|
||||||
rfd->th->checking = 1;
|
rfd->th->checking = 1;
|
||||||
ReleaseSemaphore(rfd->th->checking_sema, 1, NULL);
|
ReleaseSemaphore(rfd->th->checking_sema, 1, NULL);
|
||||||
rktio_fdset_add_handle(rfd->th->ready_sema, fds, 1);
|
rktio_poll_set_add_handle(rktio, (intptr_t)rfd->th->ready_sema, fds, 1);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
rktio_fdset_add_handle(rfd->th->ready_sema, fds, 1);
|
rktio_poll_set_add_handle(rktio, (intptr_t)rfd->th->ready_sema, fds, 1);
|
||||||
} else if (rktio_fd_is_regular_file(rktio, rfd)) {
|
} else if (rktio_fd_is_regular_file(rktio, rfd)) {
|
||||||
/* regular files never block */
|
/* regular files never block */
|
||||||
rktio_fdset_add_nosleep(fds);
|
rktio_poll_set_add_nosleep(rktio, fds);
|
||||||
} else {
|
} else {
|
||||||
/* This case is not currently used. See fd_byte_ready. */
|
/* This case is not currently used. See fd_byte_ready. */
|
||||||
rktio_fdset_add_handle(rfd->fd, fds, 0);
|
rktio_poll_set_add_handle(rktio, (intptr_t)rfd->fd, fds, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modes & RKTIO_POLL_WRITE) {
|
if (modes & RKTIO_POLL_WRITE) {
|
||||||
if (rfd->oth && !rktio_poll_write_ready(rktio, rfd))
|
if (rfd->oth && !rktio_poll_write_ready(rktio, rfd))
|
||||||
rktio_poll_set_add_handle(rfd->oth->ready_sema, fds, 1);
|
rktio_poll_set_add_handle(rktio, (intptr_t)rfd->oth->ready_sema, fds, 1);
|
||||||
else
|
else
|
||||||
rktio_poll_set_nosleep(fds);
|
rktio_poll_set_nosleep(rktio, fds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,12 +9,13 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef RKTIO_SYSTEM_UNIX
|
#ifdef RKTIO_SYSTEM_UNIX
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
#include <pwd.h>
|
# include <pwd.h>
|
||||||
#include <grp.h>
|
# include <grp.h>
|
||||||
#include <dirent.h>
|
# include <dirent.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef RKTIO_SYSTEM_WINDOWS
|
#ifdef RKTIO_SYSTEM_WINDOWS
|
||||||
# include <shlobj.h>
|
# include <shlobj.h>
|
||||||
|
# include <direct.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RKTIO_SYSTEM_UNIX
|
#ifdef RKTIO_SYSTEM_UNIX
|
||||||
|
@ -108,6 +109,10 @@ static void init_procs()
|
||||||
# define GET_FF_MODDATE(fd) convert_date(&fd.ftLastWriteTime)
|
# define GET_FF_MODDATE(fd) convert_date(&fd.ftLastWriteTime)
|
||||||
# define GET_FF_NAME(fd) fd.cFileName
|
# define GET_FF_NAME(fd) fd.cFileName
|
||||||
|
|
||||||
|
# define MKDIR_NO_MODE_FLAG
|
||||||
|
|
||||||
|
#define is_drive_letter(c) (((unsigned char)c < 128) && isalpha((unsigned char)c))
|
||||||
|
|
||||||
static time_t convert_date(const FILETIME *ft)
|
static time_t convert_date(const FILETIME *ft)
|
||||||
{
|
{
|
||||||
LONGLONG l, delta;
|
LONGLONG l, delta;
|
||||||
|
@ -418,7 +423,7 @@ static int UNC_stat(rktio_t *rktio, const char *dirname, int *flags, int *isdir,
|
||||||
if (dest) free(dest);
|
if (dest) free(dest);
|
||||||
dest_len = len + 1;
|
dest_len = len + 1;
|
||||||
dest = malloc(dest_len);
|
dest = malloc(dest_len);
|
||||||
len = GetFinalPathNameByHandleProcW(h, dest, dest_len, rktioFILE_NAME_NORMALIZED);
|
len = GetFinalPathNameByHandleProc(h, dest, dest_len, rktioFILE_NAME_NORMALIZED);
|
||||||
} while (len > dest_len);
|
} while (len > dest_len);
|
||||||
|
|
||||||
if (!len) {
|
if (!len) {
|
||||||
|
@ -756,9 +761,8 @@ static int enable_write_permission(rktio_t *rktio, const char *fn)
|
||||||
|
|
||||||
int rktio_delete_file(rktio_t *rktio, char *fn, int enable_write_on_fail)
|
int rktio_delete_file(rktio_t *rktio, char *fn, int enable_write_on_fail)
|
||||||
{
|
{
|
||||||
int errid;
|
|
||||||
|
|
||||||
#ifdef RKTIO_SYSTEM_WINDOWS
|
#ifdef RKTIO_SYSTEM_WINDOWS
|
||||||
|
int errid;
|
||||||
if (DeleteFileW(WIDE_PATH_temp(fn)))
|
if (DeleteFileW(WIDE_PATH_temp(fn)))
|
||||||
return 1;
|
return 1;
|
||||||
errid = GetLastError();
|
errid = GetLastError();
|
||||||
|
@ -803,7 +807,6 @@ int rktio_rename_file(rktio_t *rktio, char *dest, char *src, int exists_ok)
|
||||||
/* Then we have the great misfortune of running in Windows 9x. If
|
/* Then we have the great misfortune of running in Windows 9x. If
|
||||||
exists_ok, then do something no less stupid than the OS
|
exists_ok, then do something no less stupid than the OS
|
||||||
itself: */
|
itself: */
|
||||||
int errid;
|
|
||||||
if (exists_ok)
|
if (exists_ok)
|
||||||
MSC_W_IZE(unlink)(MSC_WIDE_PATH_temp(dest));
|
MSC_W_IZE(unlink)(MSC_WIDE_PATH_temp(dest));
|
||||||
if (MoveFileW(src_w, WIDE_PATH_temp(dest))) {
|
if (MoveFileW(src_w, WIDE_PATH_temp(dest))) {
|
||||||
|
@ -878,7 +881,6 @@ int rktio_make_directory(rktio_t *rktio, char *filename)
|
||||||
set_racket_error(RKTIO_ERROR_UNSUPPORTED);
|
set_racket_error(RKTIO_ERROR_UNSUPPORTED);
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
int exists_already = 0;
|
|
||||||
int len, copied = 0;
|
int len, copied = 0;
|
||||||
|
|
||||||
/* Make sure path doesn't have trailing separator: */
|
/* Make sure path doesn't have trailing separator: */
|
||||||
|
@ -1226,7 +1228,6 @@ int rktio_set_file_or_directory_permissions(rktio_t *rktio, char *filename, int
|
||||||
# endif
|
# endif
|
||||||
# ifdef RKTIO_SYSTEM_WINDOWS
|
# ifdef RKTIO_SYSTEM_WINDOWS
|
||||||
{
|
{
|
||||||
int len = strlen(filename);
|
|
||||||
int ALWAYS_SET_BITS = ((RKTIO_UNC_READ | RKTIO_UNC_EXEC)
|
int ALWAYS_SET_BITS = ((RKTIO_UNC_READ | RKTIO_UNC_EXEC)
|
||||||
| ((RKTIO_UNC_READ | RKTIO_UNC_EXEC) << 3)
|
| ((RKTIO_UNC_READ | RKTIO_UNC_EXEC) << 3)
|
||||||
| ((RKTIO_UNC_READ | RKTIO_UNC_EXEC) << 6));
|
| ((RKTIO_UNC_READ | RKTIO_UNC_EXEC) << 6));
|
||||||
|
@ -1314,7 +1315,6 @@ rktio_directory_list_t *rktio_directory_list_start(rktio_t *rktio, char *filenam
|
||||||
retry:
|
retry:
|
||||||
|
|
||||||
{
|
{
|
||||||
char *nf;
|
|
||||||
int is_ssq = 0, is_unc = 0, d, nd;
|
int is_ssq = 0, is_unc = 0, d, nd;
|
||||||
len = strlen(filename);
|
len = strlen(filename);
|
||||||
pattern = malloc(len + 14);
|
pattern = malloc(len + 14);
|
||||||
|
@ -1347,7 +1347,7 @@ rktio_directory_list_t *rktio_directory_list_start(rktio_t *rktio, char *filenam
|
||||||
nd = 0;
|
nd = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memcpy(pattern + d, nf + nd, len - nd);
|
memcpy(pattern + d, filename + nd, len - nd);
|
||||||
len += (d - nd);
|
len += (d - nd);
|
||||||
if (len && !IS_A_DOS_SEP(pattern[len - 1]))
|
if (len && !IS_A_DOS_SEP(pattern[len - 1]))
|
||||||
pattern[len++] = '\\';
|
pattern[len++] = '\\';
|
||||||
|
@ -1410,7 +1410,6 @@ rktio_directory_list_t *rktio_directory_list_start(rktio_t *rktio, char *filenam
|
||||||
{
|
{
|
||||||
rktio_directory_list_t *dl;
|
rktio_directory_list_t *dl;
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
int nlen;
|
|
||||||
|
|
||||||
dir = opendir(filename ? filename : ".");
|
dir = opendir(filename ? filename : ".");
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
|
@ -1633,7 +1632,7 @@ char **rktio_filesystem_root_list(rktio_t *rktio)
|
||||||
if (GetDiskFreeSpace(s + ds, &a, &b, &c, &d)) {
|
if (GetDiskFreeSpace(s + ds, &a, &b, &c, &d)) {
|
||||||
if ((ss_count + 1) == ss_len) {
|
if ((ss_count + 1) == ss_len) {
|
||||||
new_ss = malloc(sizeof(char*) * ss_len * 2);
|
new_ss = malloc(sizeof(char*) * ss_len * 2);
|
||||||
mempcy(ss, new_ss, ss_count * sizeof(char*));
|
memcpy(ss, new_ss, ss_count * sizeof(char*));
|
||||||
ss = new_ss;
|
ss = new_ss;
|
||||||
ss_len *= 2;
|
ss_len *= 2;
|
||||||
}
|
}
|
||||||
|
@ -1793,7 +1792,7 @@ char *rktio_system_path(rktio_t *rktio, int which)
|
||||||
|
|
||||||
{
|
{
|
||||||
/* Everything else is in ~: */
|
/* Everything else is in ~: */
|
||||||
char *home_str, *ex_home, *alt_home, *home;
|
char *home_str, *alt_home, *home;
|
||||||
|
|
||||||
if ((which == RKTIO_PATH_PREF_DIR)
|
if ((which == RKTIO_PATH_PREF_DIR)
|
||||||
|| (which == RKTIO_PATH_PREF_FILE)
|
|| (which == RKTIO_PATH_PREF_FILE)
|
||||||
|
@ -1905,7 +1904,7 @@ char *rktio_system_path(rktio_t *rktio, int which)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SHGetSpecialFolderLocation(NULL, which_folder, &items) == S_OK) {
|
if (SHGetSpecialFolderLocation(NULL, which_folder, &items) == S_OK) {
|
||||||
int ok;
|
int ok;
|
||||||
IMalloc *mi;
|
IMalloc *mi;
|
||||||
wchar_t *buf;
|
wchar_t *buf;
|
||||||
|
|
||||||
|
@ -1916,7 +1915,8 @@ char *rktio_system_path(rktio_t *rktio, int which)
|
||||||
mi->lpVtbl->Free(mi, items);
|
mi->lpVtbl->Free(mi, items);
|
||||||
mi->lpVtbl->Release(mi);
|
mi->lpVtbl->Release(mi);
|
||||||
|
|
||||||
home = NARROW_PATH_copy_then_free(buf);
|
if (ok)
|
||||||
|
home = NARROW_PATH_copy_then_free(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1961,7 +1961,7 @@ char *rktio_system_path(rktio_t *rktio, int which)
|
||||||
|
|
||||||
s = name;
|
s = name;
|
||||||
|
|
||||||
i = wc_strlen(s) - 1;
|
i = wcslen(s) - 1;
|
||||||
|
|
||||||
while (i && (s[i] != '\\')) {
|
while (i && (s[i] != '\\')) {
|
||||||
--i;
|
--i;
|
||||||
|
|
|
@ -69,7 +69,6 @@ rktio_fs_change_t *rktio_fs_change(rktio_t *rktio, char *path)
|
||||||
{
|
{
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
#ifndef NO_FILESYSTEM_CHANGE_EVTS
|
#ifndef NO_FILESYSTEM_CHANGE_EVTS
|
||||||
int errid = 0;
|
|
||||||
# if defined(HAVE_KQUEUE_SYSCALL)
|
# if defined(HAVE_KQUEUE_SYSCALL)
|
||||||
rktio_ltps_t *lt;
|
rktio_ltps_t *lt;
|
||||||
rktio_ltps_handle_t *lth;
|
rktio_ltps_handle_t *lth;
|
||||||
|
@ -219,7 +218,7 @@ void rktio_poll_add_fs_change(rktio_t *rktio, rktio_fs_change_t *fc, rktio_poll_
|
||||||
|
|
||||||
#if defined(NO_FILESYSTEM_CHANGE_EVTS)
|
#if defined(NO_FILESYSTEM_CHANGE_EVTS)
|
||||||
#elif defined(RKTIO_SYSTEM_WINDOWS)
|
#elif defined(RKTIO_SYSTEM_WINDOWS)
|
||||||
rktio_poll_set_add_handle(rktio, (HANDLE)fc->fd, fds, 0);
|
rktio_poll_set_add_handle(rktio, fc->fd, fds, 0);
|
||||||
#elif defined(HAVE_INOTIFY_SYSCALL)
|
#elif defined(HAVE_INOTIFY_SYSCALL)
|
||||||
int fd;
|
int fd;
|
||||||
fd = do_inotify_fd(rktio);
|
fd = do_inotify_fd(rktio);
|
||||||
|
|
|
@ -47,10 +47,13 @@ typedef struct rktio_ltps_handle_pair_t {
|
||||||
static rktio_ltps_handle_pair_t *ltps_hash_get(rktio_ltps_t *lt, intptr_t fd);
|
static rktio_ltps_handle_pair_t *ltps_hash_get(rktio_ltps_t *lt, intptr_t fd);
|
||||||
static void ltps_hash_set(rktio_ltps_t *lt, intptr_t fd, rktio_ltps_handle_pair_t *v);
|
static void ltps_hash_set(rktio_ltps_t *lt, intptr_t fd, rktio_ltps_handle_pair_t *v);
|
||||||
static void ltps_hash_remove(rktio_ltps_t *lt, intptr_t fd);
|
static void ltps_hash_remove(rktio_ltps_t *lt, intptr_t fd);
|
||||||
static int ltps_is_hash_empty(rktio_ltps_t *lt);
|
|
||||||
static void ltps_hash_init(rktio_ltps_t *lt);
|
static void ltps_hash_init(rktio_ltps_t *lt);
|
||||||
static void ltps_hash_free(rktio_ltps_t *lt);
|
static void ltps_hash_free(rktio_ltps_t *lt);
|
||||||
|
|
||||||
|
#if !defined(HAVE_KQUEUE_SYSCALL) && !defined(HAVE_EPOLL_SYSCALL)
|
||||||
|
static int ltps_is_hash_empty(rktio_ltps_t *lt);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*========================================================================*/
|
/*========================================================================*/
|
||||||
|
|
||||||
rktio_ltps_handle_pair_t *make_ltps_handle_pair()
|
rktio_ltps_handle_pair_t *make_ltps_handle_pair()
|
||||||
|
@ -363,7 +366,8 @@ rktio_ltps_handle_t *rktio_ltps_add(rktio_t *rktio, rktio_ltps_t *lt, rktio_fd_t
|
||||||
} else
|
} else
|
||||||
s = NULL;
|
s = NULL;
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
|
s = NULL;
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
#endif
|
#endif
|
||||||
|
@ -710,11 +714,6 @@ static void ltps_hash_set(rktio_ltps_t *lt, intptr_t fd, rktio_ltps_handle_pair_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ltps_is_hash_empty(rktio_ltps_t *lt)
|
|
||||||
{
|
|
||||||
return (lt->count == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ltps_hash_init(rktio_ltps_t *lt)
|
static void ltps_hash_init(rktio_ltps_t *lt)
|
||||||
{
|
{
|
||||||
lt->buckets = NULL;
|
lt->buckets = NULL;
|
||||||
|
@ -735,3 +734,10 @@ static void ltps_hash_free(rktio_ltps_t *lt)
|
||||||
free(lt->buckets);
|
free(lt->buckets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(HAVE_KQUEUE_SYSCALL) && !defined(HAVE_EPOLL_SYSCALL)
|
||||||
|
static int ltps_is_hash_empty(rktio_ltps_t *lt)
|
||||||
|
{
|
||||||
|
return (lt->count == 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -602,7 +602,7 @@ void rktio_poll_add_addrinfo_lookup(rktio_t *rktio, rktio_addrinfo_lookup_t *loo
|
||||||
ghbn_unlock(rktio);
|
ghbn_unlock(rktio);
|
||||||
|
|
||||||
# ifdef RKTIO_SYSTEM_WINDOWS
|
# ifdef RKTIO_SYSTEM_WINDOWS
|
||||||
rktio_poll_set_add_handle(lookup->done_sema, fds, 1);
|
rktio_poll_set_add_handle(rktio, (intptr_t)lookup->done_sema, fds, 1);
|
||||||
# else
|
# else
|
||||||
{
|
{
|
||||||
rktio_poll_set_t *fds2;
|
rktio_poll_set_t *fds2;
|
||||||
|
@ -704,7 +704,6 @@ rktio_addrinfo_lookup_t *rktio_start_addrinfo_lookup(rktio_t *rktio,
|
||||||
{
|
{
|
||||||
rktio_addrinfo_lookup_t *lookup;
|
rktio_addrinfo_lookup_t *lookup;
|
||||||
char buf[32], *service;
|
char buf[32], *service;
|
||||||
int err;
|
|
||||||
struct rktio_addrinfo_t *hints;
|
struct rktio_addrinfo_t *hints;
|
||||||
|
|
||||||
if (portno >= 0) {
|
if (portno >= 0) {
|
||||||
|
@ -1109,7 +1108,6 @@ static rktio_connect_t *try_connect(rktio_t *rktio, rktio_connect_t *conn);
|
||||||
rktio_connect_t *rktio_start_connect(rktio_t *rktio, rktio_addrinfo_t *dest, rktio_addrinfo_t *src)
|
rktio_connect_t *rktio_start_connect(rktio_t *rktio, rktio_addrinfo_t *dest, rktio_addrinfo_t *src)
|
||||||
{
|
{
|
||||||
rktio_connect_t *conn;
|
rktio_connect_t *conn;
|
||||||
int errid;
|
|
||||||
|
|
||||||
#ifdef USE_TCP
|
#ifdef USE_TCP
|
||||||
TCP_INIT("tcp-connect");
|
TCP_INIT("tcp-connect");
|
||||||
|
@ -1266,13 +1264,9 @@ static int get_no_portno(rktio_t *rktio, rktio_socket_t socket);
|
||||||
|
|
||||||
rktio_listener_t *rktio_listen(rktio_t *rktio, rktio_addrinfo_t *src, int backlog, int reuse)
|
rktio_listener_t *rktio_listen(rktio_t *rktio, rktio_addrinfo_t *src, int backlog, int reuse)
|
||||||
{
|
{
|
||||||
#ifdef RKTIO_TCP_LISTEN_IPV6_ONLY_SOCKOPT
|
|
||||||
int no_ipv6 = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
{
|
||||||
rktio_addrinfo_t *addr;
|
rktio_addrinfo_t *addr;
|
||||||
int err, count = 0, pos = 0, i;
|
int count = 0, pos = 0;
|
||||||
rktio_listener_t *l = NULL;
|
rktio_listener_t *l = NULL;
|
||||||
#ifdef RKTIO_TCP_LISTEN_IPV6_ONLY_SOCKOPT
|
#ifdef RKTIO_TCP_LISTEN_IPV6_ONLY_SOCKOPT
|
||||||
int any_v4 = 0, any_v6 = 0;
|
int any_v4 = 0, any_v6 = 0;
|
||||||
|
@ -1564,7 +1558,8 @@ void rktio_poll_add_receive(rktio_t *rktio, rktio_listener_t *listener, rktio_po
|
||||||
|
|
||||||
rktio_fd_t *rktio_accept(rktio_t *rktio, rktio_listener_t *listener)
|
rktio_fd_t *rktio_accept(rktio_t *rktio, rktio_listener_t *listener)
|
||||||
{
|
{
|
||||||
int was_closed = 0, errid, ready_pos;
|
int
|
||||||
|
ready_pos;
|
||||||
rktio_socket_t s, ls;
|
rktio_socket_t s, ls;
|
||||||
unsigned int l;
|
unsigned int l;
|
||||||
char tcp_accept_addr[RKTIO_SOCK_NAME_MAX_LEN];
|
char tcp_accept_addr[RKTIO_SOCK_NAME_MAX_LEN];
|
||||||
|
@ -1958,6 +1953,8 @@ int rktio_udp_change_multicast_group(rktio_t *rktio, rktio_fd_t *rfd,
|
||||||
optname = IP_ADD_MEMBERSHIP;
|
optname = IP_ADD_MEMBERSHIP;
|
||||||
else if (action == RKTIO_DROP_MEMBERSHIP)
|
else if (action == RKTIO_DROP_MEMBERSHIP)
|
||||||
optname = IP_DROP_MEMBERSHIP;
|
optname = IP_DROP_MEMBERSHIP;
|
||||||
|
else
|
||||||
|
optname = 0;
|
||||||
|
|
||||||
status = setsockopt(s, IPPROTO_IP, optname, (void *) &mreq, mreq_len);
|
status = setsockopt(s, IPPROTO_IP, optname, (void *) &mreq, mreq_len);
|
||||||
|
|
||||||
|
|
|
@ -525,8 +525,9 @@ int rktio_get_fd_limit(rktio_poll_set_t *fds)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rktio_poll_set_add_handle(HANDLE h, rktio_poll_set_t *fds, int repost)
|
void rktio_poll_set_add_handle(rktio_t *rktio, intptr_t _h, rktio_poll_set_t *fds, int repost)
|
||||||
{
|
{
|
||||||
|
HANDLE h = (HANDLE)_h;
|
||||||
rktio_poll_set_t *efd = fds;
|
rktio_poll_set_t *efd = fds;
|
||||||
HANDLE *hs;
|
HANDLE *hs;
|
||||||
int i, new_i, *rps;
|
int i, new_i, *rps;
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
#if ((defined(_MSC_VER) || defined(__MINGW32__)) \
|
|
||||||
&& (defined(__WIN32__) || defined(WIN32) || defined(_WIN32)))
|
|
||||||
# define RKTIO_SYSTEM_WINDOWS
|
|
||||||
#else
|
|
||||||
# define RKTIO_SYSTEM_UNIX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__MACH__) && !defined(OS_X)
|
#if defined(__APPLE__) && defined(__MACH__) && !defined(OS_X)
|
||||||
# define OS_X
|
# define OS_X
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -830,7 +830,7 @@ void rktio_poll_add_process(rktio_t *rktio, rktio_process_t *sp, rktio_poll_set_
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RKTIO_SYSTEM_WINDOWS
|
#ifdef RKTIO_SYSTEM_WINDOWS
|
||||||
rktio_poll_set_add_handle(rktio, sp->handle, fds, 0);
|
rktio_poll_set_add_handle(rktio, (intptr_t)sp->handle, fds, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1239,12 +1239,11 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
|
||||||
{
|
{
|
||||||
rktio_process_result_t *result;
|
rktio_process_result_t *result;
|
||||||
intptr_t to_subprocess[2], from_subprocess[2], err_subprocess[2];
|
intptr_t to_subprocess[2], from_subprocess[2], err_subprocess[2];
|
||||||
int i, pid, errid;
|
int pid, errid;
|
||||||
#if defined(RKTIO_SYSTEM_UNIX)
|
#if defined(RKTIO_SYSTEM_UNIX)
|
||||||
# if !defined(CENTRALIZED_SIGCHILD)
|
# if !defined(CENTRALIZED_SIGCHILD)
|
||||||
System_Child *sc;
|
System_Child *sc;
|
||||||
# endif
|
# endif
|
||||||
int fork_errno = 0;
|
|
||||||
#else
|
#else
|
||||||
void *sc = 0;
|
void *sc = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1255,9 +1254,12 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
|
||||||
#endif
|
#endif
|
||||||
int new_process_group = (flags & RKTIO_PROCESS_NEW_GROUP);
|
int new_process_group = (flags & RKTIO_PROCESS_NEW_GROUP);
|
||||||
int stderr_is_stdout = (flags & RKTIO_PROCESS_STDOUT_AS_STDERR);
|
int stderr_is_stdout = (flags & RKTIO_PROCESS_STDOUT_AS_STDERR);
|
||||||
|
#if defined(RKTIO_SYSTEM_WINDOWS)
|
||||||
int windows_exact_cmdline = (flags & RKTIO_PROCESS_WINDOWS_EXACT_CMDLINE);
|
int windows_exact_cmdline = (flags & RKTIO_PROCESS_WINDOWS_EXACT_CMDLINE);
|
||||||
int windows_chain_termination_to_child = (flags & RKTIO_PROCESS_WINDOWS_CHAIN_TERMINATION);
|
int windows_chain_termination_to_child = (flags & RKTIO_PROCESS_WINDOWS_CHAIN_TERMINATION);
|
||||||
|
int i;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* avoid compiler warnings: */
|
/* avoid compiler warnings: */
|
||||||
to_subprocess[0] = -1;
|
to_subprocess[0] = -1;
|
||||||
to_subprocess[1] = -1;
|
to_subprocess[1] = -1;
|
||||||
|
|
|
@ -312,7 +312,7 @@ char *rktio_convert_from_wchar(const wchar_t *ws, int free_given)
|
||||||
intptr_t len, l;
|
intptr_t len, l;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
l = wc_slen(ws) + 1; /* add nul terminator */
|
l = wcslen(ws) + 1; /* add nul terminator */
|
||||||
|
|
||||||
len = utf16ish_to_utf8ish((unsigned short *)ws, l, NULL);
|
len = utf16ish_to_utf8ish((unsigned short *)ws, l, NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user