r10 - in trunk: . varnish-proto

des at projects.linpro.no des at projects.linpro.no
Wed Feb 22 15:38:21 CET 2006


Author: des
Date: 2006-02-22 15:38:21 +0100 (Wed, 22 Feb 2006)
New Revision: 10

Added:
   trunk/varnish-proto/LICENSE
   trunk/varnish-proto/Makefile.am
   trunk/varnish-proto/autogen.sh
   trunk/varnish-proto/configure.ac
   trunk/varnish-proto/connection.c
   trunk/varnish-proto/connection.h
   trunk/varnish-proto/listener.c
   trunk/varnish-proto/listener.h
   trunk/varnish-proto/log.c
   trunk/varnish-proto/log.h
   trunk/varnish-proto/request.c
   trunk/varnish-proto/request.h
   trunk/varnish-proto/system-common.c
   trunk/varnish-proto/system-freebsd.c
   trunk/varnish-proto/system-freebsd5.0.c
   trunk/varnish-proto/system-freebsd6.0.c
   trunk/varnish-proto/system-freebsd7.0.c
   trunk/varnish-proto/system-linux-gnu.c
   trunk/varnish-proto/system.h
   trunk/varnish-proto/varnish.c
   trunk/varnish-proto/varnish.h
Removed:
   trunk/LICENSE
   trunk/Makefile.am
   trunk/autogen.sh
   trunk/configure.ac
   trunk/connection.c
   trunk/connection.h
   trunk/listener.c
   trunk/listener.h
   trunk/log.c
   trunk/log.h
   trunk/request.c
   trunk/request.h
   trunk/system-common.c
   trunk/system-freebsd.c
   trunk/system-freebsd5.0.c
   trunk/system-freebsd6.0.c
   trunk/system-freebsd7.0.c
   trunk/system-linux-gnu.c
   trunk/system.h
   trunk/varnish.c
   trunk/varnish.h
Modified:
   trunk/varnish-proto/
Log:
Move prototype code into varnish-proto.

Deleted: trunk/LICENSE
===================================================================
--- trunk/LICENSE	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/LICENSE	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,24 +0,0 @@
-Copyright (c) 2006 Verdens Gang AS
-Copyright (c) 2006 Linpro AS
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.

Deleted: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/Makefile.am	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,12 +0,0 @@
-# $Id$
-
-bin_PROGRAMS = varnish
-
-varnish_SOURCES = \
-	connection.c \
-	listener.c \
-	log.c \
-	request.c \
-	system-common.c \
-	system- at target_os@.c \
-	varnish.c

Deleted: trunk/autogen.sh
===================================================================
--- trunk/autogen.sh	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/autogen.sh	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,9 +0,0 @@
-#!/bin/sh
-#
-# $Id$
-#
-
-aclocal
-autoheader
-automake --add-missing --copy --force --foreign
-autoconf

Deleted: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/configure.ac	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,66 +0,0 @@
-# $Id$
-
-AC_PREREQ(2.59)
-AC_COPYRIGHT([Copyright (c) 2006 Linpro AS])
-AC_REVISION([$Id$])
-AC_INIT([Varnish], [0.1], [varnish-dev at projects.linpro.no])
-AC_CONFIG_SRCDIR([varnish.c])
-AC_CONFIG_HEADER([config.h])
-
-AC_CANONICAL_SYSTEM
-AC_LANG(C)
-
-AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
-
-# Compiler flags (assume GCC).
-# This section *must* come before AC_PROG_CC / AC_PROG_CPP.
-CFLAGS="${CFLAGS:--O2}"
-AC_ARG_ENABLE(wall,
-	AS_HELP_STRING([--enable-wall],[use -Wall (default is NO)]),
-	CFLAGS="${CFLAGS} -Wall")
-AC_ARG_ENABLE(pedantic,
-	AS_HELP_STRING([--enable-pedantic],[enable pedantic warnings (default is NO)]),
-	CFLAGS="${CFLAGS} -pedantic")
-AC_ARG_ENABLE(werror,
-	AS_HELP_STRING([--enable-werror],[use -Werror (default is NO)]),
-	CFLAGS="${CFLAGS} -Werror")
-
-# Checks for programs.
-AC_PROG_CC
-AC_PROG_CPP
-AC_PROG_INSTALL
-AC_PROG_MAKE_SET
-
-# Checks for libraries.
-
-# Checks for header files.
-AC_HEADER_STDC
-AC_HEADER_SYS_WAIT
-AC_HEADER_TIME
-AC_CHECK_HEADERS([sys/socket.h])
-AC_CHECK_HEADERS([netinet/in.h])
-AC_CHECK_HEADERS([stddef.h])
-AC_CHECK_HEADERS([stdlib.h])
-AC_CHECK_HEADERS([unistd.h])
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,[
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-])
-
-# Checks for library functions.
-AC_TYPE_SIGNAL
-AC_TYPE_SIZE_T
-AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([strerror])
-AC_FUNC_STRERROR_R
-AC_CHECK_FUNCS([socket])
-
-AC_CONFIG_FILES([
-    Makefile
-])
-AC_OUTPUT

