mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
BUILD: stream_interface: remove si_fd() and its references
si_fd() is not used a lot, and breaks builds on OpenBSD 5.2 which defines this name for its own purpose. It's easy enough to remove this one-liner function, so let's do it.
This commit is contained in:
parent
0ea0cf606e
commit
7f7ad91056
@ -56,11 +56,6 @@ static inline const struct protocol *si_ctrl(struct stream_interface *si)
|
|||||||
return si->conn->ctrl;
|
return si->conn->ctrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int si_fd(struct stream_interface *si)
|
|
||||||
{
|
|
||||||
return si->conn->t.sock.fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void si_prepare_conn(struct stream_interface *si, const struct protocol *ctrl, const struct xprt_ops *xprt)
|
static inline void si_prepare_conn(struct stream_interface *si, const struct protocol *ctrl, const struct xprt_ops *xprt)
|
||||||
{
|
{
|
||||||
si->ops = &si_conn_ops;
|
si->ops = &si_conn_ops;
|
||||||
|
@ -3463,7 +3463,7 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si)
|
|||||||
&sess->si[0],
|
&sess->si[0],
|
||||||
sess->si[0].state,
|
sess->si[0].state,
|
||||||
sess->si[0].flags,
|
sess->si[0].flags,
|
||||||
si_fd(&sess->si[0]),
|
sess->si[0].conn->t.sock.fd,
|
||||||
sess->si[0].exp ?
|
sess->si[0].exp ?
|
||||||
tick_is_expired(sess->si[0].exp, now_ms) ? "<PAST>" :
|
tick_is_expired(sess->si[0].exp, now_ms) ? "<PAST>" :
|
||||||
human_time(TICKS_TO_MS(sess->si[0].exp - now_ms),
|
human_time(TICKS_TO_MS(sess->si[0].exp - now_ms),
|
||||||
@ -3475,7 +3475,7 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si)
|
|||||||
&sess->si[1],
|
&sess->si[1],
|
||||||
sess->si[1].state,
|
sess->si[1].state,
|
||||||
sess->si[1].flags,
|
sess->si[1].flags,
|
||||||
si_fd(&sess->si[1]),
|
sess->si[1].conn->t.sock.fd,
|
||||||
sess->si[1].exp ?
|
sess->si[1].exp ?
|
||||||
tick_is_expired(sess->si[1].exp, now_ms) ? "<PAST>" :
|
tick_is_expired(sess->si[1].exp, now_ms) ? "<PAST>" :
|
||||||
human_time(TICKS_TO_MS(sess->si[1].exp - now_ms),
|
human_time(TICKS_TO_MS(sess->si[1].exp - now_ms),
|
||||||
@ -3704,7 +3704,7 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si)
|
|||||||
" s0=[%d,%1xh,fd=%d,ex=%s]",
|
" s0=[%d,%1xh,fd=%d,ex=%s]",
|
||||||
curr_sess->si[0].state,
|
curr_sess->si[0].state,
|
||||||
curr_sess->si[0].flags,
|
curr_sess->si[0].flags,
|
||||||
si_fd(&curr_sess->si[0]),
|
curr_sess->si[0].conn->t.sock.fd,
|
||||||
curr_sess->si[0].exp ?
|
curr_sess->si[0].exp ?
|
||||||
human_time(TICKS_TO_MS(curr_sess->si[0].exp - now_ms),
|
human_time(TICKS_TO_MS(curr_sess->si[0].exp - now_ms),
|
||||||
TICKS_TO_MS(1000)) : "");
|
TICKS_TO_MS(1000)) : "");
|
||||||
@ -3713,7 +3713,7 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si)
|
|||||||
" s1=[%d,%1xh,fd=%d,ex=%s]",
|
" s1=[%d,%1xh,fd=%d,ex=%s]",
|
||||||
curr_sess->si[1].state,
|
curr_sess->si[1].state,
|
||||||
curr_sess->si[1].flags,
|
curr_sess->si[1].flags,
|
||||||
si_fd(&curr_sess->si[1]),
|
curr_sess->si[1].conn->t.sock.fd,
|
||||||
curr_sess->si[1].exp ?
|
curr_sess->si[1].exp ?
|
||||||
human_time(TICKS_TO_MS(curr_sess->si[1].exp - now_ms),
|
human_time(TICKS_TO_MS(curr_sess->si[1].exp - now_ms),
|
||||||
TICKS_TO_MS(1000)) : "");
|
TICKS_TO_MS(1000)) : "");
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
*/
|
*/
|
||||||
int frontend_accept(struct session *s)
|
int frontend_accept(struct session *s)
|
||||||
{
|
{
|
||||||
int cfd = si_fd(&s->si[0]);
|
int cfd = s->si[0].conn->t.sock.fd;
|
||||||
|
|
||||||
tv_zero(&s->logs.tv_request);
|
tv_zero(&s->logs.tv_request);
|
||||||
s->logs.t_queue = -1;
|
s->logs.t_queue = -1;
|
||||||
|
@ -2392,7 +2392,7 @@ int http_wait_for_request(struct session *s, struct channel *req, int an_bit)
|
|||||||
* previously disabled it, otherwise we might cause the client
|
* previously disabled it, otherwise we might cause the client
|
||||||
* to delay next data.
|
* to delay next data.
|
||||||
*/
|
*/
|
||||||
setsockopt(si_fd(&s->si[0]), IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));
|
setsockopt(s->si[0].conn->t.sock.fd, IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3706,7 +3706,7 @@ int http_process_request(struct session *s, struct channel *req, int an_bit)
|
|||||||
if ((s->listener->options & LI_O_NOQUICKACK) &&
|
if ((s->listener->options & LI_O_NOQUICKACK) &&
|
||||||
((msg->flags & HTTP_MSGF_TE_CHNK) ||
|
((msg->flags & HTTP_MSGF_TE_CHNK) ||
|
||||||
(msg->body_len > req->buf->i - txn->req.eoh - 2)))
|
(msg->body_len > req->buf->i - txn->req.eoh - 2)))
|
||||||
setsockopt(si_fd(&s->si[0]), IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));
|
setsockopt(s->si[0].conn->t.sock.fd, IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7657,7 +7657,8 @@ void debug_hdr(const char *dir, struct session *t, const char *start, const char
|
|||||||
{
|
{
|
||||||
int max;
|
int max;
|
||||||
chunk_printf(&trash, "%08x:%s.%s[%04x:%04x]: ", t->uniq_id, t->be->id,
|
chunk_printf(&trash, "%08x:%s.%s[%04x:%04x]: ", t->uniq_id, t->be->id,
|
||||||
dir, (unsigned short)si_fd(t->req->prod), (unsigned short)si_fd(t->req->cons));
|
dir, (unsigned short)t->req->prod->conn->t.sock.fd,
|
||||||
|
(unsigned short)t->req->cons->conn->t.sock.fd);
|
||||||
|
|
||||||
for (max = 0; start + max < end; max++)
|
for (max = 0; start + max < end; max++)
|
||||||
if (start[max] == '\r' || start[max] == '\n')
|
if (start[max] == '\r' || start[max] == '\n')
|
||||||
|
@ -778,7 +778,7 @@ static int sess_update_st_con_tcp(struct session *s, struct stream_interface *si
|
|||||||
}
|
}
|
||||||
si->exp = TICK_ETERNITY;
|
si->exp = TICK_ETERNITY;
|
||||||
si->state = SI_ST_CER;
|
si->state = SI_ST_CER;
|
||||||
fd_delete(si_fd(si));
|
fd_delete(si->conn->t.sock.fd);
|
||||||
|
|
||||||
conn_xprt_close(si->conn);
|
conn_xprt_close(si->conn);
|
||||||
if (si->release)
|
if (si->release)
|
||||||
@ -2322,8 +2322,8 @@ struct task *process_session(struct task *t)
|
|||||||
s->si[1].prev_state == SI_ST_EST) {
|
s->si[1].prev_state == SI_ST_EST) {
|
||||||
chunk_printf(&trash, "%08x:%s.srvcls[%04x:%04x]\n",
|
chunk_printf(&trash, "%08x:%s.srvcls[%04x:%04x]\n",
|
||||||
s->uniq_id, s->be->id,
|
s->uniq_id, s->be->id,
|
||||||
(unsigned short)si_fd(&s->si[0]),
|
(unsigned short)s->si[0].conn->t.sock.fd,
|
||||||
(unsigned short)si_fd(&s->si[1]));
|
(unsigned short)s->si[1].conn->t.sock.fd);
|
||||||
if (write(1, trash.str, trash.len) < 0) /* shut gcc warning */;
|
if (write(1, trash.str, trash.len) < 0) /* shut gcc warning */;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2331,8 +2331,8 @@ struct task *process_session(struct task *t)
|
|||||||
s->si[0].prev_state == SI_ST_EST) {
|
s->si[0].prev_state == SI_ST_EST) {
|
||||||
chunk_printf(&trash, "%08x:%s.clicls[%04x:%04x]\n",
|
chunk_printf(&trash, "%08x:%s.clicls[%04x:%04x]\n",
|
||||||
s->uniq_id, s->be->id,
|
s->uniq_id, s->be->id,
|
||||||
(unsigned short)si_fd(&s->si[0]),
|
(unsigned short)s->si[0].conn->t.sock.fd,
|
||||||
(unsigned short)si_fd(&s->si[1]));
|
(unsigned short)s->si[1].conn->t.sock.fd);
|
||||||
if (write(1, trash.str, trash.len) < 0) /* shut gcc warning */;
|
if (write(1, trash.str, trash.len) < 0) /* shut gcc warning */;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2439,7 +2439,8 @@ struct task *process_session(struct task *t)
|
|||||||
(!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)))) {
|
(!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)))) {
|
||||||
chunk_printf(&trash, "%08x:%s.closed[%04x:%04x]\n",
|
chunk_printf(&trash, "%08x:%s.closed[%04x:%04x]\n",
|
||||||
s->uniq_id, s->be->id,
|
s->uniq_id, s->be->id,
|
||||||
(unsigned short)si_fd(s->req->prod), (unsigned short)si_fd(s->req->cons));
|
(unsigned short)s->req->prod->conn->t.sock.fd,
|
||||||
|
(unsigned short)s->req->cons->conn->t.sock.fd);
|
||||||
if (write(1, trash.str, trash.len) < 0) /* shut gcc warning */;
|
if (write(1, trash.str, trash.len) < 0) /* shut gcc warning */;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ int stream_int_shutr(struct stream_interface *si)
|
|||||||
if (si->ob->flags & CF_SHUTW) {
|
if (si->ob->flags & CF_SHUTW) {
|
||||||
conn_xprt_close(si->conn);
|
conn_xprt_close(si->conn);
|
||||||
if (conn->ctrl)
|
if (conn->ctrl)
|
||||||
fd_delete(si_fd(si));
|
fd_delete(si->conn->t.sock.fd);
|
||||||
si->state = SI_ST_DIS;
|
si->state = SI_ST_DIS;
|
||||||
si->exp = TICK_ETERNITY;
|
si->exp = TICK_ETERNITY;
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ int stream_int_shutw(struct stream_interface *si)
|
|||||||
} else if (si->flags & SI_FL_NOLINGER) {
|
} else if (si->flags & SI_FL_NOLINGER) {
|
||||||
si->flags &= ~SI_FL_NOLINGER;
|
si->flags &= ~SI_FL_NOLINGER;
|
||||||
if (conn->ctrl) {
|
if (conn->ctrl) {
|
||||||
setsockopt(si_fd(si), SOL_SOCKET, SO_LINGER,
|
setsockopt(si->conn->t.sock.fd, SOL_SOCKET, SO_LINGER,
|
||||||
(struct linger *) &nolinger, sizeof(struct linger));
|
(struct linger *) &nolinger, sizeof(struct linger));
|
||||||
}
|
}
|
||||||
/* unclean data-layer shutdown */
|
/* unclean data-layer shutdown */
|
||||||
@ -321,7 +321,7 @@ int stream_int_shutw(struct stream_interface *si)
|
|||||||
if (!(si->flags & SI_FL_NOHALF)) {
|
if (!(si->flags & SI_FL_NOHALF)) {
|
||||||
/* We shutdown transport layer */
|
/* We shutdown transport layer */
|
||||||
if (conn->ctrl)
|
if (conn->ctrl)
|
||||||
shutdown(si_fd(si), SHUT_WR);
|
shutdown(si->conn->t.sock.fd, SHUT_WR);
|
||||||
|
|
||||||
if (!(si->ib->flags & (CF_SHUTR|CF_DONT_READ))) {
|
if (!(si->ib->flags & (CF_SHUTR|CF_DONT_READ))) {
|
||||||
/* OK just a shutw, but we want the caller
|
/* OK just a shutw, but we want the caller
|
||||||
@ -339,7 +339,7 @@ int stream_int_shutw(struct stream_interface *si)
|
|||||||
*/
|
*/
|
||||||
conn_xprt_close(si->conn);
|
conn_xprt_close(si->conn);
|
||||||
if (conn->ctrl)
|
if (conn->ctrl)
|
||||||
fd_delete(si_fd(si));
|
fd_delete(si->conn->t.sock.fd);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case SI_ST_CER:
|
case SI_ST_CER:
|
||||||
case SI_ST_QUE:
|
case SI_ST_QUE:
|
||||||
@ -857,14 +857,14 @@ static void stream_int_chk_snd_conn(struct stream_interface *si)
|
|||||||
|
|
||||||
if (!ob->pipe && /* spliced data wants to be forwarded ASAP */
|
if (!ob->pipe && /* spliced data wants to be forwarded ASAP */
|
||||||
(!(si->flags & SI_FL_WAIT_DATA) || /* not waiting for data */
|
(!(si->flags & SI_FL_WAIT_DATA) || /* not waiting for data */
|
||||||
(fdtab[si_fd(si)].ev & FD_POLL_OUT))) /* we'll be called anyway */
|
(fdtab[si->conn->t.sock.fd].ev & FD_POLL_OUT))) /* we'll be called anyway */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(si->conn->flags & CO_FL_HANDSHAKE) && si_conn_send_loop(si->conn) < 0) {
|
if (!(si->conn->flags & CO_FL_HANDSHAKE) && si_conn_send_loop(si->conn) < 0) {
|
||||||
/* Write error on the file descriptor. We mark the FD as STERROR so
|
/* Write error on the file descriptor. We mark the FD as STERROR so
|
||||||
* that we don't use it anymore and we notify the task.
|
* that we don't use it anymore and we notify the task.
|
||||||
*/
|
*/
|
||||||
fdtab[si_fd(si)].ev &= ~FD_POLL_STICKY;
|
fdtab[si->conn->t.sock.fd].ev &= ~FD_POLL_STICKY;
|
||||||
__conn_data_stop_both(si->conn);
|
__conn_data_stop_both(si->conn);
|
||||||
si->flags |= SI_FL_ERR;
|
si->flags |= SI_FL_ERR;
|
||||||
si->conn->flags |= CO_FL_ERROR;
|
si->conn->flags |= CO_FL_ERROR;
|
||||||
@ -1207,7 +1207,7 @@ void stream_sock_read0(struct stream_interface *si)
|
|||||||
/* we want to immediately forward this close to the write side */
|
/* we want to immediately forward this close to the write side */
|
||||||
if (si->flags & SI_FL_NOLINGER) {
|
if (si->flags & SI_FL_NOLINGER) {
|
||||||
si->flags &= ~SI_FL_NOLINGER;
|
si->flags &= ~SI_FL_NOLINGER;
|
||||||
setsockopt(si_fd(si), SOL_SOCKET, SO_LINGER,
|
setsockopt(si->conn->t.sock.fd, SOL_SOCKET, SO_LINGER,
|
||||||
(struct linger *) &nolinger, sizeof(struct linger));
|
(struct linger *) &nolinger, sizeof(struct linger));
|
||||||
}
|
}
|
||||||
/* force flag on ssl to keep session in cache */
|
/* force flag on ssl to keep session in cache */
|
||||||
@ -1222,7 +1222,7 @@ void stream_sock_read0(struct stream_interface *si)
|
|||||||
|
|
||||||
do_close:
|
do_close:
|
||||||
conn_xprt_close(si->conn);
|
conn_xprt_close(si->conn);
|
||||||
fd_delete(si_fd(si));
|
fd_delete(si->conn->t.sock.fd);
|
||||||
si->state = SI_ST_DIS;
|
si->state = SI_ST_DIS;
|
||||||
si->exp = TICK_ETERNITY;
|
si->exp = TICK_ETERNITY;
|
||||||
if (si->release)
|
if (si->release)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user