Commit b2d937d5 authored by Alexandre Julliard's avatar Alexandre Julliard

Added sigsetjmp/siglongjmp and gettid to the portability library.

parent daeccba7
......@@ -9706,6 +9706,62 @@ _ACEOF
fi
echo "$as_me:$LINENO: checking for sigsetjmp" >&5
echo $ECHO_N "checking for sigsetjmp... $ECHO_C" >&6
if test "${ac_cv_c_sigsetjmp+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <setjmp.h>
int
main ()
{
sigjmp_buf buf;
sigsetjmp( buf, 1 );
siglongjmp( buf, 1 );
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_c_sigsetjmp="yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_c_sigsetjmp="no"
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_c_sigsetjmp" >&5
echo "${ECHO_T}$ac_cv_c_sigsetjmp" >&6
if test "$ac_cv_c_sigsetjmp" = "yes"
then
cat >>confdefs.h <<\_ACEOF
#define HAVE_SIGSETJMP 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for pthread_rwlock_t" >&5
echo $ECHO_N "checking for pthread_rwlock_t... $ECHO_C" >&6
if test "${ac_cv_type_pthread_rwlock_t+set}" = set; then
......@@ -13800,6 +13856,7 @@ fi
for ac_func in \
_lwp_create \
_lwp_self \
......@@ -13824,6 +13881,7 @@ for ac_func in \
getprotobynumber \
getpwuid \
getservbyport \
gettid \
gettimeofday \
inet_network \
lseek64 \
......
......@@ -517,6 +517,21 @@ then
AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
fi
dnl **** Check for sigsetjmp ****
AC_CACHE_CHECK([for sigsetjmp], ac_cv_c_sigsetjmp,
AC_TRY_LINK(
[#include <setjmp.h>],
[sigjmp_buf buf;
sigsetjmp( buf, 1 );
siglongjmp( buf, 1 );],
[ac_cv_c_sigsetjmp="yes"],
[ac_cv_c_sigsetjmp="no"])
)
if test "$ac_cv_c_sigsetjmp" = "yes"
then
AC_DEFINE(HAVE_SIGSETJMP, 1, [Define to 1 if you have the sigsetjmp (and siglongjmp) function])
fi
dnl **** Check for pthread_rwlock_t ****
AC_CHECK_TYPES([pthread_rwlock_t, pthread_rwlockattr_t],,,[#define _GNU_SOURCE
#include <pthread.h>])
......@@ -979,6 +994,7 @@ AC_CHECK_FUNCS(\
getprotobynumber \
getpwuid \
getservbyport \
gettid \
gettimeofday \
inet_network \
lseek64 \
......
......@@ -155,6 +155,9 @@
/* Define to 1 if you have the `getservbyport' function. */
#undef HAVE_GETSERVBYPORT
/* Define to 1 if you have the `gettid' function. */
#undef HAVE_GETTID
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
......@@ -467,6 +470,9 @@
/* Define to 1 if `si_fd' is member of `siginfo_t'. */
#undef HAVE_SIGINFO_T_SI_FD
/* Define to 1 if you have the sigsetjmp (and siglongjmp) function */
#undef HAVE_SIGSETJMP
/* Define to 1 if the system has the type `size_t'. */
#undef HAVE_SIZE_T
......
......@@ -216,6 +216,10 @@ extern int getopt_long_only (int ___argc, char *const *___argv,
size_t getpagesize(void);
#endif /* HAVE_GETPAGESIZE */
#ifndef HAVE_GETTID
pid_t gettid(void);
#endif /* HAVE_GETTID */
#ifndef HAVE_LSTAT
int lstat(const char *file_name, struct stat *buf);
#endif /* HAVE_LSTAT */
......@@ -232,6 +236,13 @@ ssize_t pread( int fd, void *buf, size_t count, off_t offset );
ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset );
#endif /* HAVE_PWRITE */
#ifndef HAVE_SIGSETJMP
# include <setjmp.h>
typedef jmp_buf sigjmp_buf;
int sigsetjmp( sigjmp_buf buf, int savesigs );
void siglongjmp( sigjmp_buf buf, int val );
#endif /* HAVE_SIGSETJMP */
#ifndef HAVE_STATFS
int statfs(const char *name, struct statfs *info);
#endif /* !defined(HAVE_STATFS) */
......
......@@ -10,6 +10,7 @@ C_SRCS = \
getopt.c \
getopt1.c \
getpagesize.c \
gettid.c \
interlocked.c \
lstat.c \
memcpy_unaligned.c \
......@@ -17,6 +18,7 @@ C_SRCS = \
mkstemps.c \
pread.c \
pwrite.c \
sigsetjmp.c \
spawn.c \
statfs.c \
strcasecmp.c \
......
/*
* gettid function
*
* Copyright 2003 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#ifndef HAVE_GETTID
pid_t gettid(void)
{
#if defined(__linux__) && defined(__i386__)
pid_t ret;
__asm__("int $0x80" : "=a" (ret) : "0" (224) /* SYS_gettid */);
if (ret < 0) ret = -1;
return ret;
#else
return -1; /* FIXME */
#endif
}
#endif /* HAVE_GETTID */
/*
* sigsetjmp/siglongjmp functions
*
* Copyright 2003 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#ifndef HAVE_SIGSETJMP
int sigsetjmp( sigjmp_buf buf, int savesigs )
{
return setjmp( buf );
}
void siglongjmp( sigjmp_buf buf, int val )
{
longjmp( buf, val );
}
#endif /* HAVE_SIGSETJMP */
......@@ -44,19 +44,6 @@ static struct wine_pthread_functions funcs;
static pthread_key_t teb_key;
#endif
static inline int gettid(void)
{
#if defined(__linux__) && defined(__i386__)
int ret;
__asm__("int $0x80" : "=a" (ret) : "0" (224) /* SYS_gettid */);
if (ret < 0) ret = -1;
return ret;
#else
return -1; /* FIXME */
#endif
}
/***********************************************************************
* wine_pthread_init_process
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment