[master] e8c859b Namespace cleanup: TCP_ -> VTCP

Poul-Henning Kamp phk at varnish-cache.org
Tue May 31 13:15:05 CEST 2011


commit e8c859b8af5e3d7ed5ff13848cc83480e7b98a79
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue May 31 10:22:09 2011 +0000

    Namespace cleanup:  TCP_ -> VTCP

diff --git a/bin/varnishd/cache_acceptor.c b/bin/varnishd/cache_acceptor.c
index 275c7e8..74e3359 100644
--- a/bin/varnishd/cache_acceptor.c
+++ b/bin/varnishd/cache_acceptor.c
@@ -106,7 +106,7 @@ sock_test(int fd)
 	l = sizeof lin;
 	i = getsockopt(fd, SOL_SOCKET, SO_LINGER, &lin, &l);
 	if (i) {
-		TCP_Assert(i);
+		VTCP_Assert(i);
 		return;
 	}
 	assert(l == sizeof lin);
@@ -117,7 +117,7 @@ sock_test(int fd)
 	l = sizeof tv;
 	i = getsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, &l);
 	if (i) {
-		TCP_Assert(i);
+		VTCP_Assert(i);
 		return;
 	}
 	assert(l == sizeof tv);
@@ -133,7 +133,7 @@ sock_test(int fd)
 	l = sizeof tv;
 	i = getsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, &l);
 	if (i) {
-		TCP_Assert(i);
+		VTCP_Assert(i);
 		return;
 	}
 	assert(l == sizeof tv);
