diff options
author | Werner Koch <wk@gnupg.org> | 2007-06-06 17:01:56 +0000 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2007-06-06 17:01:56 +0000 |
commit | 7a6cf144eea4b7d9bd27e879681f10ad8c20b84f (patch) | |
tree | a8cb361fcfebf2435dfafca90137ad6af8c6a660 /src | |
parent | bce92d459eda6e33512a63bdd97e84f0499e4207 (diff) | |
download | libgcrypt-7a6cf144eea4b7d9bd27e879681f10ad8c20b84f.tar.gz |
Pth fix for W32.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/gcrypt.h.in | 43 |
2 files changed, 38 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 70cd1aa2..af8c2209 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2007-06-06 Werner Koch <wk@g10code.com> + + * gcrypt.h.in (GCRY_THREAD_OPTION_PTH_IMPL): Factror network + related code out so that the prototypes can be adjusted for W32. + (_GCRY_THREAD_OPTION_PTH_IMPL_NET): New. + 2007-05-09 Werner Koch <wk@g10code.com> * libgcrypt.m4: Print found version on success. diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in index f4065274..f5881047 100644 --- a/src/gcrypt.h.in +++ b/src/gcrypt.h.in @@ -210,6 +210,36 @@ struct gcry_thread_cbs #endif }; +#ifdef _WIN32 +# define _GCRY_THREAD_OPTION_PTH_IMPL_NET \ +static ssize_t gcry_pth_select (int nfd, void *rset, void *wset, \ + void *eset, struct timeval *timeout) \ + { return pth_select (nfd, rset, wset, eset, timeout); } \ +static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \ + { return pth_waitpid (pid, status, options); } \ +static int gcry_pth_accept (int s, void *addr, \ + gcry_socklen_t *length_ptr) \ + { return pth_accept (s, addr, length_ptr); } \ +static int gcry_pth_connect (int s, void *addr, \ + gcry_socklen_t length) \ + { return pth_connect (s, addr, length); } +#else /*!_WIN32*/ +# define _GCRY_THREAD_OPTION_PTH_IMPL_NET \ +static ssize_t gcry_pth_select (int nfd, fd_set *rset, fd_set *wset, \ + fd_set *eset, struct timeval *timeout) \ + { return pth_select (nfd, rset, wset, eset, timeout); } \ +static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \ + { return pth_waitpid (pid, status, options); } \ +static int gcry_pth_accept (int s, struct sockaddr *addr, \ + gcry_socklen_t *length_ptr) \ + { return pth_accept (s, addr, length_ptr); } \ +static int gcry_pth_connect (int s, struct sockaddr *addr, \ + gcry_socklen_t length) \ + { return pth_connect (s, addr, length); } +#endif /*!_WIN32*/ + + + #define GCRY_THREAD_OPTION_PTH_IMPL \ static int gcry_pth_init (void) \ { return (pth_init () == FALSE) ? errno : 0; } \ @@ -246,17 +276,7 @@ static ssize_t gcry_pth_read (int fd, void *buf, size_t nbytes) \ { return pth_read (fd, buf, nbytes); } \ static ssize_t gcry_pth_write (int fd, const void *buf, size_t nbytes) \ { return pth_write (fd, buf, nbytes); } \ -static ssize_t gcry_pth_select (int nfd, fd_set *rset, fd_set *wset, \ - fd_set *eset, struct timeval *timeout) \ - { return pth_select (nfd, rset, wset, eset, timeout); } \ -static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \ - { return pth_waitpid (pid, status, options); } \ -static int gcry_pth_accept (int s, struct sockaddr *addr, \ - gcry_socklen_t *length_ptr) \ - { return pth_accept (s, addr, length_ptr); } \ -static int gcry_pth_connect (int s, struct sockaddr *addr, \ - gcry_socklen_t length) \ - { return pth_connect (s, addr, length); } \ +_GCRY_THREAD_OPTION_PTH_IMPL_NET \ \ /* FIXME: GNU Pth is missing pth_sendmsg and pth_recvmsg. */ \ static struct gcry_thread_cbs gcry_threads_pth = { GCRY_THREAD_OPTION_PTH, \ @@ -265,6 +285,7 @@ static struct gcry_thread_cbs gcry_threads_pth = { GCRY_THREAD_OPTION_PTH, \ gcry_pth_select, gcry_pth_waitpid, gcry_pth_accept, gcry_pth_connect, \ NULL, NULL } + #define GCRY_THREAD_OPTION_PTHREAD_IMPL \ static int gcry_pthread_mutex_init (void **priv) \ { \ |