mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-25 20:28:27 +00:00
fix new bsd test
This commit is contained in:
1 parent
c957f29f23
commit
10adde595c
4 files changed
+10
-10
No files matched your search
+2
-2
@@ -828,7 +828,7 @@ static bool bsd_run(struct mg_bsd_cmd *cmd) {
|
|||||||
fd_set *w = cmd->op_select.w;
|
fd_set *w = cmd->op_select.w;
|
||||||
fd_set *e = cmd->op_select.e;
|
fd_set *e = cmd->op_select.e;
|
||||||
int fd, n = 0, want_read, want_write, want_error, ready;
|
int fd, n = 0, want_read, want_write, want_error, ready;
|
||||||
#if MG_ENABLE_BSD_PROTOTYPES
|
#if defined(MG_BSD_SELECT_H)
|
||||||
int i;
|
int i;
|
||||||
__fd_mask bits;
|
__fd_mask bits;
|
||||||
int bitsize = (int) (sizeof(bits) * 8);
|
int bitsize = (int) (sizeof(bits) * 8);
|
||||||
@@ -841,7 +841,7 @@ static bool bsd_run(struct mg_bsd_cmd *cmd) {
|
|||||||
FD_ZERO(&rr);
|
FD_ZERO(&rr);
|
||||||
FD_ZERO(&ww);
|
FD_ZERO(&ww);
|
||||||
FD_ZERO(&ee);
|
FD_ZERO(&ee);
|
||||||
#if MG_ENABLE_BSD_PROTOTYPES
|
#if defined(MG_BSD_SELECT_H)
|
||||||
for (i = 0; i < (cmd->op_select.nfds + bitsize - 1) / bitsize; i++) {
|
for (i = 0; i < (cmd->op_select.nfds + bitsize - 1) / bitsize; i++) {
|
||||||
bits = 0;
|
bits = 0;
|
||||||
if (r != NULL) bits |= r->__fds_bits[i];
|
if (r != NULL) bits |= r->__fds_bits[i];
|
||||||
|
|||||||
+3
-3
@@ -4995,7 +4995,6 @@ void mg_bsd_poll(struct mg_mgr *);
|
|||||||
typedef unsigned int socklen_t;
|
typedef unsigned int socklen_t;
|
||||||
typedef unsigned long nfds_t;
|
typedef unsigned long nfds_t;
|
||||||
typedef uint32_t in_addr_t;
|
typedef uint32_t in_addr_t;
|
||||||
typedef unsigned long __fd_mask;
|
|
||||||
struct in_addr { in_addr_t s_addr; };
|
struct in_addr { in_addr_t s_addr; };
|
||||||
struct in6_addr { uint8_t s6_addr[16]; };
|
struct in6_addr { uint8_t s6_addr[16]; };
|
||||||
struct sockaddr { uint16_t sa_family; char sa_data[14]; };
|
struct sockaddr { uint16_t sa_family; char sa_data[14]; };
|
||||||
@@ -5032,11 +5031,12 @@ struct addrinfo {
|
|||||||
};
|
};
|
||||||
struct pollfd { int fd; short events; short revents; };
|
struct pollfd { int fd; short events; short revents; };
|
||||||
|
|
||||||
|
#if !defined(FD_SET) && !defined(FD_ZERO) && !defined(FD_ISSET)
|
||||||
|
#define MG_BSD_SELECT_H
|
||||||
|
typedef unsigned long __fd_mask;
|
||||||
#ifndef FD_SETSIZE
|
#ifndef FD_SETSIZE
|
||||||
#define FD_SETSIZE 64
|
#define FD_SETSIZE 64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FD_ZERO
|
|
||||||
#define _NFDBITS ((int) sizeof(__fd_mask) * 8)
|
#define _NFDBITS ((int) sizeof(__fd_mask) * 8)
|
||||||
#define _howmany(x, y) (((x) + ((y) - 1)) / (y))
|
#define _howmany(x, y) (((x) + ((y) - 1)) / (y))
|
||||||
typedef struct fd_set {
|
typedef struct fd_set {
|
||||||
|
|||||||
@@ -661,7 +661,7 @@ static bool bsd_run(struct mg_bsd_cmd *cmd) {
|
|||||||
fd_set *w = cmd->op_select.w;
|
fd_set *w = cmd->op_select.w;
|
||||||
fd_set *e = cmd->op_select.e;
|
fd_set *e = cmd->op_select.e;
|
||||||
int fd, n = 0, want_read, want_write, want_error, ready;
|
int fd, n = 0, want_read, want_write, want_error, ready;
|
||||||
#if MG_ENABLE_BSD_PROTOTYPES
|
#if defined(MG_BSD_SELECT_H)
|
||||||
int i;
|
int i;
|
||||||
__fd_mask bits;
|
__fd_mask bits;
|
||||||
int bitsize = (int) (sizeof(bits) * 8);
|
int bitsize = (int) (sizeof(bits) * 8);
|
||||||
@@ -674,7 +674,7 @@ static bool bsd_run(struct mg_bsd_cmd *cmd) {
|
|||||||
FD_ZERO(&rr);
|
FD_ZERO(&rr);
|
||||||
FD_ZERO(&ww);
|
FD_ZERO(&ww);
|
||||||
FD_ZERO(&ee);
|
FD_ZERO(&ee);
|
||||||
#if MG_ENABLE_BSD_PROTOTYPES
|
#if defined(MG_BSD_SELECT_H)
|
||||||
for (i = 0; i < (cmd->op_select.nfds + bitsize - 1) / bitsize; i++) {
|
for (i = 0; i < (cmd->op_select.nfds + bitsize - 1) / bitsize; i++) {
|
||||||
bits = 0;
|
bits = 0;
|
||||||
if (r != NULL) bits |= r->__fds_bits[i];
|
if (r != NULL) bits |= r->__fds_bits[i];
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ void mg_bsd_poll(struct mg_mgr *);
|
|||||||
typedef unsigned int socklen_t;
|
typedef unsigned int socklen_t;
|
||||||
typedef unsigned long nfds_t;
|
typedef unsigned long nfds_t;
|
||||||
typedef uint32_t in_addr_t;
|
typedef uint32_t in_addr_t;
|
||||||
typedef unsigned long __fd_mask;
|
|
||||||
struct in_addr { in_addr_t s_addr; };
|
struct in_addr { in_addr_t s_addr; };
|
||||||
struct in6_addr { uint8_t s6_addr[16]; };
|
struct in6_addr { uint8_t s6_addr[16]; };
|
||||||
struct sockaddr { uint16_t sa_family; char sa_data[14]; };
|
struct sockaddr { uint16_t sa_family; char sa_data[14]; };
|
||||||
@@ -100,11 +99,12 @@ struct addrinfo {
|
|||||||
};
|
};
|
||||||
struct pollfd { int fd; short events; short revents; };
|
struct pollfd { int fd; short events; short revents; };
|
||||||
|
|
||||||
|
#if !defined(FD_SET) && !defined(FD_ZERO) && !defined(FD_ISSET)
|
||||||
|
#define MG_BSD_SELECT_H
|
||||||
|
typedef unsigned long __fd_mask;
|
||||||
#ifndef FD_SETSIZE
|
#ifndef FD_SETSIZE
|
||||||
#define FD_SETSIZE 64
|
#define FD_SETSIZE 64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FD_ZERO
|
|
||||||
#define _NFDBITS ((int) sizeof(__fd_mask) * 8)
|
#define _NFDBITS ((int) sizeof(__fd_mask) * 8)
|
||||||
#define _howmany(x, y) (((x) + ((y) - 1)) / (y))
|
#define _howmany(x, y) (((x) + ((y) - 1)) / (y))
|
||||||
typedef struct fd_set {
|
typedef struct fd_set {
|
||||||
|
|||||||
Reference in new issue
Block a user