@@ -156,16 +156,16 @@ sock_test(int fd)
 void
 VCA_Prep(struct sess *sp)
 {
-	char addr[TCP_ADDRBUFSIZE];
-	char port[TCP_PORTBUFSIZE];
+	char addr[VTCP_ADDRBUFSIZE];
+	char port[VTCP_PORTBUFSIZE];
 
-	TCP_name(sp->sockaddr, sp->sockaddrlen,
+	VTCP_name(sp->sockaddr, sp->sockaddrlen,
 	    addr, sizeof addr, port, sizeof port);
 	sp->addr = WS_Dup(sp->ws, addr);
 	sp->port = WS_Dup(sp->ws, port);
 	if (params->log_local_addr) {
 		AZ(getsockname(sp->fd, (void*)sp->mysockaddr, &sp->mysockaddrlen));
-		TCP_name(sp->mysockaddr, sp->mysockaddrlen,
+		VTCP_name(sp->mysockaddr, sp->mysockaddrlen,
 		    addr, sizeof addr, port, sizeof port);
 		VSL(SLT_SessionOpen, sp->fd, "%s %s %s %s",
 		    sp->addr, sp->port, addr, port);
@@ -177,16 +177,16 @@ VCA_Prep(struct sess *sp)
 	if (need_test)
 		sock_test(sp->fd);
 	if (need_linger)
-		TCP_Assert(setsockopt(sp->fd, SOL_SOCKET, SO_LINGER,
+		VTCP_Assert(setsockopt(sp->fd, SOL_SOCKET, SO_LINGER,
 		    &linger, sizeof linger));
 #ifdef SO_SNDTIMEO_WORKS
 	if (need_sndtimeo)
-		TCP_Assert(setsockopt(sp->fd, SOL_SOCKET, SO_SNDTIMEO,
+		VTCP_Assert(setsockopt(sp->fd, SOL_SOCKET, SO_SNDTIMEO,
 		    &tv_sndtimeo, sizeof tv_sndtimeo));
 #endif
 #ifdef SO_RCVTIMEO_WORKS
 	if (need_rcvtimeo)
-		TCP_Assert(setsockopt(sp->fd, SOL_SOCKET, SO_RCVTIMEO,
+		VTCP_Assert(setsockopt(sp->fd, SOL_SOCKET, SO_RCVTIMEO,
 		    &tv_rcvtimeo, sizeof tv_rcvtimeo));
 #endif
 }
@@ -382,7 +382,7 @@ vca_return_session(struct sess *sp)
 	 * Set nonblocking in the worker-thread, before passing to the
 	 * acceptor thread, to reduce syscall density of the latter.
 	 */
-	if (TCP_nonblocking(sp->fd))
+	if (VTCP_nonblocking(sp->fd))
 		vca_close_session(sp, "remote closed");
 	else if (vca_act->pass == NULL)
 		assert(sizeof sp == write(vca_pipes[1], &sp, sizeof sp));
@@ -427,7 +427,7 @@ ccf_listen_address(struct cli *cli, const char * const *av, void *priv)
 	VTAILQ_FOREACH(ls, &heritage.socks, list) {
 		if (ls->sock < 0)
 			continue;
-		TCP_myname(ls->sock, h, sizeof h, p, sizeof p);
+		VTCP_myname(ls->sock, h, sizeof h, p, sizeof p);
 		cli_out(cli, "%s %s\n", h, p);
 	}
 }
diff --git a/bin/varnishd/cache_backend.c b/bin/varnishd/cache_backend.c
index a523501..819aac7 100644
--- a/bin/varnishd/cache_backend.c
+++ b/bin/varnishd/cache_backend.c
@@ -118,8 +118,8 @@ vbe_TryConnect(const struct sess *sp, int pf, const struct sockaddr_storage *sa,
 {
 	int s, i, tmo;
 	double tmod;
-	char abuf1[TCP_ADDRBUFSIZE], abuf2[TCP_ADDRBUFSIZE];
-	char pbuf1[TCP_PORTBUFSIZE], pbuf2[TCP_PORTBUFSIZE];
+	char abuf1[VTCP_ADDRBUFSIZE], abuf2[VTCP_ADDRBUFSIZE];
+	char pbuf1[VTCP_PORTBUFSIZE], pbuf2[VTCP_PORTBUFSIZE];
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(vs, VDI_SIMPLE_MAGIC);
@@ -132,15 +132,15 @@ vbe_TryConnect(const struct sess *sp, int pf, const struct sockaddr_storage *sa,
 
 	tmo = (int)(tmod * 1000.0);
 
-	i = TCP_connect(s, sa, salen, tmo);
+	i = VTCP_connect(s, sa, salen, tmo);
 
 	if (i != 0) {
 		AZ(close(s));
 		return (-1);
 	}
 
-	TCP_myname(s, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1);
-	TCP_name(sa, salen, abuf2, sizeof abuf2, pbuf2, sizeof pbuf2);
+	VTCP_myname(s, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1);
+	VTCP_name(sa, salen, abuf2, sizeof abuf2, pbuf2, sizeof pbuf2);
 	WSL(sp->wrk, SLT_BackendOpen, s, "%s %s %s %s %s",
 	    vs->backend->vcl_name, abuf1, pbuf1, abuf2, pbuf2);
 
@@ -360,7 +360,7 @@ vbe_GetVbe(const struct sess *sp, struct vdi_simple *vs)
 		   before the OS reuses the FD */
 		WSL_Flush(sp->wrk, 0);
 
-		TCP_close(&vc->fd);
+		VTCP_close(&vc->fd);
 		VBE_DropRefConn(bp);
 		vc->backend = NULL;
 		VBE_ReleaseConn(vc);
diff --git a/bin/varnishd/cache_backend_poll.c b/bin/varnishd/cache_backend_poll.c
index 61ed687..ce55e39 100644
--- a/bin/varnishd/cache_backend_poll.c
+++ b/bin/varnishd/cache_backend_poll.c
@@ -114,10 +114,10 @@ vbp_connect(int pf, const struct sockaddr_storage *sa, socklen_t salen, int tmo)
 	if (s < 0)
 		return (s);
 
-	i = TCP_connect(s, sa, salen, tmo);
+	i = VTCP_connect(s, sa, salen, tmo);
 	if (i == 0)
 		return (s);
-	TCP_close(&s);
+	VTCP_close(&s);
 	return (-1);
 }
 
@@ -166,7 +166,7 @@ vbp_poke(struct vbp_target *vt)
 	}
 	if (tmo <= 0) {
 		/* Spent too long time getting it */
-		TCP_close(&s);
+		VTCP_close(&s);
 		return;
 	}
 
@@ -175,7 +175,7 @@ vbp_poke(struct vbp_target *vt)
 	if (i != vt->req_len) {
 		if (i < 0)
 			vt->err_xmit |= 1;
-		TCP_close(&s);
+		VTCP_close(&s);
 		return;
 	}
 	vt->good_xmit |= 1;
@@ -189,7 +189,7 @@ vbp_poke(struct vbp_target *vt)
 		if (tmo > 0)
 			i = poll(pfd, 1, tmo);
 		if (i == 0 || tmo <= 0) {
-			TCP_close(&s);
+			VTCP_close(&s);
 			return;
 		}
 		if (rlen < sizeof vt->resp_buf)
@@ -200,7 +200,7 @@ vbp_poke(struct vbp_target *vt)
 		rlen += i;
 	} while (i > 0);
 
-	TCP_close(&s);
+	VTCP_close(&s);
 
 	if (i < 0) {
 		vt->err_recv |= 1;
diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 59e22d4..4f69e47 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -350,7 +350,7 @@ cnt_done(struct sess *sp)
 		 * This is an orderly close of the connection; ditch nolinger
 		 * before we close, to get queued data transmitted.
 		 */
-		// XXX: not yet (void)TCP_linger(sp->fd, 0);
+		// XXX: not yet (void)VTCP_linger(sp->fd, 0);
 		vca_close_session(sp, sp->doclose);
 	}
 
@@ -1497,7 +1497,7 @@ CNT_Session(struct sess *sp)
 	 * do the syscall in the worker thread.
 	 */
 	if (sp->step == STP_FIRST || sp->step == STP_START)
-		(void)TCP_blocking(sp->fd);
+		(void)VTCP_blocking(sp->fd);
 
 	/*
 	 * NB: Once done is set, we can no longer touch sp!
diff --git a/bin/varnishd/cache_dir.c b/bin/varnishd/cache_dir.c
index 4aa7a8f..5ec4e11 100644
--- a/bin/varnishd/cache_dir.c
+++ b/bin/varnishd/cache_dir.c
@@ -54,7 +54,7 @@ VDI_CloseFd(struct sess *sp)
 	   before the OS reuses the FD */
 	WSL_Flush(sp->wrk, 0);
 
-	TCP_close(&sp->vbc->fd);
+	VTCP_close(&sp->vbc->fd);
 	VBE_DropRefConn(bp);
 	sp->vbc->backend = NULL;
 	VBE_ReleaseConn(sp->vbc);
diff --git a/bin/varnishd/cache_fetch.c b/bin/varnishd/cache_fetch.c
index b224146..1cc9dc2 100644
--- a/bin/varnishd/cache_fetch.c
+++ b/bin/varnishd/cache_fetch.c
@@ -415,7 +415,7 @@ FetchHdr(struct sess *sp)
 	if (!http_GetHdr(hp, H_Host, &b))
 		VDI_AddHostHeader(sp);
 
-	(void)TCP_blocking(vc->fd);	/* XXX: we should timeout instead */
+	(void)VTCP_blocking(vc->fd);	/* XXX: we should timeout instead */
 	WRW_Reserve(w, &vc->fd);
 	(void)http_Write(w, hp, 0);	/* XXX: stats ? */
 
@@ -440,7 +440,7 @@ FetchHdr(struct sess *sp)
 	HTC_Init(sp->wrk->htc, sp->wrk->ws, vc->fd, params->http_resp_size,
 	    params->http_resp_hdr_len);
 
-	TCP_set_read_timeout(vc->fd, vc->first_byte_timeout);
+	VTCP_set_read_timeout(vc->fd, vc->first_byte_timeout);
 
 	i = HTC_Rx(sp->wrk->htc);
 
@@ -453,7 +453,7 @@ FetchHdr(struct sess *sp)
 		return (i == -1 ? retry : -1);
 	}
 
-	TCP_set_read_timeout(vc->fd, vc->between_bytes_timeout);
+	VTCP_set_read_timeout(vc->fd, vc->between_bytes_timeout);
 
 	while (i == 0) {
 		i = HTC_Rx(sp->wrk->htc);
diff --git a/bin/varnishd/cache_pipe.c b/bin/varnishd/cache_pipe.c
index 73d03e8..2f8c91c 100644
--- a/bin/varnishd/cache_pipe.c
+++ b/bin/varnishd/cache_pipe.c
@@ -75,7 +75,7 @@ PipeSession(struct sess *sp)
 	if (sp->vbc == NULL)
 		return;
 	vc = sp->vbc;
-	(void)TCP_blocking(vc->fd);
+	(void)VTCP_blocking(vc->fd);
 
 	WRW_Reserve(w, &vc->fd);
 	sp->acct_req.hdrbytes += http_Write(w, sp->wrk->bereq, 0);
@@ -96,11 +96,11 @@ PipeSession(struct sess *sp)
 
 	memset(fds, 0, sizeof fds);
 
-	// XXX: not yet (void)TCP_linger(vc->fd, 0);
+	// XXX: not yet (void)VTCP_linger(vc->fd, 0);
 	fds[0].fd = vc->fd;
 	fds[0].events = POLLIN | POLLERR;
 
-	// XXX: not yet (void)TCP_linger(sp->fd, 0);
+	// XXX: not yet (void)VTCP_linger(sp->fd, 0);
 	fds[1].fd = sp->fd;
 	fds[1].events = POLLIN | POLLERR;
 
diff --git a/bin/varnishd/cache_vrt_var.c b/bin/varnishd/cache_vrt_var.c
index ec82a06..6fe7b6c 100644
--- a/bin/varnishd/cache_vrt_var.c
+++ b/bin/varnishd/cache_vrt_var.c
@@ -269,7 +269,7 @@ VRT_r_beresp_backend_port(const struct sess *sp)
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->vbc, VBC_MAGIC);
-	return (TCP_port(sp->vbc->addr));
+	return (VTCP_port(sp->vbc->addr));
 }
 
 const char * __match_proto__()
@@ -446,7 +446,7 @@ VRT_r_server_ip(struct sess *sp)
 
 	if (sp->mysockaddr->ss_family == AF_UNSPEC) {
 		i = getsockname(sp->fd, (void*)sp->mysockaddr, &sp->mysockaddrlen);
-		assert(TCP_Check(i));
+		assert(VTCP_Check(i));
 	}
 
 	return (sp->mysockaddr);
@@ -485,7 +485,7 @@ VRT_r_server_port(struct sess *sp)
 
 	if (sp->mysockaddr->ss_family == AF_UNSPEC)
 		AZ(getsockname(sp->fd, (void*)sp->mysockaddr, &sp->mysockaddrlen));
-	return (TCP_port(sp->mysockaddr));
+	return (VTCP_port(sp->mysockaddr));
 }
 
 /*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/cache_waiter_epoll.c b/bin/varnishd/cache_waiter_epoll.c
index 76d06f2..a44f8a0 100644
--- a/bin/varnishd/cache_waiter_epoll.c
+++ b/bin/varnishd/cache_waiter_epoll.c
@@ -193,7 +193,7 @@ vca_main(void *arg)
 			if (sp->t_open > deadline)
 				break;
 			VTAILQ_REMOVE(&sesshead, sp, list);
-			// XXX: not yet TCP_linger(sp->fd, 0);
+			// XXX: not yet VTCP_linger(sp->fd, 0);
 			vca_close_session(sp, "timeout");
 			SES_Delete(sp);
 		}
diff --git a/bin/varnishd/cache_waiter_kqueue.c b/bin/varnishd/cache_waiter_kqueue.c
index b185592..246680c 100644
--- a/bin/varnishd/cache_waiter_kqueue.c
+++ b/bin/varnishd/cache_waiter_kqueue.c
@@ -194,7 +194,7 @@ vca_kqueue_main(void *arg)
 			if (sp->t_open > deadline)
 				break;
 			VTAILQ_REMOVE(&sesshead, sp, list);
-			// XXX: not yet (void)TCP_linger(sp->fd, 0);
+			// XXX: not yet (void)VTCP_linger(sp->fd, 0);
 			vca_close_session(sp, "timeout");
 			SES_Delete(sp);
 		}
diff --git a/bin/varnishd/cache_waiter_poll.c b/bin/varnishd/cache_waiter_poll.c
index 6635cf2..cef0513 100644
--- a/bin/varnishd/cache_waiter_poll.c
+++ b/bin/varnishd/cache_waiter_poll.c
@@ -162,7 +162,7 @@ vca_main(void *arg)
 			} else if (sp->t_open <= deadline) {
 				VTAILQ_REMOVE(&sesshead, sp, list);
 				vca_unpoll(fd);
-				// XXX: not yet (void)TCP_linger(sp->fd, 0);
+				// XXX: not yet (void)VTCP_linger(sp->fd, 0);
 				vca_close_session(sp, "timeout");
 				SES_Delete(sp);
 			}
diff --git a/bin/varnishd/mgt_child.c b/bin/varnishd/mgt_child.c
index 863e86b..4dc5c67 100644
--- a/bin/varnishd/mgt_child.c
+++ b/bin/varnishd/mgt_child.c
@@ -241,8 +241,8 @@ open_sockets(void)
 		 * closes before we call accept(2) and nobody else are in
 		 * the listen queue to release us.
 		 */
-		(void)TCP_nonblocking(ls->sock);
-		(void)TCP_filter_http(ls->sock);
+		(void)VTCP_nonblocking(ls->sock);
+		(void)VTCP_filter_http(ls->sock);
 		good++;
 	}
 	if (!good)
diff --git a/bin/varnishd/mgt_cli.c b/bin/varnishd/mgt_cli.c
index 7923ba4..360bd03 100644
--- a/bin/varnishd/mgt_cli.c
+++ b/bin/varnishd/mgt_cli.c
@@ -420,13 +420,13 @@ sock_id(const char *pfx, int fd)
 {
 	struct vsb *vsb;
 
-	char abuf1[TCP_ADDRBUFSIZE], abuf2[TCP_ADDRBUFSIZE];
-	char pbuf1[TCP_PORTBUFSIZE], pbuf2[TCP_PORTBUFSIZE];
+	char abuf1[VTCP_ADDRBUFSIZE], abuf2[VTCP_ADDRBUFSIZE];
+	char pbuf1[VTCP_PORTBUFSIZE], pbuf2[VTCP_PORTBUFSIZE];
 
 	vsb = VSB_new_auto();
 	AN(vsb);
-	TCP_myname(fd, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1);
-	TCP_hisname(fd, abuf2, sizeof abuf2, pbuf2, sizeof pbuf2);
+	VTCP_myname(fd, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1);
+	VTCP_hisname(fd, abuf2, sizeof abuf2, pbuf2, sizeof pbuf2);
 	VSB_printf(vsb, "%s %s %s %s %s", pfx, abuf2, pbuf2, abuf1, pbuf1);
 	AZ(VSB_finish(vsb));
 	return (vsb);
@@ -528,8 +528,8 @@ mgt_cli_telnet(const char *T_arg)
 	struct telnet *tn;
 	char *p;
 	struct vsb *vsb;
-	char abuf[TCP_ADDRBUFSIZE];
-	char pbuf[TCP_PORTBUFSIZE];
+	char abuf[VTCP_ADDRBUFSIZE];
+	char pbuf[VTCP_PORTBUFSIZE];
 
 	n = VSS_resolve(T_arg, NULL, &ta);
 	if (n == 0) {
@@ -543,7 +543,7 @@ mgt_cli_telnet(const char *T_arg)
 		sock = VSS_listen(ta[i], 10);
 		if (sock < 0)
 			continue;
-		TCP_myname(sock, abuf, sizeof abuf, pbuf, sizeof pbuf);
+		VTCP_myname(sock, abuf, sizeof abuf, pbuf, sizeof pbuf);
 		VSB_printf(vsb, "%s %s\n", abuf, pbuf);
 		good++;
 		tn = telnet_new(sock);
diff --git a/bin/varnishtest/vtc_client.c b/bin/varnishtest/vtc_client.c
index 4f3e984..158d044 100644
--- a/bin/varnishtest/vtc_client.c
+++ b/bin/varnishtest/vtc_client.c
@@ -99,13 +99,13 @@ client_thread(void *priv)
 		if (fd < 0)
 			vtc_log(c->vl, 0, "Failed to open %s", VSB_data(vsb));
 		assert(fd >= 0);
-		TCP_blocking(fd);
-		TCP_myname(fd, mabuf, sizeof mabuf, mpbuf, sizeof mpbuf);
+		VTCP_blocking(fd);
+		VTCP_myname(fd, mabuf, sizeof mabuf, mpbuf, sizeof mpbuf);
 		vtc_log(vl, 3, "connected fd %d from %s %s to %s",
 		    fd, mabuf, mpbuf, VSB_data(vsb));
 		http_process(vl, c->spec, fd, -1);
 		vtc_log(vl, 3, "closing fd %d", fd);
-		TCP_close(&fd);
+		VTCP_close(&fd);
 	}
 	vtc_log(vl, 2, "Ending");
 	VSB_delete(vsb);
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index ddd0a8a..2e6a945 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -1029,7 +1029,7 @@ cmd_http_accept(CMD_ARGS)
 	CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
 	AZ(av[1]);
 	assert(hp->sfd >= 0);
-	TCP_close(&hp->fd);
+	VTCP_close(&hp->fd);
 	vtc_log(vl, 4, "Accepting");
 	hp->fd = accept(hp->sfd, NULL, NULL);
 	if (hp->fd < 0)
diff --git a/bin/varnishtest/vtc_server.c b/bin/varnishtest/vtc_server.c
index 5f88904..28d3b8f 100644
--- a/bin/varnishtest/vtc_server.c
+++ b/bin/varnishtest/vtc_server.c
@@ -103,9 +103,9 @@ server_thread(void *priv)
 		http_process(vl, s->spec, fd, s->sock);
 		vtc_log(vl, 3, "shutting fd %d", fd);
 		j = shutdown(fd, SHUT_WR);
-		if (!TCP_Check(j))
+		if (!VTCP_Check(j))
 			vtc_log(vl, 0, "Shutdown failed: %s", strerror(errno));
-		TCP_close(&fd);
+		VTCP_close(&fd);
 	}
 	vtc_log(vl, 2, "Ending");
 	return (NULL);
@@ -176,7 +176,7 @@ server_start(struct server *s)
 			    s->listen, naddr);
 		s->sock = VSS_listen(s->vss_addr[0], s->depth);
 		assert(s->sock >= 0);
-		TCP_myname(s->sock, s->aaddr, sizeof s->aaddr,
+		VTCP_myname(s->sock, s->aaddr, sizeof s->aaddr,
 		    s->aport, sizeof s->aport);
 		macro_def(s->vl, s->name, "addr", "%s", s->aaddr);
 		macro_def(s->vl, s->name, "port", "%s", s->aport);
@@ -206,7 +206,7 @@ server_wait(struct server *s)
 		vtc_log(s->vl, 0, "Server returned \"%p\"",
 		    (char *)res);
 	s->tp = 0;
-	TCP_close(&s->sock);
+	VTCP_close(&s->sock);
 	s->sock = -1;
 	s->run = 0;
 }
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index fb99657..856d872 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -203,7 +203,7 @@ varnish_thread(void *priv)
 	int i;
 
 	CAST_OBJ_NOTNULL(v, priv, VARNISH_MAGIC);
-	(void)TCP_nonblocking(v->fds[0]);
+	(void)VTCP_nonblocking(v->fds[0]);
 	while (1) {
 		fds = &fd;
 		memset(fds, 0, sizeof fds);
@@ -245,7 +245,7 @@ varnish_launch(struct varnish *v)
 	nap = VSS_resolve("127.0.0.1", "0", &ap);
 	AN(nap);
 	v->cli_fd = VSS_listen(ap[0], 1);
-	TCP_myname(v->cli_fd, abuf, sizeof abuf, pbuf, sizeof pbuf);
+	VTCP_myname(v->cli_fd, abuf, sizeof abuf, pbuf, sizeof pbuf);
 
 	AZ(VSB_finish(v->args));
 	vtc_log(v->vl, 2, "Launch");
diff --git a/include/libvarnish.h b/include/libvarnish.h
index a1cfaa8..fb1241c 100644
--- a/include/libvarnish.h
+++ b/include/libvarnish.h
@@ -53,36 +53,36 @@ int SUB_run(struct vsb *sb, sub_func_f *func, void *priv, const char *name,
 
 /* from libvarnish/tcp.c */
 /* NI_MAXHOST and NI_MAXSERV are ridiculously long for numeric format */
-#define TCP_ADDRBUFSIZE		64
-#define TCP_PORTBUFSIZE		16
+#define VTCP_ADDRBUFSIZE		64
+#define VTCP_PORTBUFSIZE		16
 
 #if (defined (__SVR4) && defined (__sun)) || defined (__NetBSD__)
 /*
  * Solaris returns EINVAL if the other end unexepectedly reset the
  * connection.  This is a bug in Solaris and documented behaviour on NetBSD.
  */
-#define TCP_Check(a) ((a) == 0 || errno == ECONNRESET || errno == ENOTCONN \
+#define VTCP_Check(a) ((a) == 0 || errno == ECONNRESET || errno == ENOTCONN \
     || errno == EINVAL)
 #else
-#define TCP_Check(a) ((a) == 0 || errno == ECONNRESET || errno == ENOTCONN)
+#define VTCP_Check(a) ((a) == 0 || errno == ECONNRESET || errno == ENOTCONN)
 #endif
 
-#define TCP_Assert(a) assert(TCP_Check(a))
+#define VTCP_Assert(a) assert(VTCP_Check(a))
 
-void TCP_myname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen);
-void TCP_hisname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen);
-int TCP_filter_http(int sock);
-int TCP_blocking(int sock);
-int TCP_nonblocking(int sock);
-int TCP_linger(int sock, int linger);
+void VTCP_myname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen);
+void VTCP_hisname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen);
+int VTCP_filter_http(int sock);
+int VTCP_blocking(int sock);
+int VTCP_nonblocking(int sock);
+int VTCP_linger(int sock, int linger);
 #ifdef SOL_SOCKET
