changed configure.ac to detect dirfd() and related stuffs.

changed lib/cmn/syscall.h to use DIRFD related macros produced by configure
This commit is contained in:
2014-09-25 15:27:08 +00:00
parent 45ad42fa36
commit 056cff9192
15 changed files with 137 additions and 54 deletions

View File

@ -184,7 +184,7 @@ struct dns_ans_t
* this condition is required for reusing the dns_req_t chunk
* when caching an answer without allocating another chunk. */
qse_nwad_t nwad;
qse_int64_t age;
qse_long_t age;
qse_uint32_t ttl;
dns_ans_t* next;
};
@ -539,7 +539,7 @@ static int dns_recv (qse_httpd_t* httpd, qse_httpd_dns_t* dns, qse_httpd_hnd_t h
httpd_xtn_t* httpd_xtn;
qse_skad_t fromaddr;
socklen_t fromlen;
qse_sck_len_t fromlen;
qse_uint8_t buf[DNS_MAX_MSG_LEN];
qse_ssize_t len;

View File

@ -95,12 +95,13 @@ static int urs_open (qse_httpd_t* httpd, qse_httpd_urs_t* urs)
qse_nwad_t nwad;
urs_ctx_t* dc;
httpd_xtn_t* httpd_xtn;
int type, proto = IPPROTO_UDP; //IPPROTO_SCTP;
int type, proto = IPPROTO_UDP; /*IPPROTO_SCTP*/
httpd_xtn = qse_httpd_getxtn (httpd);
urs->handle[0] = QSE_INVALID_SCKHND;
urs->handle[1] = QSE_INVALID_SCKHND;
urs->handle[2] = QSE_INVALID_SCKHND;
dc = (urs_ctx_t*) qse_httpd_callocmem (httpd, QSE_SIZEOF(urs_ctx_t));
if (dc == NULL) goto oops;
@ -132,6 +133,7 @@ static int urs_open (qse_httpd_t* httpd, qse_httpd_urs_t* urs)
#if defined(AF_INET6)
urs->handle[1] = open_udp_socket (httpd, AF_INET6, type, proto);
#endif
/*urs->handle[2] = open_unix_socket (httpd, AF_UNIX, SOCK_DGRAM);*/
if (!qse_isvalidsckhnd(urs->handle[0]) && !qse_isvalidsckhnd(urs->handle[1]))
{
@ -160,12 +162,14 @@ static int urs_open (qse_httpd_t* httpd, qse_httpd_urs_t* urs)
/* TODO: error ahndleing */
if (qse_isvalidsckhnd(urs->handle[0])) listen (urs->handle[0], 99);
if (qse_isvalidsckhnd(urs->handle[1])) listen (urs->handle[1], 99);
/* handle[2] is a unix socket. no special handling for SCTP */
}
#endif
urs->handle_count = 2;
urs->handle_count = 3;
if (qse_isvalidsckhnd(urs->handle[0])) urs->handle_mask |= (1 << 0);
if (qse_isvalidsckhnd(urs->handle[1])) urs->handle_mask |= (1 << 1);
if (qse_isvalidsckhnd(urs->handle[2])) urs->handle_mask |= (1 << 2);
urs->ctx = dc;
return 0;
@ -173,6 +177,7 @@ static int urs_open (qse_httpd_t* httpd, qse_httpd_urs_t* urs)
oops:
if (qse_isvalidsckhnd(urs->handle[0])) qse_closesckhnd (urs->handle[0]);
if (qse_isvalidsckhnd(urs->handle[1])) qse_closesckhnd (urs->handle[1]);
if (qse_isvalidsckhnd(urs->handle[2])) qse_closesckhnd (urs->handle[2]);
if (dc) qse_httpd_freemem (httpd, dc);
return -1;
@ -210,6 +215,7 @@ static void urs_close (qse_httpd_t* httpd, qse_httpd_urs_t* urs)
if (qse_isvalidsckhnd(urs->handle[0])) qse_closesckhnd (urs->handle[0]);
if (qse_isvalidsckhnd(urs->handle[1])) qse_closesckhnd (urs->handle[1]);
if (qse_isvalidsckhnd(urs->handle[2])) qse_closesckhnd (urs->handle[2]);
qse_httpd_freemem (httpd, urs->ctx);
}
@ -220,7 +226,7 @@ static int urs_recv (qse_httpd_t* httpd, qse_httpd_urs_t* urs, qse_httpd_hnd_t h
httpd_xtn_t* httpd_xtn;
qse_skad_t fromaddr;
socklen_t fromlen;
qse_sck_len_t fromlen;
qse_uint16_t xid;
qse_ssize_t len, url_len;
@ -358,7 +364,6 @@ static int urs_send (qse_httpd_t* httpd, qse_httpd_urs_t* urs, const qse_mchar_t
urs_req_t* req = QSE_NULL;
qse_size_t url_len;
qse_tmr_event_t tmout_event;
printf ("... URS_SEND.....................\n");
httpd_xtn = qse_httpd_getxtn (httpd);

View File

@ -2154,8 +2154,8 @@ if (qse_htre_getcontentlen(req) > 0)
else
{
if (mth == QSE_HTTP_POST &&
!(req->flags & QSE_HTRE_ATTR_LENGTH) &&
!(req->flags & QSE_HTRE_ATTR_CHUNKED))
!(req->flags & QSE_HTRE_ATTR_LENGTH) &&
!(req->flags & QSE_HTRE_ATTR_CHUNKED))
{
/* POST without Content-Length nor not chunked */
req->flags &= ~QSE_HTRE_ATTR_KEEPALIVE;
@ -2181,8 +2181,8 @@ if (qse_htre_getcontentlen(req) > 0)
{
task = QSE_NULL;
if ((rsrc.flags & QSE_HTTPD_RSRC_100_CONTINUE) &&
(task = qse_httpd_entaskcontinue (httpd, client, task, req)) == QSE_NULL)
if ((rsrc.flags & QSE_HTTPD_RSRC_100_CONTINUE) &&
(task = qse_httpd_entaskcontinue (httpd, client, task, req)) == QSE_NULL)
{
/* inject '100 continue' first if it is needed */
goto oops;