summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/lint-generic2
-rwxr-xr-xbuild-aux/linux-errno.txt.gen17
-rw-r--r--build-aux/measurestack/app_plugins.py52
-rwxr-xr-xbuild-aux/valgrind16
4 files changed, 35 insertions, 52 deletions
diff --git a/build-aux/lint-generic b/build-aux/lint-generic
index 290988c..70e814a 100755
--- a/build-aux/lint-generic
+++ b/build-aux/lint-generic
@@ -25,7 +25,7 @@ for filename in "$@"; do
if [ -x "$filename" ] && [ -z "$shebang" ]; then
err "$filename" 'is executable but does not have a shebang'
elif [ -n "$shebang" ] && ! [ -x "$filename" ]; then
- err "$filename" 'has a shebang but is executable'
+ err "$filename" 'has a shebang but is not executable'
fi
if ! grep -E -q 'Copyright \(C\) 202[4-9]((-|, )202[5-9])* Luke T. Shumaker' "$filename"; then
diff --git a/build-aux/linux-errno.txt.gen b/build-aux/linux-errno.txt.gen
deleted file mode 100755
index f94178f..0000000
--- a/build-aux/linux-errno.txt.gen
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env bash
-# build-aux/linux-errno.txt.gen - Generate a listing of Linux kernel errnos
-#
-# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
-# SPDX-License-Identifier: AGPL-3.0-or-later
-
-set -e
-linux_git=${1:?}
-outfile=${2:?}
-
-(
- cd "${linux_git}"
- echo "# ${outfile} - Generated from $0 and linux.git $(git describe). DO NOT EDIT!"
- git ls-files include/uapi/ | grep errno |
- xargs sed -nE 's,#\s*define\s+(E[A-Z0-9]+)\s+([0-9]+)\s+/\* (.*) \*/,\2 \1 \3,p' |
- sort --numeric-sort
-) >"${outfile}"
diff --git a/build-aux/measurestack/app_plugins.py b/build-aux/measurestack/app_plugins.py
index 6eeb35b..bbb0eae 100644
--- a/build-aux/measurestack/app_plugins.py
+++ b/build-aux/measurestack/app_plugins.py
@@ -4,6 +4,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
import re
+import subprocess
import typing
from . import analyze, util
@@ -271,9 +272,8 @@ re_lib9p_callee = re.compile(
class Lib9PPlugin:
tmessage_handlers: set[QName] | None
lib9p_msgs: set[str]
- _CONFIG_9P_NUM_SOCKS: int | None
- CONFIG_9P_SRV_MAX_REQS: int | None
- CONFIG_9P_SRV_MAX_DEPTH: int | None
+ _CONFIG_9P_MAX_CONNS: int | None
+ _CONFIG_9P_MAX_REQS: int | None
formatters: typing.Collection[BaseName]
def __init__(
@@ -305,25 +305,25 @@ class Lib9PPlugin:
)
lib9p_generated_c_fname = util.get_zero_or_one(
- lambda fname: fname.endswith("lib9p/9p.generated.c"), arg_c_fnames
+ lambda fname: fname.endswith("lib9p/_core_generated.c"), arg_c_fnames
)
# Read config ##########################################################
def config_h_get(varname: str) -> int | None:
if config_h_fname:
- with open(config_h_fname, "r", encoding="utf-8") as fh:
- for line in fh:
- line = line.rstrip()
- if line.startswith("#define"):
- parts = line.split()
- if parts[1] == varname:
- return int(parts[2])
+ line = subprocess.run(
+ ["cpp"],
+ input=f'#include "{config_h_fname}"\n{varname}\n',
+ check=True,
+ capture_output=True,
+ encoding="utf-8",
+ ).stdout.split("\n")[-2]
+ return int(eval(line)) # pylint: disable=eval-used
return None
- self._CONFIG_9P_NUM_SOCKS = config_h_get("_CONFIG_9P_NUM_SOCKS")
- self.CONFIG_9P_SRV_MAX_REQS = config_h_get("CONFIG_9P_SRV_MAX_REQS")
- self.CONFIG_9P_SRV_MAX_DEPTH = config_h_get("CONFIG_9P_SRV_MAX_DEPTH")
+ self._CONFIG_9P_MAX_CONNS = config_h_get("_CONFIG_9P_MAX_REQS")
+ self._CONFIG_9P_MAX_REQS = config_h_get("_CONFIG_9P_MAX_REQS")
# Read sources #########################################################
@@ -348,12 +348,12 @@ class Lib9PPlugin:
self.lib9p_msgs = lib9p_msgs
def thread_count(self, name: QName) -> int:
- assert self._CONFIG_9P_NUM_SOCKS
- assert self.CONFIG_9P_SRV_MAX_REQS
+ assert self._CONFIG_9P_MAX_CONNS
+ assert self._CONFIG_9P_MAX_REQS
if "read" in str(name.base()):
- return self._CONFIG_9P_NUM_SOCKS
+ return self._CONFIG_9P_MAX_CONNS
if "write" in str(name.base()):
- return self._CONFIG_9P_NUM_SOCKS * self.CONFIG_9P_SRV_MAX_REQS
+ return self._CONFIG_9P_MAX_REQS
return 1
def is_intrhandler(self, name: QName) -> bool:
@@ -405,11 +405,6 @@ class Lib9PPlugin:
self.formatters, self._skipmodel__vfctprintf
),
}
- if isinstance(self.CONFIG_9P_SRV_MAX_DEPTH, int):
- ret[BaseName("srv_util_pathfree")] = analyze.SkipModel(
- self.CONFIG_9P_SRV_MAX_DEPTH,
- self._skipmodel_srv_util_pathfree,
- )
return ret
def _skipmodel__lib9p_validate_unmarshal_marshal(
@@ -423,17 +418,6 @@ class Lib9PPlugin:
return False
return m_caller.group("grp") != m_callee.group("grp")
- def _skipmodel_srv_util_pathfree(
- self, chain: typing.Sequence[QName], call: QName
- ) -> bool:
- assert isinstance(self.CONFIG_9P_SRV_MAX_DEPTH, int)
- if call.base() == BaseName("srv_util_pathfree"):
- return len(chain) >= self.CONFIG_9P_SRV_MAX_DEPTH and all(
- c.base() == BaseName("srv_util_pathfree")
- for c in chain[-self.CONFIG_9P_SRV_MAX_DEPTH :]
- )
- return False
-
def _skipmodel__vfctprintf(
self, chain: typing.Sequence[QName], call: QName
) -> bool:
diff --git a/build-aux/valgrind b/build-aux/valgrind
new file mode 100755
index 0000000..7ad2712
--- /dev/null
+++ b/build-aux/valgrind
@@ -0,0 +1,16 @@
+#!/bin/env bash
+# build-aux/valgrind - Wrapper around valgrind to keep flags consistent
+#
+# Copyright (C) 2025 Luke T. Shumaker <lukeshu@lukeshu.com>
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+exec \
+ valgrind \
+ --fair-sched=yes \
+ --error-exitcode=2 \
+ --leak-check=full \
+ --show-leak-kinds=all \
+ --errors-for-leak-kinds=all \
+ --show-error-list=all \
+ -- \
+ "$@"