-int TCP_port(const struct sockaddr_storage *addr);
-void TCP_name(const struct sockaddr_storage *addr, unsigned l, char *abuf,
+int VTCP_port(const struct sockaddr_storage *addr);
+void VTCP_name(const struct sockaddr_storage *addr, unsigned l, char *abuf,
     unsigned alen, char *pbuf, unsigned plen);
-int TCP_connect(int s, const struct sockaddr_storage *name, socklen_t namelen,
+int VTCP_connect(int s, const struct sockaddr_storage *name, socklen_t namelen,
     int msec);
-void TCP_close(int *s);
-void TCP_set_read_timeout(int s, double seconds);
+void VTCP_close(int *s);
+void VTCP_set_read_timeout(int s, double seconds);
 #endif
 
 /* from libvarnish/time.c */
diff --git a/lib/libvarnish/tcp.c b/lib/libvarnish/tcp.c
index 9e132f3..58c61c6 100644
--- a/lib/libvarnish/tcp.c
+++ b/lib/libvarnish/tcp.c
@@ -58,7 +58,7 @@
 /*--------------------------------------------------------------------*/
 
 int
-TCP_port(const struct sockaddr_storage *addr)
+VTCP_port(const struct sockaddr_storage *addr)
 {
 
 	if (addr->ss_family == AF_INET) {
@@ -76,7 +76,7 @@ TCP_port(const struct sockaddr_storage *addr)
 /*--------------------------------------------------------------------*/
 
 void
-TCP_name(const struct sockaddr_storage *addr, unsigned l,
+VTCP_name(const struct sockaddr_storage *addr, unsigned l,
     char *abuf, unsigned alen, char *pbuf, unsigned plen)
 {
 	int i;
@@ -104,26 +104,26 @@ TCP_name(const struct sockaddr_storage *addr, unsigned l,
 /*--------------------------------------------------------------------*/
 
 void
-TCP_myname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen)
+VTCP_myname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen)
 {
 	struct sockaddr_storage addr_s;
 	socklen_t l;
 
 	l = sizeof addr_s;
 	AZ(getsockname(sock, (void *)&addr_s, &l));
-	TCP_name(&addr_s, l, abuf, alen, pbuf, plen);
+	VTCP_name(&addr_s, l, abuf, alen, pbuf, plen);
 }
 /*--------------------------------------------------------------------*/
 
 void
-TCP_hisname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen)
+VTCP_hisname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen)
 {
 	struct sockaddr_storage addr_s;
 	socklen_t l;
 
 	l = sizeof addr_s;
 	if (!getpeername(sock, (void*)&addr_s, &l))
-		TCP_name(&addr_s, l, abuf, alen, pbuf, plen);
+		VTCP_name(&addr_s, l, abuf, alen, pbuf, plen);
 	else {
 		(void)snprintf(abuf, alen, "<none>");
 		(void)snprintf(pbuf, plen, "<none>");
@@ -133,7 +133,7 @@ TCP_hisname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen)
 /*--------------------------------------------------------------------*/
 
 int
-TCP_filter_http(int sock)
+VTCP_filter_http(int sock)
 {
 #ifdef HAVE_ACCEPT_FILTERS
 	struct accept_filter_arg afa;
@@ -151,7 +151,7 @@ TCP_filter_http(int sock)
 	return (i);
 #elif defined(__linux)
 	int defer = 1;
-	setsockopt(sock, SOL_TCP,TCP_DEFER_ACCEPT,(char *) &defer, sizeof(int));
+	setsockopt(sock, SOL_TCP,VTCP_DEFER_ACCEPT,(char *) &defer, sizeof(int));
 	return (0);
 #else
 	(void)sock;
@@ -169,24 +169,24 @@ TCP_filter_http(int sock)
  */
 
 int
-TCP_blocking(int sock)
+VTCP_blocking(int sock)
 {
 	int i, j;
 
 	i = 0;
 	j = ioctl(sock, FIONBIO, &i);
-	TCP_Assert(j);
+	VTCP_Assert(j);
 	return (j);
 }
 
 int
-TCP_nonblocking(int sock)
+VTCP_nonblocking(int sock)
 {
 	int i, j;
 
 	i = 1;
 	j = ioctl(sock, FIONBIO, &i);
-	TCP_Assert(j);
+	VTCP_Assert(j);
 	return (j);
 }
 
@@ -201,7 +201,7 @@ TCP_nonblocking(int sock)
  */
 
 int
-TCP_connect(int s, const struct sockaddr_storage *name, socklen_t namelen, int msec)
+VTCP_connect(int s, const struct sockaddr_storage *name, socklen_t namelen, int msec)
 {
 	int i, k;
 	socklen_t l;
@@ -211,7 +211,7 @@ TCP_connect(int s, const struct sockaddr_storage *name, socklen_t namelen, int m
 
 	/* Set the socket non-blocking */
 	if (msec > 0)
-		(void)TCP_nonblocking(s);
+		(void)VTCP_nonblocking(s);
 
 	/* Attempt the connect */
 	i = connect(s, (const void *)name, namelen);
@@ -240,7 +240,7 @@ TCP_connect(int s, const struct sockaddr_storage *name, socklen_t namelen, int m
 	if (k)
 		return (-1);
 
-	(void)TCP_blocking(s);
+	(void)VTCP_blocking(s);
 	return (0);
 }
 
@@ -250,18 +250,18 @@ TCP_connect(int s, const struct sockaddr_storage *name, socklen_t namelen, int m
  */
 
 void
-TCP_close(int *s)
+VTCP_close(int *s)
 {
 	int i;
 
 	i = close(*s);
 
-	assert (TCP_Check(i));
+	assert (VTCP_Check(i));
 	*s = -1;
 }
 
 void
-TCP_set_read_timeout(int s, double seconds)
+VTCP_set_read_timeout(int s, double seconds)
 {
 	struct timeval timeout;
 	timeout.tv_sec = (int)floor(seconds);
@@ -278,7 +278,7 @@ TCP_set_read_timeout(int s, double seconds)
  */
 
 int
-TCP_linger(int sock, int linger)
+VTCP_linger(int sock, int linger)
 {
 	struct linger lin;
 	int i;
@@ -286,6 +286,6 @@ TCP_linger(int sock, int linger)
 	memset(&lin, 0, sizeof lin);
 	lin.l_onoff = linger;
 	i = setsockopt(sock, SOL_SOCKET, SO_LINGER, &lin, sizeof lin);
-	TCP_Assert(i);
+	VTCP_Assert(i);
 	return (i);
 }
diff --git a/lib/libvarnish/vss.c b/lib/libvarnish/vss.c
index 43f3e4a..85ec2f3 100644
--- a/lib/libvarnish/vss.c
+++ b/lib/libvarnish/vss.c
@@ -261,7 +261,7 @@ VSS_connect(const struct vss_addr *va, int nonblock)
 		return (-1);
 	}
 	if (nonblock)
-		(void)TCP_nonblocking(sd);
+		(void)VTCP_nonblocking(sd);
 	i = connect(sd, (const void *)&va->va_addr, va->va_addrlen);
 	if (i == 0 || (nonblock && errno == EINPROGRESS))
 		return (sd);
diff --git a/lib/libvmod_std/vmod_std.c b/lib/libvmod_std/vmod_std.c
index 5a132ac..10acc5e 100644
--- a/lib/libvmod_std/vmod_std.c
+++ b/lib/libvmod_std/vmod_std.c
@@ -40,7 +40,7 @@ void __match_proto__()
 vmod_set_ip_tos(struct sess *sp, int tos)
 {
 
-	TCP_Assert(setsockopt(sp->fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)));
+	VTCP_Assert(setsockopt(sp->fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)));
 }
 
 static const char * __match_proto__()



More information about the varnish-commit mailing list