Deleted: trunk/connection.c
===================================================================
--- trunk/connection.c	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/connection.c	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,80 +0,0 @@
-/*
- * $Id$
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <netinet/in.h>
-
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "varnish.h"
-#include "log.h"
-#include "connection.h"
-
-struct connection {
-	int sd;
-	struct sockaddr_storage addr;
-};
-
-/*
- * Accepts a connection from the provided listening descriptor.  Does not
- * loop to handle EINTR or other similar conditions.
- */
-connection_t *
-connection_accept(int ld)
-{
-	connection_t *c;
-	socklen_t len;
-
-	if ((c = calloc(1, sizeof *c)) == NULL)
-		return (NULL);
-
-	len = sizeof c->addr;
-	if ((c->sd = accept(ld, (struct sockaddr *)&c->addr, &len)) == -1) {
-		free(c);
-		return (NULL);
-	}
-	switch (c->addr.ss_family) {
-#if defined(AF_INET6)
-	case AF_INET6: {
-		struct sockaddr_in6 *addr =
-		    (struct sockaddr_in6 *)&c->addr;
-		uint16_t *ip = (uint16_t *)&addr->sin6_addr;
-
-		log_info("%s(): [%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]:%u",
-		    __func__,
-		    ntohs(ip[0]), ntohs(ip[1]),
-		    ntohs(ip[2]), ntohs(ip[3]),
-		    ntohs(ip[4]), ntohs(ip[5]),
-		    ntohs(ip[6]), ntohs(ip[7]),
-		    ntohs(addr->sin6_port));
-		break;
-	}
-#endif
-	case AF_INET: {
-		struct sockaddr_in *addr =
-		    (struct sockaddr_in *)&c->addr;
-		uint8_t *ip = (uint8_t *)&addr->sin_addr;
-
-		log_info("%s(): %u.%u.%u.%u:%u",
-		    __func__,
-		    ip[0], ip[1], ip[2], ip[3],
-		    ntohs(addr->sin_port));
-		break;
-	}
-	default:
-		LOG_UNREACHABLE();
-	}
-	return (c);
-}
-
-void
-connection_destroy(struct connection *c)
-{
-	close(c->sd);
-	/* bzero(c, sizeof *c); */
-	free(c);
-}

Deleted: trunk/connection.h
===================================================================
--- trunk/connection.h	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/connection.h	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,13 +0,0 @@
-/*
- * $Id$
- */
-
-#ifndef CONNECTION_H_INCLUDED
-#define CONNECTION_H_INCLUDED
-
-typedef struct connection connection_t;
-
-connection_t *connection_accept(int ld);
-void connection_destroy(connection_t *c);
-
-#endif

