Added sigsetjmp/siglongjmp and gettid to the portability library.

This commit is contained in:
Alexandre Julliard 2003-11-12 03:16:00 +00:00
parent daeccba704
commit b2d937d5d9
8 changed files with 167 additions and 13 deletions

58
configure vendored
View File

@ -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
@ -13798,6 +13854,7 @@ fi
for ac_func in \
@ -13824,6 +13881,7 @@ for ac_func in \
getprotobynumber \
getpwuid \
getservbyport \
gettid \
gettimeofday \
inet_network \
lseek64 \

View File

@ -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 \

View File

@ -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

View File

@ -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) */

View File

@ -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 \

38
libs/port/gettid.c Normal file
View File

@ -0,0 +1,38 @@
/*
* 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 */

36
libs/port/sigsetjmp.c Normal file
View File

@ -0,0 +1,36 @@
/*
* 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 */

View File

@ -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
*