fixed minor building issues.

renamed sys::getpgrp to sys::getpgid
This commit is contained in:
hyung-hwan 2015-03-19 14:07:50 +00:00
parent e0d36803cc
commit 8d1704c0a4
8 changed files with 75 additions and 20 deletions

20
qse/configure vendored
View File

@ -17628,7 +17628,7 @@ _ACEOF
fi
done
for ac_func in sysconf prctl fdopendir setrlimit getrlimit
for ac_func in sysconf prctl fdopendir setrlimit getrlimit getpgid getpgrp
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@ -19051,6 +19051,24 @@ _ACEOF
fi
ac_fn_c_check_type "$LINENO" "struct timespec" "ac_cv_type_struct_timespec" "#include <sys/types.h>
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
"
if test "x$ac_cv_type_struct_timespec" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_TIMESPEC 1
_ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for va_copy" >&5
$as_echo_n "checking for va_copy... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext

View File

@ -148,7 +148,7 @@ AC_CHECK_FUNCS([lseek64 stat64 fstat64 lstat64 ftruncate64 readdir64 dirfd])
AC_CHECK_FUNCS([lstat fchmod fsync ftruncate])
AC_CHECK_FUNCS([timegm timelocal localtime_r gettimeofday settimeofday])
AC_CHECK_FUNCS([utime utimes futimes lutimes futimens])
AC_CHECK_FUNCS([sysconf prctl fdopendir setrlimit getrlimit])
AC_CHECK_FUNCS([sysconf prctl fdopendir setrlimit getrlimit getpgid getpgrp])
AC_CHECK_FUNCS([backtrace backtrace_symbols])
AC_CHECK_FUNCS([fork vfork posix_spawn gettid nanosleep select])
AC_CHECK_FUNCS([makecontext swapcontext getcontext setcontext])
@ -331,6 +331,15 @@ AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], [], [],
#include <sys/socket.h>
#include <netinet/in.h>])
AC_CHECK_TYPES([struct timespec], [], [],
[#include <sys/types.h>
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif])
AC_MSG_CHECKING([for va_copy])
AC_TRY_LINK(
[#include <stdarg.h>],

View File

@ -263,6 +263,12 @@
/* Define to 1 if you have the `getifaddrs' function. */
#undef HAVE_GETIFADDRS
/* Define to 1 if you have the `getpgid' function. */
#undef HAVE_GETPGID
/* Define to 1 if you have the `getpgrp' function. */
#undef HAVE_GETPGRP
/* Define to 1 if you have the `getrlimit' function. */
#undef HAVE_GETRLIMIT
@ -602,6 +608,9 @@
/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
/* Define to 1 if the system has the type `struct timespec'. */
#undef HAVE_STRUCT_TIMESPEC
/* Define to 1 if you have the `swapcontext' function. */
#undef HAVE_SWAPCONTEXT

View File

@ -41,7 +41,9 @@
# define QSE_INLINE inline
# define QSE_HAVE_INLINE
#elif defined(__GNUC__) && defined(__GNUC_GNU_INLINE__)
# define QSE_INLINE /*extern*/ inline
/* gcc disables inline when -std=c89 or -ansi is used.
* so use __inline__ supported by gcc regardless of the options */
# define QSE_INLINE /*extern*/ __inline__
# define QSE_HAVE_INLINE
#else
# define QSE_INLINE
@ -49,7 +51,7 @@
#endif
#if defined(__GNUC__) && defined(__GNUC_GNU_INLINE__)
# define QSE_INLINE_ALWAYS inline __attribute__((__always_inline__))
# define QSE_INLINE_ALWAYS __inline__ __attribute__((__always_inline__))
# define QSE_HAVE_INLINE_ALWAYS
#elif defined(_MSC_VER) || (defined(__CC_ARM) || defined(__ARMCC__))
# define QSE_INLINE_ALWAYS __forceinline
@ -60,7 +62,7 @@
#endif
#if defined(__GNUC__) && defined(__GNUC_GNU_INLINE__)
# define QSE_INLINE_NEVER inline __attribute__((__noinline__))
# define QSE_INLINE_NEVER __inline__ __attribute__((__noinline__))
# define QSE_HAVE_INLINE_NEVER
#elif (defined(__CC_ARM) || defined(__ARMCC__))
# define QSE_INLINE_NEVER __declspec(noinline)
@ -160,7 +162,9 @@
* that it does not point to anything.
*/
#if defined(__cplusplus)
# if QSE_SIZEOF_VOID_P == QSE_SIZEOF_INT
# if (__cplusplus >= 201103L) /* C++11 */
# define QSE_NULL nullptr
# elif QSE_SIZEOF_VOID_P == QSE_SIZEOF_INT
# define QSE_NULL (0)
# elif QSE_SIZEOF_VOID_P == QSE_SIZEOF_LONG
# define QSE_NULL (0l)

View File

@ -146,7 +146,7 @@ static int fnc_kill (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
return 0;
}
static int fnc_getpgrp (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
static int fnc_getpgid (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
{
qse_awk_int_t pid;
qse_awk_val_t* retv;
@ -164,7 +164,14 @@ static int fnc_getpgrp (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
pid = -1;
#else
/* TODO: support specifing calling process id other than 0 */
#if defined(HAVE_GETPGID)
pid = getpgid (0);
#elif defined(HAVE_GETPGRP)
pid = getpgrp ();
#else
pid = -1;
#endif
#endif
retv = qse_awk_rtx_makeintval (rtx, pid);
@ -679,7 +686,7 @@ static fnctab_t fnctab[] =
{ QSE_T("geteuid"), { { 0, 0, QSE_NULL }, fnc_geteuid, 0 } },
{ QSE_T("getgid"), { { 0, 0, QSE_NULL }, fnc_getgid, 0 } },
{ QSE_T("getnwifcfg"), { { 3, 3, QSE_T("vvr") }, fnc_getnwifcfg, 0 } },
{ QSE_T("getpgrp"), { { 0, 0, QSE_NULL }, fnc_getpgrp, 0 } },
{ QSE_T("getpgid"), { { 0, 0, QSE_NULL }, fnc_getpgid, 0 } },
{ QSE_T("getpid"), { { 0, 0, QSE_NULL }, fnc_getpid, 0 } },
{ QSE_T("getppid"), { { 0, 0, QSE_NULL }, fnc_getppid, 0 } },
{ QSE_T("gettid"), { { 0, 0, QSE_NULL }, fnc_gettid, 0 } },

View File

@ -194,7 +194,7 @@ int qse_fmtfltmaxtombs (qse_mchar_t* buf, qse_size_t bufsize, qse_fltmax_t f, qs
if (len + 1 < bufsize)
{
buf[len++] = point; // add decimal point to string
buf[len++] = point; /* add decimal point to string */
buf[len] = QSE_MT('\0');
}

View File

@ -237,7 +237,7 @@ static int copy_file_in_fs (qse_fs_t* fs, cpfile_t* cpfile)
if (cpfile->flags & QSE_FS_CPFILE_PRESERVE)
{
#if defined(HAVE_FUTIMENS)
#if defined(HAVE_FUTIMENS) && defined(HAVE_STRUCT_TIMESPEC)
struct timespec ts[2];
#elif defined(HAVE_FUTIMES)
struct timeval tv[2];
@ -254,7 +254,7 @@ static int copy_file_in_fs (qse_fs_t* fs, cpfile_t* cpfile)
goto oops;
}
#if defined(HAVE_FUTIMENS)
#if defined(HAVE_FUTIMENS) && defined(HAVE_STRUCT_TIMESPEC)
QSE_MEMSET (&ts, 0, QSE_SIZEOF(ts));
ts[0].tv_sec = cpfile->src_attr.atime.sec;

View File

@ -645,7 +645,7 @@ qse_fs_ent_t* qse_fs_read (qse_fs_t* fs, int flags)
if (flags & QSE_FS_ENT_TYPE)
{
#if defined(HAVE_STRUCT_DIRENT_D_TYPE)
#if defined(HAVE_STRUCT_DIRENT_D_TYPE) && defined(DT_DIR) && defined(DT_REG) /* and more */
switch (ent->d_type)
{
case DT_DIR:
@ -681,6 +681,12 @@ qse_fs_ent_t* qse_fs_read (qse_fs_t* fs, int flags)
}
#else
#if defined(__S_IFMT) && !defined(S_IFMT)
# define S_IFMT __S_IFMT
#endif
#if defined(__S_IFDIR) && !defined(S_IFDIR)
# define S_IFDIR __S_IFDIR
#endif
#define IS_TYPE(st,type) ((st.st_mode & S_IFMT) == S_IFDIR)
fs->ent.type = IS_TYPE(st,S_IFDIR)? QSE_FS_ENT_SUBDIR:
IS_TYPE(st,S_IFREG)? QSE_FS_ENT_REGULAR:
@ -688,7 +694,9 @@ qse_fs_ent_t* qse_fs_read (qse_fs_t* fs, int flags)
IS_TYPE(st,S_IFCHR)? QSE_FS_ENT_CHRDEV:
IS_TYPE(st,S_IFBLK)? QSE_FS_ENT_BLKDEV:
IS_TYPE(st,S_IFIFO)? QSE_FS_ENT_PIPE:
#if defined(S_IFSOCK)
IS_TYPE(st,S_IFSOCK)? QSE_FS_ENT_PIPE:
#endif
QSE_FS_ENT_UNKNOWN;
#undef IS_TYPE
#endif