Deleted: trunk/listener.c
===================================================================
--- trunk/listener.c	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/listener.c	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,106 +0,0 @@
-/*
- * $Id$
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <netinet/in.h>
-
-#include <errno.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "varnish.h"
-#include "connection.h"
-#include "listener.h"
-#include "log.h"
-
-struct listener {
-	int sd;
-	struct sockaddr_storage addr;
-};
-
-/*
- * Create a socket that listens on the specified port.  We use an IPv6 TCP
- * socket and clear the IPV6_V6ONLY option to accept IPv4 connections on
- * the same socket.
- */
-struct listener *
-listener_create(int port)
-{
-	struct listener *l;
-	socklen_t addr_len;
-	int zero = 0;
-
-	l = calloc(1, sizeof *l);
-	if (l == NULL) {
-		log_syserr("calloc()");
-		return (NULL);
-	}
-	l->sd = -1;
-#if defined(AF_INET6) && defined(IPV6_V6ONLY)
-	if ((l->sd = socket(AF_INET6, SOCK_STREAM, 0)) > 0) {
-		struct sockaddr_in6 *addr = (struct sockaddr_in6 *)&l->addr;
-#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
-		addr->sin6_len =
-#endif
-		addr_len = sizeof *addr;
-		addr->sin6_family = AF_INET6;
-		addr->sin6_port = htons(port);
-		if (setsockopt(l->sd, IPPROTO_IPV6, IPV6_V6ONLY, &zero, sizeof zero) != 0) {
-			log_syserr("setsockopt()");
-			return (NULL);
-		}
-	} else if (errno != EPROTONOSUPPORT) {
-		log_syserr("socket()");
-		return (NULL);
-	} else
-#endif
-	if ((l->sd = socket(AF_INET, SOCK_STREAM, 0)) > 0) {
-		struct sockaddr_in *addr = (struct sockaddr_in *)&l->addr;
-#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
-		addr->sin_len =
-#endif
-		addr_len = sizeof *addr;
-		addr->sin_family = AF_INET;
-		addr->sin_port = htons(port);
-	} else {
-		log_syserr("socket()");
-		return (NULL);
-	}
-	if (bind(l->sd, (struct sockaddr *)&l->addr, addr_len) != 0) {
-		log_syserr("bind()");
-		return (NULL);
-	}
-	if (listen(l->sd, 16) != 0) {
-		log_syserr("listen()");
-		return (NULL);
-	}
-	return (l);
-}
-
-void
-listener_destroy(struct listener *l)
-{
-	close(l->sd);
-	/* bzero(l, sizeof *l); */
-	free(l);
-}
-
-connection_t *
-listener_accept(struct listener *l)
-{
-	connection_t *c;
-
-	for (;;) {
-		if ((c = connection_accept(l->sd)) != NULL)
-			return (c);
-		if (errno != EINTR) {
-			log_syserr("accept()");
-			free(c);
-			return (NULL);
-		}
-	}
-}

Deleted: trunk/listener.h
===================================================================
--- trunk/listener.h	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/listener.h	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,16 +0,0 @@
-/*
- * $Id$
- */
-
-#ifndef LISTENER_H_INCLUDED
-#define LISTENER_H_INCLUDED
-
-#include "connection.h"
-
-typedef struct listener listener_t;
-
-listener_t *listener_create(int port);
-void listener_destroy(listener_t *l);
-connection_t *listener_accept(listener_t *l);
-
-#endif

