Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,10 @@ else
fi
AC_SUBST(VARNISH_STATE_DIR)

# Default relative name for working directory
VARNISH_DEFAULT_REL_NAME='varnishd'
AC_SUBST(VARNISH_DEFAULT_REL_NAME)

# Default configuration directory.
pkgsysconfdir='${sysconfdir}/varnish'
AC_SUBST(pkgsysconfdir)
Expand Down Expand Up @@ -931,6 +935,7 @@ AC_CONFIG_FILES([
doc/sphinx/conf.py
etc/Makefile
include/Makefile
include/vapi/workdir.h
lib/Makefile
lib/libvsc/Makefile
lib/libvarnish/Makefile
Expand Down
1 change: 1 addition & 0 deletions include/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ nobase_pkginclude_HEADERS = \
vapi/vsm.h \
vapi/voptget.h \
vapi/vapi_options.h \
vapi/workdir.h \
vcli.h \
vut.h \
vut_options.h
Expand Down
49 changes: 49 additions & 0 deletions include/vapi/workdir.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*-
* Copyright (c) 2026 Varnish Software AS
* All rights reserved.
*
* Author: Guillaume Quintard <guillaume.quintard@varnish-software.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*
* 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 THE 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.
*
* Varnish working directory paths
*/

/**
* VARNISH_STATE_DIR - Default state directory
*
* The default directory where Varnish stores runtime state files.
* This is configured at build time and typically points to /var/run
* or ${localstatedir}/varnish depending on the installation.
*/
#define VARNISH_STATE_DIR "@VARNISH_STATE_DIR@"

/**
* VARNISH_DEFAULT_REL_NAME - Default relative name
*
* The default relative name used for Varnish instance directories.
* This is used as the default -n argument when constructing working
* directory paths.
*/
#define VARNISH_DEFAULT_REL_NAME "@VARNISH_DEFAULT_REL_NAME@"
1 change: 0 additions & 1 deletion lib/libvarnish/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ AM_LDFLAGS = $(AM_LT_LDFLAGS)
noinst_LTLIBRARIES = libvarnish.la

libvarnish_la_CFLAGS = \
-DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' \
$(AM_CFLAGS)

libvarnish_la_SOURCES = \
Expand Down
2 changes: 1 addition & 1 deletion lib/libvarnish/vin.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include "vin.h"
#include "vsb.h"

#define VARNISH_DEFAULT_REL_NAME "varnishd"
#include "vapi/workdir.h"

char *
VIN_n_Arg(const char *n_arg)
Expand Down
3 changes: 0 additions & 3 deletions lib/libvarnishapi/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ if ! HAVE_DAEMON
libvarnishapi_la_SOURCES += daemon.c
endif

libvarnishapi_la_CFLAGS = \
-DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"'

libvarnishapi_la_LIBADD = \
$(top_builddir)/lib/libvarnish/libvarnish.la \
${NET_LIBS} ${RT_LIBS} ${LIBM}
Expand Down