2002-06-02 Marcus Brinkmann <marcus@g10code.de>

* acinclude.m4: Fix Pth check so that it doesn't error out if pth
	is not found.

gpgme/
2002-06-02  Marcus Brinkmann  <marcus@g10code.de>

	* ath.h: Enable the _gpgme_ prefix.  Fix all those prefix macros.
	* posix-sema.c: Use that prefix here.
	* posix-io.c: Include "ath.h".
	(_gpgme_io_read): Use _gpgme_ath_read instead read.
	(_gpgme_io_write): Use _gpgme_ath_write instead write.
	(_gpgme_io_waitpid): Use _gpgme_ath_waitpid instead waitpid.
	(_gpgme_io_select): Use _gpgme_ath_select instead select.
This commit is contained in:
Marcus Brinkmann 2002-06-02 20:43:04 +00:00
parent ae0d104de2
commit b024a61d89
6 changed files with 3757 additions and 41 deletions

View File

@ -1,3 +1,8 @@
2002-06-02 Marcus Brinkmann <marcus@g10code.de>
* acinclude.m4: Fix Pth check so that it doesn't error out if pth
is not found.
2002-06-02 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Add checks for Pth and pthreads.

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,13 @@
2002-06-02 Marcus Brinkmann <marcus@g10code.de>
* ath.h: Enable the _gpgme_ prefix. Fix all those prefix macros.
* posix-sema.c: Use that prefix here.
* posix-io.c: Include "ath.h".
(_gpgme_io_read): Use _gpgme_ath_read instead read.
(_gpgme_io_write): Use _gpgme_ath_write instead write.
(_gpgme_io_waitpid): Use _gpgme_ath_waitpid instead waitpid.
(_gpgme_io_select): Use _gpgme_ath_select instead select.
2002-06-02 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (ath_components): New variable.

View File

@ -25,29 +25,33 @@
/* Define ATH_EXT_SYM_PREFIX if you want to give all external symbols
a prefix. */
/* #define ATH_EXT_SYM_PREFIX _gpgme_ */
#define ATH_EXT_SYM_PREFIX _gpgme_
#ifdef ATH_EXT_SYM_PREFIX
#define ath_pkg_init MUTEX_EXT_SYM_PREFIX##ath_pkg_init
#define ath_mutex_init MUTEX_EXT_SYM_PREFIX##ath_mutex_init
#define ath_mutex_destroy MUTEX_EXT_SYM_PREFIX##ath_mutex_destroy
#define ath_mutex_lock MUTEX_EXT_SYM_PREFIX##ath_mutex_lock
#define ATH_PREFIX1(x,y) x ## y
#define ATH_PREFIX2(x,y) ATH_PREFIX1(x,y)
#define ATH_PREFIX(x) ATH_PREFIX2(ATH_EXT_SYM_PREFIX,x)
#define ath_init ATH_PREFIX(ath_init)
#define ath_mutex_init ATH_PREFIX(ath_mutex_init)
#define ath_mutex_destroy ATH_PREFIX(ath_mutex_destroy)
#define ath_mutex_lock ATH_PREFIX(ath_mutex_lock)
#define ath_mutex_unlock ATH_PREFIX(ath_mutex_unlock)
#define ath_mutex_pthread_available \
MUTEX_EXT_SYM_PREFIX##ath_mutex_pthread_available
ATH_PREFIX(ath_mutex_pthread_available)
#define ath_mutex_pth_available \
MUTEX_EXT_SYM_PREFIX##ath_mutex_pth_available
ATH_PREFIX(ath_mutex_pth_available)
#define ath_mutex_dummy_available \
MUTEX_EXT_SYM_PREFIX##ath_mutex_dummy_available
#define ath_read MUTEX_EXT_SYM##ath_read
#define ath_write MUTEX_EXT_SYM##ath_write
#define ath_select MUTEX_EXT_SYM##ath_select
#define ath_waitpid MUTEX_EXT_SYM##ath_waitpid
ATH_PREFIX(ath_mutex_dummy_available)
#define ath_read ATH_PREFIX(ath_read)
#define ath_write ATH_PREFIX(ath_write)
#define ath_select ATH_PREFIX(ath_select)
#define ath_waitpid ATH_PREFIX(ath_waitpid)
#define ath_mutex_pthread_available \
MUTEX_EXT_SYM_PREFIX##ath_mutex_pthread_available
ATH_PREFIX(ath_mutex_pthread_available)
#define ath_mutex_pthr_available \
MUTEX_EXT_SYM_PREFIX##ath_mutex_pthr_available
ATH_PREFIX(ath_mutex_pthr_available)
#define ath_mutex_dummy_available \
MUTEX_EXT_SYM_PREFIX##ath_mutex_dummy_available
ATH_PREFIX(ath_mutex_dummy_available)
#endif

View File

@ -37,6 +37,7 @@
#include "util.h"
#include "io.h"
#include "sema.h"
#include "ath.h"
static struct
{
@ -52,7 +53,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count)
DEBUG2 ("fd %d: about to read %d bytes\n", fd, (int) count);
do
{
nread = read (fd, buffer, count);
nread = _gpgme_ath_read (fd, buffer, count);
}
while (nread == -1 && errno == EINTR );
DEBUG2 ("fd %d: got %d bytes\n", fd, nread);
@ -71,7 +72,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count)
_gpgme_debug (2, "fd %d: write `%.*s'\n", fd, (int) count, buffer);
do
{
nwritten = write (fd, buffer, count);
nwritten = _gpgme_ath_write (fd, buffer, count);
}
while (nwritten == -1 && errno == EINTR);
DEBUG2 ("fd %d: wrote %d bytes\n", fd, (int) nwritten);
@ -255,7 +256,7 @@ _gpgme_io_waitpid (int pid, int hang, int *r_status, int *r_signal)
*r_status = 0;
*r_signal = 0;
if (waitpid (pid, &status, hang? 0 : WNOHANG) == pid)
if (_gpgme_ath_waitpid (pid, &status, hang? 0 : WNOHANG) == pid)
{
if (WIFSIGNALED (status))
{
@ -332,7 +333,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds)
do
{
count = select (max_fd + 1, &readfds, &writefds, NULL, &timeout);
count = _gpgme_ath_select (max_fd + 1, &readfds, &writefds, NULL, &timeout);
}
while (count < 0 && errno == EINTR);
if (count < 0)

View File

@ -48,24 +48,24 @@ void
_gpgme_sema_subsystem_init ()
{
/* FIXME: we should check that there is only one thread running */
ath_init ();
_gpgme_ath_init ();
}
void
_gpgme_sema_cs_enter (struct critsect_s *s)
{
ath_mutex_lock (&s->private);
_gpgme_ath_mutex_lock (&s->private);
}
void
_gpgme_sema_cs_leave (struct critsect_s *s)
{
ath_mutex_unlock (&s->private);
_gpgme_ath_mutex_unlock (&s->private);
}
void
_gpgme_sema_cs_destroy (struct critsect_s *s)
{
ath_mutex_destroy (&s->private);
_gpgme_ath_mutex_destroy (&s->private);
s->private = NULL;
}