Deleted: trunk/log.c
===================================================================
--- trunk/log.c	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/log.c	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,116 +0,0 @@
-/*
- * $Id$
- */
-
-#include <sys/types.h>
-#include <sys/signal.h>
-#include <sys/time.h>
-
-#include <errno.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#ifdef TIME_WITH_SYS_TIME
-#include <time.h>
-#endif
-#include <unistd.h>
-
-#include "varnish.h"
-#include "log.h"
-#include "system.h"
-
-static void
-timestamp(void)
-{
-	struct timeval now;
-
-	if (gettimeofday(&now, NULL) == -1)
-		now.tv_sec = now.tv_usec = 0;
-	fprintf(stderr, "%lu.%06lu [%lu] ",
-	    (unsigned long)now.tv_sec,
-	    (unsigned long)now.tv_usec,
-	    (unsigned long)sys.pid);
-}
-
-static void
-emit(const char *fmt, va_list ap)
-{
-	timestamp();
-	vfprintf(stderr, fmt, ap);
-	fprintf(stderr, "\n");
-}
-
-static void
-sysemit(const char *fmt, va_list ap)
-{
-	char errstr[64];
-
-#if defined(HAVE_STRERROR_R)
-	strerror_r(errno, errstr, sizeof errstr);
-#else
-	snprintf(errstr, sizeof errstr, "%s", strerror(errno));
-#endif
-	timestamp();
-	vfprintf(stderr, fmt, ap);
-	fprintf(stderr, ": %s\n", errstr);
-}
-
-static void
-panic(void)
-{
-	signal(SIGABRT, SIG_DFL);
-	kill(getpid(), SIGABRT);
-}
-
-void
-log_info(const char *fmt, ...)
-{
-	va_list ap;
-
-	va_start(ap, fmt);
-	emit(fmt, ap);
-	va_end(ap);
-}
-
-void
-log_err(const char *fmt, ...)
-{
-	va_list ap;
-
-	va_start(ap, fmt);
-	emit(fmt, ap);
-	va_end(ap);
-}
-
-void
-log_syserr(const char *fmt, ...)
-{
-	va_list ap;
-
-	va_start(ap, fmt);
-	sysemit(fmt, ap);
-	va_end(ap);
-}
-
-void
-log_panic(const char *fmt, ...)
-{
-	va_list ap;
-
-	va_start(ap, fmt);
-	emit(fmt, ap);
-	va_end(ap);
-	panic();
-}
-
-void
-log_syspanic(const char *fmt, ...)
-{
-	va_list ap;
-
-	va_start(ap, fmt);
-	sysemit(fmt, ap);
-	va_end(ap);
-	panic();
-}

Deleted: trunk/log.h
===================================================================
--- trunk/log.h	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/log.h	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,19 +0,0 @@
-/*
- * $Id$
- */
-
-#ifndef LOG_H_INCLUDED
-#define LOG_H_INCLUDED
-
-
-void log_info(const char *fmt, ...);
-void log_err(const char *fmt, ...);
-void log_syserr(const char *fmt, ...);
-void log_panic(const char *fmt, ...);
-void log_syspanic(const char *fmt, ...);
-
-#define LOG_UNREACHABLE() \
-	log_panic("%s(%d): %s(): unreachable code reached", \
-	    __FILE__, __LINE__, __func__)
-
-#endif

Deleted: trunk/request.c
===================================================================
--- trunk/request.c	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/request.c	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,37 +0,0 @@
-/*
- * $Id$
- */
-
-#include <stdlib.h>
-
-#include "varnish.h"
-#include "connection.h"
-#include "log.h"
-#include "request.h"
-
-struct request {
-	connection_t *conn;
-};
-
-request_t *
-request_wait(connection_t *c, unsigned int timeout)
-{
-	request_t *r;
-
-	r = calloc(1, sizeof *r);
-	if (r == NULL) {
-		log_syserr("calloc()");
-		return (NULL);
-	}
-
-	/* ... */
-
-	return (r);
-}
-
-void
-request_destroy(request_t *r)
-{
-	/* bzero(r, sizeof *r); */
-	free(r);
-}

Deleted: trunk/request.h
===================================================================
--- trunk/request.h	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/request.h	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,13 +0,0 @@
-/*
- * $Id$
- */
-
-#ifndef REQUEST_H_INCLUDED
-#define REQUEST_H_INCLUDED
-
-typedef struct request request_t;
-
-request_t *request_wait(connection_t *c, unsigned int timeout);
-void request_destroy(request_t *r);
-
-#endif

Deleted: trunk/system-common.c
===================================================================
--- trunk/system-common.c	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/system-common.c	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,35 +0,0 @@
-/*
- * $Id$
- */
-
-#include <sys/types.h>
-
-#include <unistd.h>
-
-#include "varnish.h"
-#include "system.h"
-
-system_t sys;
-
-/*
- * gather system information at startup
- */
-void
-system_init(void)
-{
-	sys.pid = getpid();
-	system_init_ncpu();
-}
-
-/*
- * fork() wrapper, updates sys.pid
- */
-pid_t
-system_fork(void)
-{
-	pid_t pid;
-
-	if ((pid = fork()) == 0)
-		sys.pid = getpid();
-	return (pid);
-}

