Skip to content

Commit

Permalink
Removed useless pthread.h code. Added some socked defines to sys/type…
Browse files Browse the repository at this point in the history
…s.h that will fix BSDSocket code compilation
  • Loading branch information
afxgroup committed Sep 28, 2023
1 parent 1a05ce7 commit 63420ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 43 deletions.
43 changes: 0 additions & 43 deletions library/include/pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down
20 changes: 20 additions & 0 deletions library/include/sys/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit 63420ed

Please sign in to comment.