From 63420ed93e4c410e00390dc24c8dd876f9c1933c Mon Sep 17 00:00:00 2001 From: Andrea Palmate Date: Thu, 28 Sep 2023 19:05:31 +0200 Subject: [PATCH] Removed useless pthread.h code. Added some socked defines to sys/types.h that will fix BSDSocket code compilation --- library/include/pthread.h | 43 ------------------------------------- library/include/sys/types.h | 20 +++++++++++++++++ 2 files changed, 20 insertions(+), 43 deletions(-) diff --git a/library/include/pthread.h b/library/include/pthread.h index 0e697d0c..33b1465a 100644 --- a/library/include/pthread.h +++ b/library/include/pthread.h @@ -414,49 +414,6 @@ extern void pthread_cleanup_pop(int execute); extern int pthread_kill(pthread_t thread, int sig); -// -// Wrap cancellation points -// - -#ifdef _UNISTD_H_ -#define close(...) (pthread_testcancel(), close(__VA_ARGS__)) -#define fsync(...) (pthread_testcancel(), fsync(__VA_ARGS__)) -#define read(...) (pthread_testcancel(), read(__VA_ARGS__)) -#define sleep(...) (pthread_testcancel(), sleep(__VA_ARGS__)) -#define usleep(...) (pthread_testcancel(), usleep(__VA_ARGS__)) -#endif - -#ifdef _FCNTL_H_ -#define creat(...) (pthread_testcancel(), creat(__VA_ARGS__)) -#define fcntl(...) (pthread_testcancel(), fcntl(__VA_ARGS__)) -#define open(...) (pthread_testcancel(), open(__VA_ARGS__)) -#endif - -#ifdef _TIME_H_ -#define nanosleep(...) (pthread_testcancel(), nanosleep(__VA_ARGS__)) -#endif - -#ifdef _SYS_UIO_H_ -#define readv(...) (pthread_testcancel(), readv(__VA_ARGS__)) -#endif - -#ifdef _STDLIB_H_ -#define system(...) (pthread_testcancel(), system(__VA_ARGS__)) -#endif - -#if defined(CLIB_BSDSOCKET_PROTOS_H) || defined(CLIB_SOCKET_PROTOS_H) -#define accept(...) (pthread_testcancel(), accept(__VA_ARGS__)) -#define connect(...) (pthread_testcancel(), connect(__VA_ARGS__)) -#define CloseSocket(...) (pthread_testcancel(), CloseSocket(__VA_ARGS__)) -#define recv(...) (pthread_testcancel(), recv(__VA_ARGS__)) -#define recvfrom(...) (pthread_testcancel(), recvfrom(__VA_ARGS__)) -#define recvmsg(...) (pthread_testcancel(), recvmsg(__VA_ARGS__)) -#define select(...) (pthread_testcancel(), select(__VA_ARGS__)) -#define send(...) (pthread_testcancel(), send(__VA_ARGS__)) -#define sendmsg(...) (pthread_testcancel(), sendmsg(__VA_ARGS__)) -#define sendto(...) (pthread_testcancel(), sendto(__VA_ARGS__)) -#endif - #ifdef __cplusplus } #ifdef __USE_AMIGAOS_NAMESPACE__ diff --git a/library/include/sys/types.h b/library/include/sys/types.h index b4e408e1..4e22ac5d 100755 --- a/library/include/sys/types.h +++ b/library/include/sys/types.h @@ -75,6 +75,26 @@ typedef _CLOCK_T_ clock_t; typedef _TIME_T_ time_t; typedef _CLOCKID_T_ clockid_t; +#ifndef FD_SETSIZE +#define FD_SETSIZE 256 +#endif + +typedef struct _types_fd_set { + unsigned long fds_bits[(FD_SETSIZE + 31) / 32]; +} _types_fd_set; + +#define fd_set _types_fd_set + +#define FD_SET(n, p) ((p)->fds_bits[(n)/32] |= (1L << ((n) % 32))) +#define FD_CLR(n, p) ((p)->fds_bits[(n)/32] &= ~(1L << ((n) % 32))) +#define FD_ISSET(n, p) ((p)->fds_bits[(n)/32] & (1L << ((n) % 32))) +#define FD_ZERO(p) (__extension__ (void)({ \ + size_t __i; \ + char *__tmp = (char *)p; \ + for (__i = 0; __i < sizeof (*(p)); ++__i) \ + *__tmp++ = 0; \ +})) + __END_DECLS #endif /* _SYS_TYPES_H */