Deleted: trunk/system-freebsd.c
===================================================================
--- trunk/system-freebsd.c	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/system-freebsd.c	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,21 +0,0 @@
-/*
- * $Id$
- */
-
-#include <sys/types.h>
-#include <sys/sysctl.h>
-
-#include "varnish.h"
-#include "log.h"
-#include "system.h"
-
-void
-system_init_ncpu(void)
-{
-	size_t size;
-
-	size = sizeof sys.ncpu;
-	if (sysctlbyname("hw.ncpu", &sys.ncpu, &size, 0, 0) == -1)
-		sys.ncpu = 1;
-	log_info("%d cpu(s)", sys.ncpu);
-}

Deleted: trunk/system-freebsd5.0.c
===================================================================
--- trunk/system-freebsd5.0.c	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/system-freebsd5.0.c	2006-02-22 14:38:21 UTC (rev 10)
@@ -1 +0,0 @@
-link system-freebsd.c
\ No newline at end of file

Deleted: trunk/system-freebsd6.0.c
===================================================================
--- trunk/system-freebsd6.0.c	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/system-freebsd6.0.c	2006-02-22 14:38:21 UTC (rev 10)
@@ -1 +0,0 @@
-link system-freebsd.c
\ No newline at end of file

Deleted: trunk/system-freebsd7.0.c
===================================================================
--- trunk/system-freebsd7.0.c	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/system-freebsd7.0.c	2006-02-22 14:38:21 UTC (rev 10)
@@ -1 +0,0 @@
-link system-freebsd.c
\ No newline at end of file

Deleted: trunk/system-linux-gnu.c
===================================================================
--- trunk/system-linux-gnu.c	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/system-linux-gnu.c	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,31 +0,0 @@
-/*
- * $Id$
- */
-
-#include <sys/types.h>
-
-#include <stdio.h>
-
-#include "varnish.h"
-#include "log.h"
-#include "system.h"
-
-void
-system_init_ncpu(void)
-{
-	FILE *cpuinfo;
-	char line[256];
-	int n;
-
-	sys.ncpu = 0;
-	if ((cpuinfo = fopen("/proc/cpuinfo", "r")) == NULL)
-		return;
-	while (fgets(line, sizeof line, cpuinfo) != NULL) {
-		if (sscanf(line, "processor : %d", &n) == 1)
-			sys.ncpu++;
-	}
-	fclose(cpuinfo);
-	if (sys.ncpu == 0)
-		sys.ncpu = 1;
-	log_info("%d cpu(s)", sys.ncpu);
-}

Deleted: trunk/system.h
===================================================================
--- trunk/system.h	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/system.h	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,21 +0,0 @@
-/*
- * $Id$
- */
-
-#ifndef SYSTEM_H_INCLUDED
-#define SYSTEM_H_INCLUDED
-
-typedef struct system system_t;
-
-struct system {
-	int ncpu;
-	pid_t pid;
-};
-
-extern system_t sys;
-
-void system_init_ncpu(void);
-void system_init(void);
-pid_t system_fork(void);
-
-#endif


Property changes on: trunk/varnish-proto
___________________________________________________________________
Name: svn:ignore
   + .deps
Makefile
Makefile.in
aclocal.m4
autom4te.cache
compile
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
depcomp
install-sh
missing
stamp-h1
varnish

Copied: trunk/varnish-proto/LICENSE (from rev 8, trunk/LICENSE)

Copied: trunk/varnish-proto/Makefile.am (from rev 6, trunk/Makefile.am)

Copied: trunk/varnish-proto/autogen.sh (from rev 3, trunk/autogen.sh)

Copied: trunk/varnish-proto/configure.ac (from rev 6, trunk/configure.ac)

Copied: trunk/varnish-proto/connection.c (from rev 6, trunk/connection.c)

