changed configure.ac to detect dirfd() and related stuffs.
changed lib/cmn/syscall.h to use DIRFD related macros produced by configure
This commit is contained in:
parent
45ad42fa36
commit
056cff9192
@ -537,7 +537,7 @@ static int get_server_root (
|
|||||||
root->type = QSE_HTTPD_SERVERSTD_ROOT_PROXY;
|
root->type = QSE_HTTPD_SERVERSTD_ROOT_PROXY;
|
||||||
|
|
||||||
if (loccfg->proxy.pseudonym[0])
|
if (loccfg->proxy.pseudonym[0])
|
||||||
root->u.proxy.pseudonym = loccfg->proxy.pseudonym;
|
root->u.proxy.pseudonym = loccfg->proxy.pseudonym;
|
||||||
|
|
||||||
/* move the host name part backward by 1 byte to make a room for
|
/* move the host name part backward by 1 byte to make a room for
|
||||||
* terminating null. An orginal input of http://www.yahoo.com/ab/cd
|
* terminating null. An orginal input of http://www.yahoo.com/ab/cd
|
||||||
@ -1877,7 +1877,7 @@ static int load_hook_modules (qse_httpd_t* httpd, qse_xli_list_t* hook_list)
|
|||||||
pair = qse_xli_findpair (httpd_xtn->xli, (qse_xli_list_t*)pair->val, QSE_T("file"));
|
pair = qse_xli_findpair (httpd_xtn->xli, (qse_xli_list_t*)pair->val, QSE_T("file"));
|
||||||
if (pair == QSE_NULL)
|
if (pair == QSE_NULL)
|
||||||
{
|
{
|
||||||
/* TODO: log warning when file is not found in module */
|
/* TODO: log warning when file is not found in module */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
23
qse/configure
vendored
23
qse/configure
vendored
@ -17575,7 +17575,7 @@ _ACEOF
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for ac_func in lseek64 stat64 fstat64 lstat64 ftruncate64 readdir64
|
for ac_func in lseek64 stat64 fstat64 lstat64 ftruncate64 readdir64 dirfd
|
||||||
do :
|
do :
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
@ -18780,6 +18780,27 @@ _ACEOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
ac_fn_c_check_member "$LINENO" "DIR" "d_fd" "ac_cv_member_DIR_d_fd" "#include <dirent.h>
|
||||||
|
"
|
||||||
|
if test "x$ac_cv_member_DIR_d_fd" = xyes; then :
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_DIR_D_FD 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
ac_fn_c_check_member "$LINENO" "DIR" "dd_fd" "ac_cv_member_DIR_dd_fd" "#include <dirent.h>
|
||||||
|
"
|
||||||
|
if test "x$ac_cv_member_DIR_dd_fd" = xyes; then :
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_DIR_DD_FD 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtime" "ac_cv_member_struct_stat_st_birthtime" "$ac_includes_default"
|
ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtime" "ac_cv_member_struct_stat_st_birthtime" "$ac_includes_default"
|
||||||
if test "x$ac_cv_member_struct_stat_st_birthtime" = xyes; then :
|
if test "x$ac_cv_member_struct_stat_st_birthtime" = xyes; then :
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ AC_CHECK_FUNCS([mbrlen mbrtowc wcrtomb])
|
|||||||
AC_CHECK_FUNCS([mbsnrtowcs mbsrtowcs wcsnrtombs wcsrtombs])
|
AC_CHECK_FUNCS([mbsnrtowcs mbsrtowcs wcsnrtombs wcsrtombs])
|
||||||
AC_CHECK_FUNCS([wctype iswctype wctrans towctrans])
|
AC_CHECK_FUNCS([wctype iswctype wctrans towctrans])
|
||||||
AC_CHECK_FUNCS([isblank iswblank])
|
AC_CHECK_FUNCS([isblank iswblank])
|
||||||
AC_CHECK_FUNCS([lseek64 stat64 fstat64 lstat64 ftruncate64 readdir64])
|
AC_CHECK_FUNCS([lseek64 stat64 fstat64 lstat64 ftruncate64 readdir64 dirfd])
|
||||||
AC_CHECK_FUNCS([timegm timelocal])
|
AC_CHECK_FUNCS([timegm timelocal])
|
||||||
AC_CHECK_FUNCS([utime utimes])
|
AC_CHECK_FUNCS([utime utimes])
|
||||||
AC_CHECK_FUNCS([sysconf prctl fdopendir setrlimit getrlimit])
|
AC_CHECK_FUNCS([sysconf prctl fdopendir setrlimit getrlimit])
|
||||||
@ -282,6 +282,7 @@ AC_SUBST(UCI_LIBS)
|
|||||||
AM_CONDITIONAL(HAVE_LIBUCI, test "${ac_cv_lib_uci_uci_alloc_context}" = "yes" -a "${ac_cv_header_uci_h}" = "yes")
|
AM_CONDITIONAL(HAVE_LIBUCI, test "${ac_cv_lib_uci_uci_alloc_context}" = "yes" -a "${ac_cv_header_uci_h}" = "yes")
|
||||||
|
|
||||||
AC_STRUCT_DIRENT_D_TYPE
|
AC_STRUCT_DIRENT_D_TYPE
|
||||||
|
AC_CHECK_MEMBERS([DIR.d_fd, DIR.dd_fd],,,[[#include <dirent.h>]])
|
||||||
AC_CHECK_MEMBERS([struct stat.st_birthtime])
|
AC_CHECK_MEMBERS([struct stat.st_birthtime])
|
||||||
AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
|
AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
|
||||||
AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec])
|
AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec])
|
||||||
|
@ -29,7 +29,8 @@ enum qse_nwad_type_t
|
|||||||
{
|
{
|
||||||
QSE_NWAD_NX, /* non-existent */
|
QSE_NWAD_NX, /* non-existent */
|
||||||
QSE_NWAD_IN4,
|
QSE_NWAD_IN4,
|
||||||
QSE_NWAD_IN6
|
QSE_NWAD_IN6,
|
||||||
|
QSE_NWAD_LOCAL
|
||||||
};
|
};
|
||||||
typedef enum qse_nwad_type_t qse_nwad_type_t;
|
typedef enum qse_nwad_type_t qse_nwad_type_t;
|
||||||
|
|
||||||
@ -51,7 +52,13 @@ struct qse_nwad_t
|
|||||||
qse_uint16_t port;
|
qse_uint16_t port;
|
||||||
qse_ip6ad_t addr;
|
qse_ip6ad_t addr;
|
||||||
qse_uint32_t scope;
|
qse_uint32_t scope;
|
||||||
} in6;
|
} in6;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
/* no port number. path is the address */
|
||||||
|
qse_uint8_t path[64];
|
||||||
|
} local;
|
||||||
} u;
|
} u;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -69,6 +76,7 @@ enum qse_nwadtostr_flag_t
|
|||||||
#define QSE_NWADTOMBS_ALL QSE_NWADTOSTR_ALL
|
#define QSE_NWADTOMBS_ALL QSE_NWADTOSTR_ALL
|
||||||
#define QSE_NWADTOWCS_ALL QSE_NWADTOSTR_ALL
|
#define QSE_NWADTOWCS_ALL QSE_NWADTOSTR_ALL
|
||||||
};
|
};
|
||||||
|
typedef enum qse_nwadtostr_flag_t qse_nwadtostr_flag_t;
|
||||||
|
|
||||||
typedef struct qse_skad_t qse_skad_t;
|
typedef struct qse_skad_t qse_skad_t;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include <qse/cmn/tio.h>
|
#include <qse/cmn/tio.h>
|
||||||
#include <qse/cmn/env.h>
|
#include <qse/cmn/env.h>
|
||||||
|
|
||||||
/** @file
|
/** \file
|
||||||
* This file defines a piped interface to a child process. You can execute
|
* This file defines a piped interface to a child process. You can execute
|
||||||
* a child process, read and write to its stdin, stdout, stderr, and terminate
|
* a child process, read and write to its stdin, stdout, stderr, and terminate
|
||||||
* it. It provides more advanced interface than popen() and pclose().
|
* it. It provides more advanced interface than popen() and pclose().
|
||||||
@ -59,8 +59,9 @@ enum qse_pio_flag_t
|
|||||||
* them to prevent inheritance. */
|
* them to prevent inheritance. */
|
||||||
QSE_PIO_NOCLOEXEC = (1 << 5),
|
QSE_PIO_NOCLOEXEC = (1 << 5),
|
||||||
|
|
||||||
/** indidate that the command to qse_pio_open() is a pointer to
|
/** indidate that the command to qse_pio_open()/qse_pio_init() is
|
||||||
* #qse_pio_fnc_t. supported on unix/linux only */
|
* a pointer to a #qse_pio_fnc_t structure. supported on unix/linux
|
||||||
|
* only */
|
||||||
QSE_PIO_FNCCMD = (1 << 6),
|
QSE_PIO_FNCCMD = (1 << 6),
|
||||||
|
|
||||||
/** write to stdin of a child process */
|
/** write to stdin of a child process */
|
||||||
@ -99,11 +100,11 @@ enum qse_pio_flag_t
|
|||||||
QSE_PIO_WAITNORETRY = (1 << 24),
|
QSE_PIO_WAITNORETRY = (1 << 24),
|
||||||
|
|
||||||
/** put stdin to non-blocking mode (only on supported platforms) */
|
/** put stdin to non-blocking mode (only on supported platforms) */
|
||||||
QSE_PIO_INNOBLOCK = (1 << 25),
|
QSE_PIO_INNOBLOCK = (1 << 25),
|
||||||
/** put stdout to non-blocking mode (only on supported platforms)*/
|
/** put stdout to non-blocking mode (only on supported platforms)*/
|
||||||
QSE_PIO_OUTNOBLOCK = (1 << 26),
|
QSE_PIO_OUTNOBLOCK = (1 << 26),
|
||||||
/** put stderr to non-blocking mode (only on supported platforms) */
|
/** put stderr to non-blocking mode (only on supported platforms) */
|
||||||
QSE_PIO_ERRNOBLOCK = (1 << 27)
|
QSE_PIO_ERRNOBLOCK = (1 << 27)
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,6 +121,10 @@ typedef enum qse_pio_hid_t qse_pio_hid_t;
|
|||||||
|
|
||||||
typedef int (*qse_pio_fncptr_t) (void* ctx, qse_env_char_t** envir);
|
typedef int (*qse_pio_fncptr_t) (void* ctx, qse_env_char_t** envir);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_pio_fnc_t type defines a structure to point to the function
|
||||||
|
* executed in a child process when #QSE_PIO_FNCCMD is specified.
|
||||||
|
*/
|
||||||
typedef struct qse_pio_fnc_t qse_pio_fnc_t;
|
typedef struct qse_pio_fnc_t qse_pio_fnc_t;
|
||||||
struct qse_pio_fnc_t
|
struct qse_pio_fnc_t
|
||||||
{
|
{
|
||||||
@ -206,9 +211,9 @@ struct qse_pio_t
|
|||||||
qse_pio_pin_t pin[3];
|
qse_pio_pin_t pin[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
/** access the @a errnum field of the #qse_pio_t structure */
|
/** access the \a errnum field of the #qse_pio_t structure */
|
||||||
#define QSE_PIO_ERRNUM(pio) ((pio)->errnum)
|
#define QSE_PIO_ERRNUM(pio) ((pio)->errnum)
|
||||||
/** access the @a child field of the #qse_pio_t structure */
|
/** access the \a child field of the #qse_pio_t structure */
|
||||||
#define QSE_PIO_CHILD(pio) ((pio)->child)
|
#define QSE_PIO_CHILD(pio) ((pio)->child)
|
||||||
/** get the native handle from the #qse_pio_t structure */
|
/** get the native handle from the #qse_pio_t structure */
|
||||||
#define QSE_PIO_HANDLE(pio,hid) ((pio)->pin[hid].handle)
|
#define QSE_PIO_HANDLE(pio,hid) ((pio)->pin[hid].handle)
|
||||||
@ -218,16 +223,16 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_pio_open() function executes a command @a cmd and establishes
|
* The qse_pio_open() function executes a command \a cmd and establishes
|
||||||
* pipes to it. #QSE_PIO_SHELL causes the function to execute @a cmd via
|
* pipes to it. #QSE_PIO_SHELL causes the function to execute \a cmd via
|
||||||
* the default shell of an underlying system: /bin/sh on *nix, cmd.exe on win32.
|
* the default shell of an underlying system: /bin/sh on *nix, cmd.exe on win32.
|
||||||
* On *nix systems, a full path to the command is needed if it is not specified.
|
* On *nix systems, a full path to the command is needed if it is not specified.
|
||||||
* If @a env is #QSE_NULL, the environment of @a cmd inherits that of the
|
* If \a env is #QSE_NULL, the environment of \a cmd inherits that of the
|
||||||
* calling process. If you want to pass an empty environment, you can pass
|
* calling process. If you want to pass an empty environment, you can pass
|
||||||
* an empty @a env object with no items inserted. If #QSE_PIO_MBSCMD is
|
* an empty \a env object with no items inserted. If #QSE_PIO_MBSCMD is
|
||||||
* specified in @a flags, @a cmd is treated as a multi-byte string whose
|
* specified in \a flags, \a cmd is treated as a multi-byte string whose
|
||||||
* character type is #qse_mchar_t.
|
* character type is #qse_mchar_t.
|
||||||
* @return #qse_pio_t object on success, #QSE_NULL on failure
|
* \return #qse_pio_t object on success, #QSE_NULL on failure
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT qse_pio_t* qse_pio_open (
|
QSE_EXPORT qse_pio_t* qse_pio_open (
|
||||||
qse_mmgr_t* mmgr, /**< memory manager */
|
qse_mmgr_t* mmgr, /**< memory manager */
|
||||||
@ -250,7 +255,7 @@ QSE_EXPORT void qse_pio_close (
|
|||||||
* The qse_pio_init() functions performs the same task as the qse_pio_open()
|
* The qse_pio_init() functions performs the same task as the qse_pio_open()
|
||||||
* except that you need to allocate a #qse_pio_t structure and pass it to the
|
* except that you need to allocate a #qse_pio_t structure and pass it to the
|
||||||
* function.
|
* function.
|
||||||
* @return 0 on success, -1 on failure
|
* \return 0 on success, -1 on failure
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT int qse_pio_init (
|
QSE_EXPORT int qse_pio_init (
|
||||||
qse_pio_t* pio, /**< pio object */
|
qse_pio_t* pio, /**< pio object */
|
||||||
@ -263,7 +268,7 @@ QSE_EXPORT int qse_pio_init (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_pio_fini() function performs the same task as qse_pio_close()
|
* The qse_pio_fini() function performs the same task as qse_pio_close()
|
||||||
* except that it does not destroy a #qse_pio_t structure pointed to by @a pio.
|
* except that it does not destroy a #qse_pio_t structure pointed to by \a pio.
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT void qse_pio_fini (
|
QSE_EXPORT void qse_pio_fini (
|
||||||
qse_pio_t* pio /**< pio object */
|
qse_pio_t* pio /**< pio object */
|
||||||
@ -280,7 +285,7 @@ QSE_EXPORT void* qse_pio_getxtn (
|
|||||||
/**
|
/**
|
||||||
* The qse_pio_geterrnum() function returns the number of the last error
|
* The qse_pio_geterrnum() function returns the number of the last error
|
||||||
* occurred.
|
* occurred.
|
||||||
* @return error number
|
* \return error number
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT qse_pio_errnum_t qse_pio_geterrnum (
|
QSE_EXPORT qse_pio_errnum_t qse_pio_geterrnum (
|
||||||
const qse_pio_t* pio /**< pio object */
|
const qse_pio_t* pio /**< pio object */
|
||||||
@ -288,7 +293,7 @@ QSE_EXPORT qse_pio_errnum_t qse_pio_geterrnum (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_pio_getcmgr() function returns the current character manager.
|
* The qse_pio_getcmgr() function returns the current character manager.
|
||||||
* It returns #QSE_NULL is @a pio is not opened with #QSE_PIO_TEXT.
|
* It returns #QSE_NULL is \a pio is not opened with #QSE_PIO_TEXT.
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT qse_cmgr_t* qse_pio_getcmgr (
|
QSE_EXPORT qse_cmgr_t* qse_pio_getcmgr (
|
||||||
qse_pio_t* pio,
|
qse_pio_t* pio,
|
||||||
@ -296,8 +301,8 @@ QSE_EXPORT qse_cmgr_t* qse_pio_getcmgr (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_pio_setcmgr() function changes the character manager to @a cmgr.
|
* The qse_pio_setcmgr() function changes the character manager to \a cmgr.
|
||||||
* The character manager is used only if @a pio is opened with #QSE_PIO_TEXT.
|
* The character manager is used only if \a pio is opened with #QSE_PIO_TEXT.
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT void qse_pio_setcmgr (
|
QSE_EXPORT void qse_pio_setcmgr (
|
||||||
qse_pio_t* pio,
|
qse_pio_t* pio,
|
||||||
@ -307,7 +312,7 @@ QSE_EXPORT void qse_pio_setcmgr (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_pio_gethandle() function gets a pipe handle.
|
* The qse_pio_gethandle() function gets a pipe handle.
|
||||||
* @return pipe handle
|
* \return pipe handle
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT qse_pio_hnd_t qse_pio_gethandle (
|
QSE_EXPORT qse_pio_hnd_t qse_pio_gethandle (
|
||||||
const qse_pio_t* pio, /**< pio object */
|
const qse_pio_t* pio, /**< pio object */
|
||||||
@ -316,16 +321,16 @@ QSE_EXPORT qse_pio_hnd_t qse_pio_gethandle (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_pio_getchild() function gets a process handle.
|
* The qse_pio_getchild() function gets a process handle.
|
||||||
* @return process handle
|
* \return process handle
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT qse_pio_pid_t qse_pio_getchild (
|
QSE_EXPORT qse_pio_pid_t qse_pio_getchild (
|
||||||
const qse_pio_t* pio /**< pio object */
|
const qse_pio_t* pio /**< pio object */
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_pio_read() fucntion reads at most @a size bytes/characters
|
* The qse_pio_read() fucntion reads at most \a size bytes/characters
|
||||||
* and stores them to the buffer pointed to by @a buf.
|
* and stores them to the buffer pointed to by \a buf.
|
||||||
* @return -1 on failure, 0 on EOF, data length read on success
|
* \return -1 on failure, 0 on EOF, data length read on success
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT qse_ssize_t qse_pio_read (
|
QSE_EXPORT qse_ssize_t qse_pio_read (
|
||||||
qse_pio_t* pio, /**< pio object */
|
qse_pio_t* pio, /**< pio object */
|
||||||
@ -335,11 +340,14 @@ QSE_EXPORT qse_ssize_t qse_pio_read (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_pio_write() function writes up @a size bytes/characters
|
* The qse_pio_write() function writes up \a size bytes/characters
|
||||||
* from the buffer pointed to by @a data. If #QSE_PIO_TEXT is used
|
* from the buffer pointed to by \a data. If #QSE_PIO_TEXT is used
|
||||||
* and the @a size parameter is (qse_size_t)-1, the function treats
|
* and the \a size parameter is (qse_size_t)-1, the function treats
|
||||||
* the @a data parameter as a pointer to a null-terminated string.
|
* the \a data parameter as a pointer to a null-terminated string.
|
||||||
* @return -1 on failure, data length written on success
|
* (qse_size_t)-1 into \a size is not treated specially if #QSE_PIO_TEXT
|
||||||
|
* is not set.
|
||||||
|
*
|
||||||
|
* \return -1 on failure, data length written on success
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT qse_ssize_t qse_pio_write (
|
QSE_EXPORT qse_ssize_t qse_pio_write (
|
||||||
qse_pio_t* pio, /**< pio object */
|
qse_pio_t* pio, /**< pio object */
|
||||||
@ -377,12 +385,12 @@ QSE_EXPORT void qse_pio_end (
|
|||||||
/**
|
/**
|
||||||
* The qse_pio_wait() function waits for a child process to terminate.
|
* The qse_pio_wait() function waits for a child process to terminate.
|
||||||
* #QSE_PIO_WAIT_NORETRY causes the function to return an error and set the
|
* #QSE_PIO_WAIT_NORETRY causes the function to return an error and set the
|
||||||
* @a pio->errnum field to #QSE_PIO_EINTR if the underlying system call has
|
* \a pio->errnum field to #QSE_PIO_EINTR if the underlying system call has
|
||||||
* been interrupted. If #QSE_PIO_WAIT_NOBLOCK is used, the return value of 256
|
* been interrupted. If #QSE_PIO_WAIT_NOBLOCK is used, the return value of 256
|
||||||
* indicates that the child process has not terminated. Otherwise, 256 is never
|
* indicates that the child process has not terminated. Otherwise, 256 is never
|
||||||
* returned.
|
* returned.
|
||||||
*
|
*
|
||||||
* @return
|
* \return
|
||||||
* -1 on error, 256 if the child is alive and #QSE_PIO_WAIT_NOBLOCK is used,
|
* -1 on error, 256 if the child is alive and #QSE_PIO_WAIT_NOBLOCK is used,
|
||||||
* a number between 0 and 255 inclusive if the child process ends normally,
|
* a number between 0 and 255 inclusive if the child process ends normally,
|
||||||
* 256 + signal number if the child process is terminated by a signal.
|
* 256 + signal number if the child process is terminated by a signal.
|
||||||
@ -396,7 +404,7 @@ QSE_EXPORT int qse_pio_wait (
|
|||||||
* You should know the danger of calling this function as the function can
|
* You should know the danger of calling this function as the function can
|
||||||
* kill a process that is not your child process if it has terminated but
|
* kill a process that is not your child process if it has terminated but
|
||||||
* there is a new process with the same process handle.
|
* there is a new process with the same process handle.
|
||||||
* @return 0 on success, -1 on failure
|
* \return 0 on success, -1 on failure
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT int qse_pio_kill (
|
QSE_EXPORT int qse_pio_kill (
|
||||||
qse_pio_t* pio /**< pio object */
|
qse_pio_t* pio /**< pio object */
|
||||||
|
@ -137,6 +137,15 @@
|
|||||||
*/
|
*/
|
||||||
#undef HAVE_DIRENT_H
|
#undef HAVE_DIRENT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `dirfd' function. */
|
||||||
|
#undef HAVE_DIRFD
|
||||||
|
|
||||||
|
/* Define to 1 if `dd_fd' is a member of `DIR'. */
|
||||||
|
#undef HAVE_DIR_DD_FD
|
||||||
|
|
||||||
|
/* Define to 1 if `d_fd' is a member of `DIR'. */
|
||||||
|
#undef HAVE_DIR_D_FD
|
||||||
|
|
||||||
/* Define if you have the GNU dld library. */
|
/* Define if you have the GNU dld library. */
|
||||||
#undef HAVE_DLD
|
#undef HAVE_DLD
|
||||||
|
|
||||||
|
@ -683,7 +683,9 @@ struct qse_httpd_urs_t
|
|||||||
QSE_HTTPD_MATE_HDR;
|
QSE_HTTPD_MATE_HDR;
|
||||||
|
|
||||||
/* == PUBLIC == */
|
/* == PUBLIC == */
|
||||||
qse_httpd_hnd_t handle[5];
|
|
||||||
|
/* urs.open() can set the followings */
|
||||||
|
qse_httpd_hnd_t handle[5];
|
||||||
int handle_count;
|
int handle_count;
|
||||||
unsigned long handle_mask;
|
unsigned long handle_mask;
|
||||||
void* ctx;
|
void* ctx;
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
|
|
||||||
#elif defined(__DOS__)
|
#elif defined(__DOS__)
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
@ -53,7 +54,11 @@
|
|||||||
# if defined(HAVE_SYS_TIME_H)
|
# if defined(HAVE_SYS_TIME_H)
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# endif
|
# endif
|
||||||
# if defined(HAVE_SYS_EVENT_H) && defined(HAVE_KQUEUE) && defined(HAVE_KEVENT)
|
|
||||||
|
# if defined(QSE_MUX_USE_SELECT)
|
||||||
|
/* you can set QSE_MUX_USE_SELECT to force using select() */
|
||||||
|
# define USE_SELECT
|
||||||
|
# elif defined(HAVE_SYS_EVENT_H) && defined(HAVE_KQUEUE) && defined(HAVE_KEVENT)
|
||||||
# include <sys/event.h>
|
# include <sys/event.h>
|
||||||
# define USE_KQUEUE
|
# define USE_KQUEUE
|
||||||
# elif defined(HAVE_SYS_EPOLL_H)
|
# elif defined(HAVE_SYS_EPOLL_H)
|
||||||
@ -61,9 +66,11 @@
|
|||||||
# if defined(HAVE_EPOLL_CREATE)
|
# if defined(HAVE_EPOLL_CREATE)
|
||||||
# define USE_EPOLL
|
# define USE_EPOLL
|
||||||
# endif
|
# endif
|
||||||
|
/*
|
||||||
# elif defined(HAVE_POLL_H)
|
# elif defined(HAVE_POLL_H)
|
||||||
/* TODO */
|
TODO: IMPLEMENT THIS
|
||||||
# define USE_POLL
|
# define USE_POLL
|
||||||
|
*/
|
||||||
# else
|
# else
|
||||||
# define USE_SELECT
|
# define USE_SELECT
|
||||||
# endif
|
# endif
|
||||||
|
@ -604,7 +604,7 @@ qse_size_t qse_nwadtowcs (
|
|||||||
if (flags & QSE_NWADTOMBS_ADDR)
|
if (flags & QSE_NWADTOMBS_ADDR)
|
||||||
{
|
{
|
||||||
if (xlen + 1 >= len) goto done;
|
if (xlen + 1 >= len) goto done;
|
||||||
buf[xlen++] = QSE_WT(']');
|
buf[xlen++] = QSE_WT(']');
|
||||||
|
|
||||||
if (xlen + 1 >= len) goto done;
|
if (xlen + 1 >= len) goto done;
|
||||||
buf[xlen++] = QSE_WT(':');
|
buf[xlen++] = QSE_WT(':');
|
||||||
|
@ -376,7 +376,13 @@ static int close_unneeded_fds_using_proc (int* excepts, qse_size_t count)
|
|||||||
qse_mchar_t buf[64];
|
qse_mchar_t buf[64];
|
||||||
qse_mbsxfmt (buf, QSE_COUNTOF(buf), QSE_MT("/proc/%d/fd"), QSE_GETPID());
|
qse_mbsxfmt (buf, QSE_COUNTOF(buf), QSE_MT("/proc/%d/fd"), QSE_GETPID());
|
||||||
d = QSE_OPENDIR (buf);
|
d = QSE_OPENDIR (buf);
|
||||||
|
#if !defined(_SCO_DS)
|
||||||
|
/* on SCO OpenServer, a range of file descriptors starting from 0 are
|
||||||
|
* listed under /dev/fd regardless of opening state. And some high
|
||||||
|
* numbered descriptors are not listed all. not reliable */
|
||||||
|
|
||||||
if (!d) d = QSE_OPENDIR (QSE_MT("/dev/fd")); /* Darwin, FreeBSD */
|
if (!d) d = QSE_OPENDIR (QSE_MT("/dev/fd")); /* Darwin, FreeBSD */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d)
|
if (d)
|
||||||
|
@ -51,6 +51,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(SHUT_RD)
|
||||||
|
# define SHUT_RD 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(SHUT_WR)
|
||||||
|
# define SHUT_WR 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(SHUT_RDWR)
|
#if !defined(SHUT_RDWR)
|
||||||
# define SHUT_RDWR 2
|
# define SHUT_RDWR 2
|
||||||
#endif
|
#endif
|
||||||
|
@ -372,7 +372,15 @@
|
|||||||
#define QSE_OPENDIR(name) opendir(name)
|
#define QSE_OPENDIR(name) opendir(name)
|
||||||
#define QSE_CLOSEDIR(dir) closedir(dir)
|
#define QSE_CLOSEDIR(dir) closedir(dir)
|
||||||
#define QSE_REWINDDIR(dir) rewinddir(dir)
|
#define QSE_REWINDDIR(dir) rewinddir(dir)
|
||||||
#define QSE_DIRFD(dir) dirfd(dir)
|
#if defined(HAVE_DIRFD)
|
||||||
|
# define QSE_DIRFD(dir) dirfd(dir)
|
||||||
|
#elif defined(HAVE_DIR_DD_FD)
|
||||||
|
# define QSE_DIRFD(dir) ((dir)->dd_fd)
|
||||||
|
#elif defined(HAVE_DIR_D_FD)
|
||||||
|
# define QSE_DIRFD(dir) ((dir)->d_fd)
|
||||||
|
#else
|
||||||
|
# error OUCH!!! NO DIRFD AVAILABLE
|
||||||
|
#endif
|
||||||
#define QSE_DIR DIR
|
#define QSE_DIR DIR
|
||||||
|
|
||||||
#if defined(HAVE_READDIR64)
|
#if defined(HAVE_READDIR64)
|
||||||
|
@ -184,7 +184,7 @@ struct dns_ans_t
|
|||||||
* this condition is required for reusing the dns_req_t chunk
|
* this condition is required for reusing the dns_req_t chunk
|
||||||
* when caching an answer without allocating another chunk. */
|
* when caching an answer without allocating another chunk. */
|
||||||
qse_nwad_t nwad;
|
qse_nwad_t nwad;
|
||||||
qse_int64_t age;
|
qse_long_t age;
|
||||||
qse_uint32_t ttl;
|
qse_uint32_t ttl;
|
||||||
dns_ans_t* next;
|
dns_ans_t* next;
|
||||||
};
|
};
|
||||||
@ -539,7 +539,7 @@ static int dns_recv (qse_httpd_t* httpd, qse_httpd_dns_t* dns, qse_httpd_hnd_t h
|
|||||||
httpd_xtn_t* httpd_xtn;
|
httpd_xtn_t* httpd_xtn;
|
||||||
|
|
||||||
qse_skad_t fromaddr;
|
qse_skad_t fromaddr;
|
||||||
socklen_t fromlen;
|
qse_sck_len_t fromlen;
|
||||||
|
|
||||||
qse_uint8_t buf[DNS_MAX_MSG_LEN];
|
qse_uint8_t buf[DNS_MAX_MSG_LEN];
|
||||||
qse_ssize_t len;
|
qse_ssize_t len;
|
||||||
|
@ -95,12 +95,13 @@ static int urs_open (qse_httpd_t* httpd, qse_httpd_urs_t* urs)
|
|||||||
qse_nwad_t nwad;
|
qse_nwad_t nwad;
|
||||||
urs_ctx_t* dc;
|
urs_ctx_t* dc;
|
||||||
httpd_xtn_t* httpd_xtn;
|
httpd_xtn_t* httpd_xtn;
|
||||||
int type, proto = IPPROTO_UDP; //IPPROTO_SCTP;
|
int type, proto = IPPROTO_UDP; /*IPPROTO_SCTP*/
|
||||||
|
|
||||||
httpd_xtn = qse_httpd_getxtn (httpd);
|
httpd_xtn = qse_httpd_getxtn (httpd);
|
||||||
|
|
||||||
urs->handle[0] = QSE_INVALID_SCKHND;
|
urs->handle[0] = QSE_INVALID_SCKHND;
|
||||||
urs->handle[1] = QSE_INVALID_SCKHND;
|
urs->handle[1] = QSE_INVALID_SCKHND;
|
||||||
|
urs->handle[2] = QSE_INVALID_SCKHND;
|
||||||
|
|
||||||
dc = (urs_ctx_t*) qse_httpd_callocmem (httpd, QSE_SIZEOF(urs_ctx_t));
|
dc = (urs_ctx_t*) qse_httpd_callocmem (httpd, QSE_SIZEOF(urs_ctx_t));
|
||||||
if (dc == NULL) goto oops;
|
if (dc == NULL) goto oops;
|
||||||
@ -132,6 +133,7 @@ static int urs_open (qse_httpd_t* httpd, qse_httpd_urs_t* urs)
|
|||||||
#if defined(AF_INET6)
|
#if defined(AF_INET6)
|
||||||
urs->handle[1] = open_udp_socket (httpd, AF_INET6, type, proto);
|
urs->handle[1] = open_udp_socket (httpd, AF_INET6, type, proto);
|
||||||
#endif
|
#endif
|
||||||
|
/*urs->handle[2] = open_unix_socket (httpd, AF_UNIX, SOCK_DGRAM);*/
|
||||||
|
|
||||||
if (!qse_isvalidsckhnd(urs->handle[0]) && !qse_isvalidsckhnd(urs->handle[1]))
|
if (!qse_isvalidsckhnd(urs->handle[0]) && !qse_isvalidsckhnd(urs->handle[1]))
|
||||||
{
|
{
|
||||||
@ -160,12 +162,14 @@ static int urs_open (qse_httpd_t* httpd, qse_httpd_urs_t* urs)
|
|||||||
/* TODO: error ahndleing */
|
/* TODO: error ahndleing */
|
||||||
if (qse_isvalidsckhnd(urs->handle[0])) listen (urs->handle[0], 99);
|
if (qse_isvalidsckhnd(urs->handle[0])) listen (urs->handle[0], 99);
|
||||||
if (qse_isvalidsckhnd(urs->handle[1])) listen (urs->handle[1], 99);
|
if (qse_isvalidsckhnd(urs->handle[1])) listen (urs->handle[1], 99);
|
||||||
|
/* handle[2] is a unix socket. no special handling for SCTP */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
urs->handle_count = 2;
|
urs->handle_count = 3;
|
||||||
if (qse_isvalidsckhnd(urs->handle[0])) urs->handle_mask |= (1 << 0);
|
if (qse_isvalidsckhnd(urs->handle[0])) urs->handle_mask |= (1 << 0);
|
||||||
if (qse_isvalidsckhnd(urs->handle[1])) urs->handle_mask |= (1 << 1);
|
if (qse_isvalidsckhnd(urs->handle[1])) urs->handle_mask |= (1 << 1);
|
||||||
|
if (qse_isvalidsckhnd(urs->handle[2])) urs->handle_mask |= (1 << 2);
|
||||||
|
|
||||||
urs->ctx = dc;
|
urs->ctx = dc;
|
||||||
return 0;
|
return 0;
|
||||||
@ -173,6 +177,7 @@ static int urs_open (qse_httpd_t* httpd, qse_httpd_urs_t* urs)
|
|||||||
oops:
|
oops:
|
||||||
if (qse_isvalidsckhnd(urs->handle[0])) qse_closesckhnd (urs->handle[0]);
|
if (qse_isvalidsckhnd(urs->handle[0])) qse_closesckhnd (urs->handle[0]);
|
||||||
if (qse_isvalidsckhnd(urs->handle[1])) qse_closesckhnd (urs->handle[1]);
|
if (qse_isvalidsckhnd(urs->handle[1])) qse_closesckhnd (urs->handle[1]);
|
||||||
|
if (qse_isvalidsckhnd(urs->handle[2])) qse_closesckhnd (urs->handle[2]);
|
||||||
if (dc) qse_httpd_freemem (httpd, dc);
|
if (dc) qse_httpd_freemem (httpd, dc);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -210,6 +215,7 @@ static void urs_close (qse_httpd_t* httpd, qse_httpd_urs_t* urs)
|
|||||||
|
|
||||||
if (qse_isvalidsckhnd(urs->handle[0])) qse_closesckhnd (urs->handle[0]);
|
if (qse_isvalidsckhnd(urs->handle[0])) qse_closesckhnd (urs->handle[0]);
|
||||||
if (qse_isvalidsckhnd(urs->handle[1])) qse_closesckhnd (urs->handle[1]);
|
if (qse_isvalidsckhnd(urs->handle[1])) qse_closesckhnd (urs->handle[1]);
|
||||||
|
if (qse_isvalidsckhnd(urs->handle[2])) qse_closesckhnd (urs->handle[2]);
|
||||||
qse_httpd_freemem (httpd, urs->ctx);
|
qse_httpd_freemem (httpd, urs->ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +226,7 @@ static int urs_recv (qse_httpd_t* httpd, qse_httpd_urs_t* urs, qse_httpd_hnd_t h
|
|||||||
httpd_xtn_t* httpd_xtn;
|
httpd_xtn_t* httpd_xtn;
|
||||||
|
|
||||||
qse_skad_t fromaddr;
|
qse_skad_t fromaddr;
|
||||||
socklen_t fromlen;
|
qse_sck_len_t fromlen;
|
||||||
|
|
||||||
qse_uint16_t xid;
|
qse_uint16_t xid;
|
||||||
qse_ssize_t len, url_len;
|
qse_ssize_t len, url_len;
|
||||||
@ -358,7 +364,6 @@ static int urs_send (qse_httpd_t* httpd, qse_httpd_urs_t* urs, const qse_mchar_t
|
|||||||
urs_req_t* req = QSE_NULL;
|
urs_req_t* req = QSE_NULL;
|
||||||
qse_size_t url_len;
|
qse_size_t url_len;
|
||||||
qse_tmr_event_t tmout_event;
|
qse_tmr_event_t tmout_event;
|
||||||
|
|
||||||
|
|
||||||
printf ("... URS_SEND.....................\n");
|
printf ("... URS_SEND.....................\n");
|
||||||
httpd_xtn = qse_httpd_getxtn (httpd);
|
httpd_xtn = qse_httpd_getxtn (httpd);
|
||||||
|
@ -2154,8 +2154,8 @@ if (qse_htre_getcontentlen(req) > 0)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mth == QSE_HTTP_POST &&
|
if (mth == QSE_HTTP_POST &&
|
||||||
!(req->flags & QSE_HTRE_ATTR_LENGTH) &&
|
!(req->flags & QSE_HTRE_ATTR_LENGTH) &&
|
||||||
!(req->flags & QSE_HTRE_ATTR_CHUNKED))
|
!(req->flags & QSE_HTRE_ATTR_CHUNKED))
|
||||||
{
|
{
|
||||||
/* POST without Content-Length nor not chunked */
|
/* POST without Content-Length nor not chunked */
|
||||||
req->flags &= ~QSE_HTRE_ATTR_KEEPALIVE;
|
req->flags &= ~QSE_HTRE_ATTR_KEEPALIVE;
|
||||||
@ -2181,8 +2181,8 @@ if (qse_htre_getcontentlen(req) > 0)
|
|||||||
{
|
{
|
||||||
task = QSE_NULL;
|
task = QSE_NULL;
|
||||||
|
|
||||||
if ((rsrc.flags & QSE_HTTPD_RSRC_100_CONTINUE) &&
|
if ((rsrc.flags & QSE_HTTPD_RSRC_100_CONTINUE) &&
|
||||||
(task = qse_httpd_entaskcontinue (httpd, client, task, req)) == QSE_NULL)
|
(task = qse_httpd_entaskcontinue (httpd, client, task, req)) == QSE_NULL)
|
||||||
{
|
{
|
||||||
/* inject '100 continue' first if it is needed */
|
/* inject '100 continue' first if it is needed */
|
||||||
goto oops;
|
goto oops;
|
||||||
|
Loading…
Reference in New Issue
Block a user