From 192c29c129918b8523baca5a5b5f0d4d78497439 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Thu, 29 Apr 2004 19:56:05 +0000 Subject: sock -> fd; ok henning --- usr.sbin/bgpd/bgpd.c | 6 +++--- usr.sbin/bgpd/bgpd.h | 6 +++--- usr.sbin/bgpd/buffer.c | 8 ++++---- usr.sbin/bgpd/control.c | 6 +++--- usr.sbin/bgpd/imsg.c | 10 +++++----- usr.sbin/bgpd/mrt.c | 18 +++++++++--------- usr.sbin/bgpd/parse.y | 4 ++-- usr.sbin/bgpd/rde.c | 6 +++--- usr.sbin/bgpd/session.c | 16 ++++++++-------- 9 files changed, 40 insertions(+), 40 deletions(-) diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c index 7805c0a71de..e7397dcff80 100644 --- a/usr.sbin/bgpd/bgpd.c +++ b/usr.sbin/bgpd/bgpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.c,v 1.90 2004/04/27 04:38:12 deraadt Exp $ */ +/* $OpenBSD: bgpd.c,v 1.91 2004/04/29 19:56:04 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -227,11 +227,11 @@ main(int argc, char *argv[]) } while (quit == 0) { - pfd[PFD_PIPE_SESSION].fd = ibuf_se.sock; + pfd[PFD_PIPE_SESSION].fd = ibuf_se.fd; pfd[PFD_PIPE_SESSION].events = POLLIN; if (ibuf_se.w.queued) pfd[PFD_PIPE_SESSION].events |= POLLOUT; - pfd[PFD_PIPE_ROUTE].fd = ibuf_rde.sock; + pfd[PFD_PIPE_ROUTE].fd = ibuf_rde.fd; pfd[PFD_PIPE_ROUTE].events = POLLIN; if (ibuf_rde.w.queued) pfd[PFD_PIPE_ROUTE].events |= POLLOUT; diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 38961b2b2d1..44ecdbd2b84 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.118 2004/04/28 04:34:46 henning Exp $ */ +/* $OpenBSD: bgpd.h,v 1.119 2004/04/29 19:56:04 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -85,7 +85,7 @@ struct buf { struct msgbuf { u_int32_t queued; - int sock; + int fd; TAILQ_HEAD(bufs, buf) bufs; }; @@ -217,7 +217,7 @@ struct network { #define MAX_IMSGSIZE 8192 struct imsgbuf { - int sock; + int fd; pid_t pid; struct buf_read r; struct msgbuf w; diff --git a/usr.sbin/bgpd/buffer.c b/usr.sbin/bgpd/buffer.c index b10618fd437..4d91dc05434 100644 --- a/usr.sbin/bgpd/buffer.c +++ b/usr.sbin/bgpd/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.17 2004/02/19 13:54:58 claudio Exp $ */ +/* $OpenBSD: buffer.c,v 1.18 2004/04/29 19:56:04 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -116,7 +116,7 @@ void msgbuf_init(struct msgbuf *msgbuf) { msgbuf->queued = 0; - msgbuf->sock = -1; + msgbuf->fd = -1; TAILQ_INIT(&msgbuf->bufs); } @@ -152,7 +152,7 @@ msgbuf_write(struct msgbuf *msgbuf) i++; } - if ((n = writev(msgbuf->sock, iov, i)) == -1) { + if ((n = writev(msgbuf->fd, iov, i)) == -1) { if (errno == EAGAIN) /* cannot write immediately */ return (0); else @@ -195,7 +195,7 @@ msgbuf_writebound(struct msgbuf *msgbuf) return (1); buf = TAILQ_FIRST(&msgbuf->bufs); - if ((n = buf_write(msgbuf->sock, buf)) < 0) + if ((n = buf_write(msgbuf->fd, buf)) < 0) return (n); if (n == 1) { /* everything written out */ diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c index e4a5a8c4b8f..373b1e1902d 100644 --- a/usr.sbin/bgpd/control.c +++ b/usr.sbin/bgpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.28 2004/04/25 03:13:42 henning Exp $ */ +/* $OpenBSD: control.c,v 1.29 2004/04/29 19:56:04 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -137,7 +137,7 @@ control_connbyfd(int fd) { struct ctl_conn *c; - for (c = TAILQ_FIRST(&ctl_conns); c != NULL && c->ibuf.sock != fd; + for (c = TAILQ_FIRST(&ctl_conns); c != NULL && c->ibuf.fd != fd; c = TAILQ_NEXT(c, entries)) ; /* nothing */ @@ -169,7 +169,7 @@ control_close(int fd) msgbuf_clear(&c->ibuf.w); TAILQ_REMOVE(&ctl_conns, c, entries); - close(c->ibuf.sock); + close(c->ibuf.fd); free(c); } diff --git a/usr.sbin/bgpd/imsg.c b/usr.sbin/bgpd/imsg.c index e461970ee07..eb81ad58b7b 100644 --- a/usr.sbin/bgpd/imsg.c +++ b/usr.sbin/bgpd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.24 2004/03/12 20:48:09 henning Exp $ */ +/* $OpenBSD: imsg.c,v 1.25 2004/04/29 19:56:04 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -31,12 +31,12 @@ struct buf *imsg_create_core(struct imsgbuf *, int, u_int32_t, u_int16_t, pid_t); void -imsg_init(struct imsgbuf *ibuf, int sock) +imsg_init(struct imsgbuf *ibuf, int fd) { msgbuf_init(&ibuf->w); bzero(&ibuf->r, sizeof(ibuf->r)); - ibuf->sock = sock; - ibuf->w.sock = sock; + ibuf->fd = fd; + ibuf->w.fd = fd; ibuf->pid = getpid(); } @@ -45,7 +45,7 @@ imsg_read(struct imsgbuf *ibuf) { ssize_t n; - if ((n = read(ibuf->sock, ibuf->r.buf + ibuf->r.wpos, + if ((n = read(ibuf->fd, ibuf->r.buf + ibuf->r.wpos, sizeof(ibuf->r.buf) - ibuf->r.wpos)) == -1) { if (errno != EINTR && errno != EAGAIN) { log_warn("imsg_read: pipe read error"); diff --git a/usr.sbin/bgpd/mrt.c b/usr.sbin/bgpd/mrt.c index 49da782a852..89752b7fdef 100644 --- a/usr.sbin/bgpd/mrt.c +++ b/usr.sbin/bgpd/mrt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mrt.c,v 1.29 2004/04/28 01:13:36 deraadt Exp $ */ +/* $OpenBSD: mrt.c,v 1.30 2004/04/29 19:56:04 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker @@ -341,13 +341,13 @@ mrt_open(struct mrt *mrt) if (strftime(mrt->file, sizeof(mrt->file), mrt->name, localtime(&now)) == 0) { log_warnx("mrt_open: strftime conversion failed"); - mrt->msgbuf.sock = -1; + mrt->msgbuf.fd = -1; return (0); } - mrt->msgbuf.sock = open(mrt->file, + mrt->msgbuf.fd = open(mrt->file, O_WRONLY|O_NONBLOCK|O_CREAT|O_TRUNC, 0644); - if (mrt->msgbuf.sock == -1) { + if (mrt->msgbuf.fd == -1) { log_warnx("mrt_open %s: %s", mrt->file, strerror(errno)); return (0); @@ -367,9 +367,9 @@ mrt_close(struct mrt *mrt) if (msgbuf_unbounded(&mrt->msgbuf)) return (0); - if (mrt->msgbuf.sock != -1) { - close(mrt->msgbuf.sock); - mrt->msgbuf.sock = -1; + if (mrt->msgbuf.fd != -1) { + close(mrt->msgbuf.fd); + mrt->msgbuf.fd = -1; } return (1); @@ -607,14 +607,14 @@ mrt_select(struct mrt_head *mc, struct pollfd *pfd, struct mrt **mrt, } } if (m->msgbuf.queued > 0) { - if (m->msgbuf.sock == -1 || + if (m->msgbuf.fd == -1 || m->state == MRT_STATE_STOPPED) { log_warnx("mrt_select: orphaned buffer"); mrt_abort(m); continue; } if (start < size) { - pfd[start].fd = m->msgbuf.sock; + pfd[start].fd = m->msgbuf.fd; pfd[start].events = POLLOUT; mrt[start++] = m; } diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index b18e3b4f65d..34f8210e575 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.96 2004/04/28 06:43:04 deraadt Exp $ */ +/* $OpenBSD: parse.y,v 1.97 2004/04/29 19:56:04 deraadt Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -1491,7 +1491,7 @@ add_mrtconfig(enum mrt_type type, char *name, time_t timeout, struct peer *p) fatal("add_mrtconfig"); n->conf.type = type; - n->msgbuf.sock = -1; + n->msgbuf.fd = -1; if (strlcpy(n->name, name, sizeof(n->name)) >= sizeof(n->name)) { yyerror("filename \"%s\" too long: max %u", name, sizeof(n->name) - 1); diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index ae60ae43a87..5775e2fc38f 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.108 2004/04/28 04:36:16 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.109 2004/04/29 19:56:04 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -162,12 +162,12 @@ rde_main(struct bgpd_config *config, struct network_head *net_l, while (rde_quit == 0) { bzero(&pfd, sizeof(pfd)); - pfd[PFD_PIPE_MAIN].fd = ibuf_main.sock; + pfd[PFD_PIPE_MAIN].fd = ibuf_main.fd; pfd[PFD_PIPE_MAIN].events = POLLIN; if (ibuf_main.w.queued > 0) pfd[PFD_PIPE_MAIN].events |= POLLOUT; - pfd[PFD_PIPE_SESSION].fd = ibuf_se.sock; + pfd[PFD_PIPE_SESSION].fd = ibuf_se.fd; pfd[PFD_PIPE_SESSION].events = POLLIN; if (ibuf_se.w.queued > 0) pfd[PFD_PIPE_SESSION].events |= POLLOUT; diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 08fb5813267..0a61325dc73 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.161 2004/04/28 17:42:27 deraadt Exp $ */ +/* $OpenBSD: session.c,v 1.162 2004/04/29 19:56:04 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -240,11 +240,11 @@ session_main(struct bgpd_config *config, struct peer *cpeers, pfd[PFD_LISTEN].events = POLLIN; pfd[PFD_LISTEN6].fd = sock6; pfd[PFD_LISTEN6].events = POLLIN; - pfd[PFD_PIPE_MAIN].fd = ibuf_main.sock; + pfd[PFD_PIPE_MAIN].fd = ibuf_main.fd; pfd[PFD_PIPE_MAIN].events = POLLIN; if (ibuf_main.w.queued > 0) pfd[PFD_PIPE_MAIN].events |= POLLOUT; - pfd[PFD_PIPE_ROUTE].fd = ibuf_rde.sock; + pfd[PFD_PIPE_ROUTE].fd = ibuf_rde.fd; pfd[PFD_PIPE_ROUTE].events = POLLIN; if (ibuf_rde.w.queued > 0) pfd[PFD_PIPE_ROUTE].events |= POLLOUT; @@ -335,7 +335,7 @@ session_main(struct bgpd_config *config, struct peer *cpeers, idx_peers = i; TAILQ_FOREACH(ctl_conn, &ctl_conns, entries) { - pfd[i].fd = ctl_conn->ibuf.sock; + pfd[i].fd = ctl_conn->ibuf.fd; pfd[i].events = POLLIN; if (ctl_conn->ibuf.w.queued > 0) pfd[i].events |= POLLOUT; @@ -420,7 +420,7 @@ init_conf(struct bgpd_config *c) void init_peer(struct peer *p) { - p->fd = p->wbuf.sock = -1; + p->fd = p->wbuf.fd = -1; p->capa.announce = p->conf.capabilities; p->capa.ann_mp = 1; p->capa.ann_refresh = 1; @@ -688,7 +688,7 @@ session_close_connection(struct peer *peer) shutdown(peer->fd, SHUT_RDWR); close(peer->fd); } - peer->fd = peer->wbuf.sock = -1; + peer->fd = peer->wbuf.fd = -1; } void @@ -810,7 +810,7 @@ session_accept(int listenfd) return; } } - p->fd = p->wbuf.sock = connfd; + p->fd = p->wbuf.fd = connfd; if (session_setup_socket(p)) { shutdown(connfd, SHUT_RDWR); close(connfd); @@ -854,7 +854,7 @@ session_connect(struct peer *peer) return (-1); } - peer->wbuf.sock = peer->fd; + peer->wbuf.fd = peer->fd; /* if update source is set we need to bind() */ if (peer->conf.local_addr.af) { -- cgit v1.2.3