Copied: trunk/varnish-proto/connection.h (from rev 6, trunk/connection.h)

Copied: trunk/varnish-proto/listener.c (from rev 6, trunk/listener.c)

Copied: trunk/varnish-proto/listener.h (from rev 6, trunk/listener.h)

Copied: trunk/varnish-proto/log.c (from rev 6, trunk/log.c)

Copied: trunk/varnish-proto/log.h (from rev 6, trunk/log.h)

Copied: trunk/varnish-proto/request.c (from rev 6, trunk/request.c)

Copied: trunk/varnish-proto/request.h (from rev 6, trunk/request.h)

Copied: trunk/varnish-proto/system-common.c (from rev 6, trunk/system-common.c)

Copied: trunk/varnish-proto/system-freebsd.c (from rev 7, trunk/system-freebsd.c)

Copied: trunk/varnish-proto/system-freebsd5.0.c (from rev 7, trunk/system-freebsd5.0.c)

Copied: trunk/varnish-proto/system-freebsd6.0.c (from rev 7, trunk/system-freebsd6.0.c)

Copied: trunk/varnish-proto/system-freebsd7.0.c (from rev 7, trunk/system-freebsd7.0.c)

Copied: trunk/varnish-proto/system-linux-gnu.c (from rev 6, trunk/system-linux-gnu.c)

Copied: trunk/varnish-proto/system.h (from rev 6, trunk/system.h)

Copied: trunk/varnish-proto/varnish.c (from rev 6, trunk/varnish.c)

Copied: trunk/varnish-proto/varnish.h (from rev 6, trunk/varnish.h)

Deleted: trunk/varnish.c
===================================================================
--- trunk/varnish.c	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/varnish.c	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,95 +0,0 @@
-/*
- * $Id$
- */
-
-#include <sys/wait.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "varnish.h"
-#include "connection.h"
-#include "listener.h"
-#include "log.h"
-#include "request.h"
-#include "system.h"
-
-static void
-varnish_child(listener_t *l)
-{
-	connection_t *c;
-	request_t *r;
-
-	while ((c = listener_accept(l)) != NULL) {
-		r = request_wait(c, 0);
-		/* ... */
-		request_destroy(r);
-		connection_destroy(c);
-	}
-	LOG_UNREACHABLE();
-}
-
-static void
-varnish(void)
-{
-	listener_t *l;
-	int i, status;
-	pid_t pid;
-
-	system_init();
-	log_info("starting Varnish");
-	l = listener_create(8080);
-	for (i = 0; i < sys.ncpu; ++i) {
-		switch ((pid = system_fork())) {
-		case -1:
-			log_panic("fork()");
-			break;
-		case 0:
-			varnish_child(l);
-			_exit(1);
-			break;
-		default:
-			log_info("forked child %lu", (unsigned long)pid);
-			break;
-		}
-	}
-	for (;;) {
-		if ((pid = wait(&status)) == -1) {
-			if (errno == ECHILD)
-				return;
-		} else {
-			log_info("child %lu exited", (unsigned long)pid);
-		}
-	}
-}
-
-static void
-usage(void)
-{
-	fprintf(stderr, "usage: varnish\n");
-	exit(1);
-}
-
-int
-main(int argc, char *argv[])
-{
-	int o;
-
-	while ((o = getopt(argc, argv, "")) != -1)
-		switch (o) {
-		default:
-			usage();
-		}
-
-	argc -= optind;
-	argv += optind;
-
-	if (argc != 0)
-		usage();
-
-	varnish();
-
-	exit(1);
-}

Deleted: trunk/varnish.h
===================================================================
--- trunk/varnish.h	2006-02-22 14:31:39 UTC (rev 9)
+++ trunk/varnish.h	2006-02-22 14:38:21 UTC (rev 10)
@@ -1,10 +0,0 @@
-/*
- * $Id$
- */
-
-#ifndef VARNISH_H_INCLUDED
-#define VARNISH_H_INCLUDED
-
-#include "config.h"
-
-#endif




More information about the varnish-commit mailing list