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:
@ -46,6 +46,7 @@
|
||||
|
||||
#elif defined(__DOS__)
|
||||
# include <errno.h>
|
||||
|
||||
#else
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
@ -53,7 +54,11 @@
|
||||
# if defined(HAVE_SYS_TIME_H)
|
||||
# include <sys/time.h>
|
||||
# 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>
|
||||
# define USE_KQUEUE
|
||||
# elif defined(HAVE_SYS_EPOLL_H)
|
||||
@ -61,9 +66,11 @@
|
||||
# if defined(HAVE_EPOLL_CREATE)
|
||||
# define USE_EPOLL
|
||||
# endif
|
||||
/*
|
||||
# elif defined(HAVE_POLL_H)
|
||||
/* TODO */
|
||||
TODO: IMPLEMENT THIS
|
||||
# define USE_POLL
|
||||
*/
|
||||
# else
|
||||
# define USE_SELECT
|
||||
# endif
|
||||
|
@ -604,7 +604,7 @@ qse_size_t qse_nwadtowcs (
|
||||
if (flags & QSE_NWADTOMBS_ADDR)
|
||||
{
|
||||
if (xlen + 1 >= len) goto done;
|
||||
buf[xlen++] = QSE_WT(']');
|
||||
buf[xlen++] = QSE_WT(']');
|
||||
|
||||
if (xlen + 1 >= len) goto done;
|
||||
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_mbsxfmt (buf, QSE_COUNTOF(buf), QSE_MT("/proc/%d/fd"), QSE_GETPID());
|
||||
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 */
|
||||
#endif
|
||||
}
|
||||
|
||||
if (d)
|
||||
|
@ -51,6 +51,14 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(SHUT_RD)
|
||||
# define SHUT_RD 0
|
||||
#endif
|
||||
|
||||
#if !defined(SHUT_WR)
|
||||
# define SHUT_WR 1
|
||||
#endif
|
||||
|
||||
#if !defined(SHUT_RDWR)
|
||||
# define SHUT_RDWR 2
|
||||
#endif
|
||||
|
@ -372,7 +372,15 @@
|
||||
#define QSE_OPENDIR(name) opendir(name)
|
||||
#define QSE_CLOSEDIR(dir) closedir(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
|
||||
|
||||
#if defined(HAVE_READDIR64)
|
||||
|
Reference in New Issue
Block a user