librb: some win32 fixes

This commit is contained in:
William Pitcock 2016-03-20 00:33:19 -05:00
parent b68dee9bcb
commit dc7e6b42ca
4 changed files with 18 additions and 16 deletions

View file

@ -36,8 +36,10 @@
#ifdef _WIN32
#define rb_get_errno() do { errno = WSAGetLastError(); WSASetLastError(errno); } while(0)
typedef SOCKET rb_platform_fd_t;
#else
#define rb_get_errno()
typedef int rb_platform_fd_t;
#endif
#define rb_hash_fd(x) ((x ^ (x >> RB_FD_HASH_BITS) ^ (x >> (RB_FD_HASH_BITS * 2))) & RB_FD_HASH_MASK)
@ -104,7 +106,7 @@ struct _fde
* filedescriptor. Think though: when do you think we'll need more?
*/
rb_dlink_node node;
int fd; /* So we can use the rb_fde_t as a callback ptr */
rb_platform_fd_t fd; /* So we can use the rb_fde_t as a callback ptr */
uint8_t flags;
uint8_t type;
int pflags;
@ -136,7 +138,7 @@ typedef struct timer_data
extern rb_dlink_list *rb_fd_table;
static inline rb_fde_t *
rb_find_fd(int fd)
rb_find_fd(rb_platform_fd_t fd)
{
rb_dlink_list *hlist;
rb_dlink_node *ptr;

View file

@ -154,7 +154,7 @@ int rb_get_fd(rb_fde_t *F);
const char *rb_get_ssl_strerror(rb_fde_t *F);
int rb_get_ssl_certfp(rb_fde_t *F, uint8_t certfp[RB_SSL_CERTFP_LEN], int method);
rb_fde_t *rb_get_fde(int fd);
rb_fde_t *rb_get_fde(rb_platform_fd_t fd);
int rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasize, pid_t pid);
int rb_recv_fd_buf(rb_fde_t *F, void *data, size_t datasize, rb_fde_t **xF, int count);