adding code into pio.c for win32
This commit is contained in:
parent
769e4ec9b1
commit
334b52900d
255
qse/configure
vendored
255
qse/configure
vendored
@ -17066,10 +17066,161 @@ fi
|
||||
|
||||
|
||||
|
||||
for ac_header in stddef.h wchar.h wctype.h errno.h signal.h
|
||||
do
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
$as_echo_n "checking for $ac_header... " >&6; }
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
fi
|
||||
ac_res=`eval 'as_val=${'$as_ac_Header'}
|
||||
$as_echo "$as_val"'`
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
else
|
||||
# Is the header compilable?
|
||||
{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
|
||||
$as_echo_n "checking $ac_header usability... " >&6; }
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_header_compiler=yes
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_compiler=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
|
||||
$as_echo "$ac_header_compiler" >&6; }
|
||||
|
||||
# Is the header present?
|
||||
{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
|
||||
$as_echo_n "checking $ac_header presence... " >&6; }
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
if { (ac_try="$ac_cpp conftest.$ac_ext"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } >/dev/null && {
|
||||
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
}; then
|
||||
ac_header_preproc=yes
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_preproc=no
|
||||
fi
|
||||
|
||||
rm -f conftest.err conftest.$ac_ext
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
|
||||
$as_echo "$ac_header_preproc" >&6; }
|
||||
|
||||
# So? What about this header?
|
||||
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
|
||||
yes:no: )
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
|
||||
ac_header_preproc=yes
|
||||
;;
|
||||
no:yes:* )
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
|
||||
( cat <<\_ASBOX
|
||||
## ------------------------------ ##
|
||||
## Report this to bacon@abiyo.net ##
|
||||
## ------------------------------ ##
|
||||
_ASBOX
|
||||
) | sed "s/^/$as_me: WARNING: /" >&2
|
||||
;;
|
||||
esac
|
||||
{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
$as_echo_n "checking for $ac_header... " >&6; }
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
eval "$as_ac_Header=\$ac_header_preproc"
|
||||
fi
|
||||
ac_res=`eval 'as_val=${'$as_ac_Header'}
|
||||
$as_echo "$as_val"'`
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
|
||||
fi
|
||||
as_val=`eval 'as_val=${'$as_ac_Header'}
|
||||
$as_echo "$as_val"'`
|
||||
if test "x$as_val" = x""yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
|
||||
for ac_header in stddef.h wchar.h wctype.h errno.h signal.h time.h sys/time.h sys/syscall.h
|
||||
|
||||
|
||||
for ac_header in time.h sys/time.h utime.h sys/syscall.h
|
||||
do
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
@ -17840,6 +17991,108 @@ fi
|
||||
done
|
||||
|
||||
|
||||
|
||||
for ac_func in utime utimes
|
||||
do
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
$as_echo_n "checking for $ac_func... " >&6; }
|
||||
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
|
||||
For example, HP-UX 11i <limits.h> declares gettimeofday. */
|
||||
#define $ac_func innocuous_$ac_func
|
||||
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func (); below.
|
||||
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
<limits.h> exists even on freestanding compilers. */
|
||||
|
||||
#ifdef __STDC__
|
||||
# include <limits.h>
|
||||
#else
|
||||
# include <assert.h>
|
||||
#endif
|
||||
|
||||
#undef $ac_func
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char $ac_func ();
|
||||
/* The GNU C library defines this for functions which it implements
|
||||
to always fail with ENOSYS. Some functions are actually named
|
||||
something starting with __ and the normal name is an alias. */
|
||||
#if defined __stub_$ac_func || defined __stub___$ac_func
|
||||
choke me
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return $ac_func ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_link") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext && {
|
||||
test "$cross_compiling" = yes ||
|
||||
$as_test_x conftest$ac_exeext
|
||||
}; then
|
||||
eval "$as_ac_var=yes"
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
eval "$as_ac_var=no"
|
||||
fi
|
||||
|
||||
rm -rf conftest.dSYM
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
ac_res=`eval 'as_val=${'$as_ac_var'}
|
||||
$as_echo "$as_val"'`
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
as_val=`eval 'as_val=${'$as_ac_var'}
|
||||
$as_echo "$as_val"'`
|
||||
if test "x$as_val" = x""yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
OLDLIBS="$LIBS"
|
||||
LIBS="$LIBM $LIBS"
|
||||
|
||||
|
@ -87,7 +87,8 @@ AC_SUBST(LIBM, $LIBM)
|
||||
|
||||
dnl check header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([stddef.h wchar.h wctype.h errno.h signal.h time.h sys/time.h sys/syscall.h])
|
||||
AC_CHECK_HEADERS([stddef.h wchar.h wctype.h errno.h signal.h])
|
||||
AC_CHECK_HEADERS([time.h sys/time.h utime.h sys/syscall.h])
|
||||
|
||||
dnl check data types
|
||||
AC_CHECK_TYPE([wchar_t],
|
||||
@ -102,6 +103,7 @@ AC_CHECK_FUNCS([mbrlen mbrtowc wcrtomb])
|
||||
AC_CHECK_FUNCS([mbsnrtowcs mbsrtowcs wcsnrtombs wcsrtombs])
|
||||
AC_CHECK_FUNCS([lseek64 stat64 fstat64 ftruncate64])
|
||||
AC_CHECK_FUNCS([timegm timelocal])
|
||||
AC_CHECK_FUNCS([utime utimes])
|
||||
|
||||
OLDLIBS="$LIBS"
|
||||
LIBS="$LIBM $LIBS"
|
||||
|
@ -1,5 +1,8 @@
|
||||
/* include/qse/config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
#undef AC_APPLE_UNIVERSAL_BUILD
|
||||
|
||||
/* Define to 1 if you have the `atan' function. */
|
||||
#undef HAVE_ATAN
|
||||
|
||||
@ -162,6 +165,15 @@
|
||||
/* Define to 1 if you have the `uselocale' function. */
|
||||
#undef HAVE_USELOCALE
|
||||
|
||||
/* Define to 1 if you have the `utime' function. */
|
||||
#undef HAVE_UTIME
|
||||
|
||||
/* Define to 1 if you have the `utimes' function. */
|
||||
#undef HAVE_UTIMES
|
||||
|
||||
/* Define to 1 if you have the <utime.h> header file. */
|
||||
#undef HAVE_UTIME_H
|
||||
|
||||
/* Define to 1 if you have the <wchar.h> header file. */
|
||||
#undef HAVE_WCHAR_H
|
||||
|
||||
@ -330,3 +342,15 @@
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
# undef WORDS_BIGENDIAN
|
||||
# endif
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: sed.h 192 2009-06-07 13:33:07Z hyunghwan.chung $
|
||||
* $Id: sed.h 193 2009-06-08 13:09:01Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
|
||||
@ -361,7 +361,6 @@ qse_size_t qse_sed_getlinnum (
|
||||
|
||||
/**
|
||||
* The qse_sed_setlinnum() function changes the current input line number.
|
||||
* It the address matching and the '=' command.
|
||||
*/
|
||||
void qse_sed_setlinnum (
|
||||
qse_sed_t* sed, /**< a stream editor */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: fio.c 76 2009-02-22 14:18:06Z hyunghwan.chung $
|
||||
* $Id: fio.c 193 2009-06-08 13:09:01Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
|
||||
@ -267,7 +267,7 @@ qse_fio_off_t qse_fio_seek (
|
||||
};
|
||||
LARGE_INTEGER x, y;
|
||||
|
||||
QSE_ASSERT (AES_SIZEOF(offset) <= AES_SIZEOF(x.QuadPart));
|
||||
QSE_ASSERT (QSE_SIZEOF(offset) <= QSE_SIZEOF(x.QuadPart));
|
||||
|
||||
x.QuadPart = offset;
|
||||
if (SetFilePointerEx (fio->handle, x, &y, seek_map[origin]) == FALSE)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: pio.c 168 2009-05-30 01:19:46Z hyunghwan.chung $
|
||||
* $Id: pio.c 193 2009-06-08 13:09:01Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
|
||||
@ -89,12 +89,59 @@ qse_pio_t* qse_pio_init (
|
||||
};
|
||||
int i, minidx = -1, maxidx = -1;
|
||||
|
||||
#ifdef _WIN32
|
||||
SECURITY_ATTRIBUTES secattr;
|
||||
#endif
|
||||
|
||||
QSE_MEMSET (pio, 0, QSE_SIZEOF(*pio));
|
||||
pio->mmgr = mmgr;
|
||||
|
||||
#ifdef _WIN32
|
||||
/* TODO: XXXXXXXXXXXXXXXXX */
|
||||
http://msdn.microsoft.com/en-us/library/ms682499(VS.85).aspx
|
||||
/* http://msdn.microsoft.com/en-us/library/ms682499(VS.85).aspx */
|
||||
|
||||
secattr.nLength = QSE_SIZEOF(secattr);
|
||||
secattr.bInheritHandle = TRUE;
|
||||
secattr.lpSecurityDescriptor = NULL;
|
||||
|
||||
if (flags & QSE_PIO_WRITEIN)
|
||||
{
|
||||
if (CreatePipe (
|
||||
&handle[0], &handle[1],
|
||||
&secattr, 0) == FALSE) goto oops;
|
||||
|
||||
if (SetHandleInformation (
|
||||
handle[0], HANDLE_FLAG_INHERIT, 0) == FALSE) goto oops;
|
||||
|
||||
minidx = 0; maxidx = 1;
|
||||
}
|
||||
|
||||
if (flags & QSE_PIO_READOUT)
|
||||
{
|
||||
if (CreatePipe (
|
||||
&handle[2], &handle[3],
|
||||
&secattr, 0) == FALSE) goto oops;
|
||||
|
||||
if (SetHandleInformation (
|
||||
handle[3], HANDLE_FLAG_INHERIT, 0) == FALSE) goto oops;
|
||||
|
||||
if (minidx == -1) minidx = 2;
|
||||
maxidx = 3;
|
||||
}
|
||||
|
||||
if (flags & QSE_PIO_READERR)
|
||||
{
|
||||
if (CreatePipe (
|
||||
&handle[4], &handle[5],
|
||||
&secattr, 0) == FALSE) goto oops;
|
||||
|
||||
if (SetHandleInformation (
|
||||
handle[5], HANDLE_FLAG_INHERIT, 0) == FALSE) goto oops;
|
||||
|
||||
if (minidx == -1) minidx = 4;
|
||||
maxidx = 5;
|
||||
}
|
||||
|
||||
/* TODO: .... */
|
||||
#else
|
||||
|
||||
if (flags & QSE_PIO_WRITEIN)
|
||||
@ -383,7 +430,11 @@ http://msdn.microsoft.com/en-us/library/ms682499(VS.85).aspx
|
||||
|
||||
oops:
|
||||
for (i = 0; i < QSE_COUNTOF(tio); i++) qse_tio_close (tio[i]);
|
||||
#if _WIN32
|
||||
for (i = minidx; i < maxidx; i++) CloseHandle (handle[i]);
|
||||
#else
|
||||
for (i = minidx; i < maxidx; i++) QSE_CLOSE (handle[i]);
|
||||
#endif
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
||||
@ -571,7 +622,11 @@ void qse_pio_end (qse_pio_t* pio, qse_pio_hid_t hid)
|
||||
|
||||
if (pio->pin[hid].handle != QSE_PIO_HND_NIL)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
CloseHandle (pio->pin[hid].handle);
|
||||
#else
|
||||
QSE_CLOSE (pio->pin[hid].handle);
|
||||
#endif
|
||||
pio->pin[hid].handle = QSE_PIO_HND_NIL;
|
||||
}
|
||||
}
|
||||
@ -579,7 +634,7 @@ void qse_pio_end (qse_pio_t* pio, qse_pio_hid_t hid)
|
||||
int qse_pio_wait (qse_pio_t* pio)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
DWORD ec;
|
||||
DWORD ecode, w;
|
||||
|
||||
if (pio->child == QSE_PIO_PID_NIL)
|
||||
{
|
||||
@ -588,12 +643,48 @@ int qse_pio_wait (qse_pio_t* pio)
|
||||
return -1;
|
||||
}
|
||||
|
||||
WaitForSingleObject (pio->child, -1);
|
||||
if (GetExitCodeProcess (pio->child, &ec) == FALSE) ....
|
||||
w = WaitForSingleObject (pio->child,
|
||||
((pio->flags & QSE_PIO_WAIT_NOBLOCK)? 0: INFINITE)
|
||||
);
|
||||
if (w == WAIT_TIMEOUT)
|
||||
{
|
||||
/* the child process is still alive */
|
||||
return 255 + 1;
|
||||
}
|
||||
if (w != WAIT_OBJECT_0)
|
||||
{
|
||||
/* WAIT_FAILED, WAIT_ABANDONED */
|
||||
pio->errnum = QSE_PIO_ESUBSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
QSE_ASSERT (w == WAIT_OBJECT_0);
|
||||
|
||||
if (GetExitCodeProcess (pio->child, &ecode) == FALSE)
|
||||
{
|
||||
/* close the handle anyway to prevent further
|
||||
* errors when this function is called again */
|
||||
CloseHandle (pio->child);
|
||||
pio->child = QSE_PIO_PID_NIL;
|
||||
|
||||
pio->errnum = QSE_PIO_ESUBSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* close handle here to emulate waitpid() as much as possible. */
|
||||
CloseHandle (pio->child);
|
||||
pio->child = QSE_PIO_PID_NIL;
|
||||
|
||||
if (ecode == STILL_ACTIVE)
|
||||
{
|
||||
/* this should not happen as the control reaches here
|
||||
* only when WaitforSingleObject() is successful.
|
||||
* if it happends, close the handle and return an error */
|
||||
pio->errnum = QSE_PIO_ESUBSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ecode;
|
||||
#else
|
||||
int opt = 0;
|
||||
int ret = -1;
|
||||
@ -656,7 +747,7 @@ int qse_pio_wait (qse_pio_t* pio)
|
||||
else
|
||||
{
|
||||
/* not interested in WIFSTOPPED & WIFCONTINUED.
|
||||
* in fact, this else block should not be reached
|
||||
* in fact, this else-block should not be reached
|
||||
* as WIFEXITED or WIFSIGNALED must be true.
|
||||
* anyhow, just set the return value to 0. */
|
||||
ret = 0;
|
||||
@ -690,7 +781,7 @@ int qse_pio_kill (qse_pio_t* pio)
|
||||
n = TerminateProcess (pio->child, 255 + 1 + 9);
|
||||
if (n == FALSE)
|
||||
{
|
||||
pio->errnum = QSE_PIO_SYSCALL;
|
||||
pio->errnum = QSE_PIO_ESUBSYS;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: syscall.h 187 2009-06-07 05:03:44Z hyunghwan.chung $
|
||||
* $Id: syscall.h 193 2009-06-08 13:09:01Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
|
||||
@ -42,6 +42,9 @@
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
#ifdef HAVE_UTIME_H
|
||||
# include <utime.h>
|
||||
#endif
|
||||
|
||||
#if defined(QSE_USE_SYSCALL) && defined(HAVE_SYS_SYSCALL_H)
|
||||
# include <sys/syscall.h>
|
||||
@ -196,16 +199,28 @@
|
||||
#endif
|
||||
|
||||
#ifdef SYS_gettimeofday
|
||||
# define QSE_GETTIMEOFDAY(tv,tz) syscall(SYS_gettimeofday, tv, tz)
|
||||
# define QSE_GETTIMEOFDAY(tv,tz) syscall(SYS_gettimeofday,tv,tz)
|
||||
#else
|
||||
# define QSE_GETTIMEOFDAY(tv,tz) gettimeofday(tv,tz)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_settimeofday
|
||||
# define QSE_SETTIMEOFDAY(tv,tz) syscall(SYS_settimeofday, tv, tz)
|
||||
# define QSE_SETTIMEOFDAY(tv,tz) syscall(SYS_settimeofday,tv,tz)
|
||||
#else
|
||||
# define QSE_SETTIMEOFDAY(tv,tz) settimeofday(tv,tz)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_utime
|
||||
# define QSE_UTIME(file,t) syscall(SYS_utime,file,t)
|
||||
#else
|
||||
# define QSE_UTIME(file,t) utime(file,t)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_utimes
|
||||
# define QSE_UTIMES(file,t) syscall(SYS_utimes,file,t)
|
||||
#else
|
||||
# define QSE_UTIMES(file,t) utimes(file,t)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user