Skip to content
Merged
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
203 changes: 203 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
# Basic .clang-format taken from FreeBSD
---
BasedOnStyle: WebKit
AlignAfterOpenBracket: DontAlign
AlignConsecutiveMacros: AcrossEmptyLines
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: false
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: TopLevelDefinitions
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: WebKit
BreakBeforeTernaryOperators: false
# TODO: BreakStringLiterals can cause very strange formatting so turn it off?
BreakStringLiterals: false
# Prefer:
# some_var = function(arg1,
# arg2)
# over:
# some_var =
# function(arg1, arg2)
PenaltyBreakAssignment: 100
# Prefer:
# some_long_function(arg1, arg2
# arg3)
# over:
# some_long_function(
# arg1, arg2, arg3)
PenaltyBreakBeforeFirstCallParameter: 100
CompactNamespaces: true
DerivePointerAlignment: false
DisableFormat: false
ForEachMacros:
- ARB_ARRFOREACH
- ARB_ARRFOREACH_REVWCOND
- ARB_ARRFOREACH_REVERSE
- ARB_FOREACH
- ARB_FOREACH_FROM
- ARB_FOREACH_SAFE
- ARB_FOREACH_REVERSE
- ARB_FOREACH_REVERSE_FROM
- ARB_FOREACH_REVERSE_SAFE
- BIT_FOREACH_ISCLR
- BIT_FOREACH_ISSET
- CPU_FOREACH
- CPU_FOREACH_ISCLR
- CPU_FOREACH_ISSET
- FOREACH_THREAD_IN_PROC
- FOREACH_PROC_IN_SYSTEM
- FOREACH_PRISON_CHILD
- FOREACH_PRISON_DESCENDANT
- FOREACH_PRISON_DESCENDANT_LOCKED
- FOREACH_PRISON_DESCENDANT_LOCKED_LEVEL
- MNT_VNODE_FOREACH_ALL
- MNT_VNODE_FOREACH_ACTIVE
- RB_FOREACH
- RB_FOREACH_FROM
- RB_FOREACH_SAFE
- RB_FOREACH_REVERSE
- RB_FOREACH_REVERSE_FROM
- RB_FOREACH_REVERSE_SAFE
- SLIST_FOREACH
- SLIST_FOREACH_FROM
- SLIST_FOREACH_FROM_SAFE
- SLIST_FOREACH_SAFE
- SLIST_FOREACH_PREVPTR
- SPLAY_FOREACH
- LIST_FOREACH
- LIST_FOREACH_FROM
- LIST_FOREACH_FROM_SAFE
- LIST_FOREACH_SAFE
- STAILQ_FOREACH
- STAILQ_FOREACH_FROM
- STAILQ_FOREACH_FROM_SAFE
- STAILQ_FOREACH_SAFE
- TAILQ_FOREACH
- TAILQ_FOREACH_FROM
- TAILQ_FOREACH_FROM_SAFE
- TAILQ_FOREACH_REVERSE
- TAILQ_FOREACH_REVERSE_FROM
- TAILQ_FOREACH_REVERSE_FROM_SAFE
- TAILQ_FOREACH_REVERSE_SAFE
- TAILQ_FOREACH_SAFE
- VM_MAP_ENTRY_FOREACH
- VM_PAGE_DUMP_FOREACH
SpaceBeforeParens: ControlStatementsExceptForEachMacros
IndentCaseLabels: false
IndentPPDirectives: None
Language: Cpp
NamespaceIndentation: None
PointerAlignment: Right
ContinuationIndentWidth: 4
IndentWidth: 8
TabWidth: 8
ColumnLimit: 80
UseTab: Always
SpaceAfterCStyleCast: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^\"opt_.*\.h\"'
Priority: 1
SortPriority: 10
- Regex: '^<sys/cdefs\.h>'
Priority: 2
SortPriority: 20
- Regex: '^<sys/types\.h>'
Priority: 2
SortPriority: 21
- Regex: '^<sys/param\.h>'
Priority: 2
SortPriority: 22
- Regex: '^<sys/systm\.h>'
Priority: 2
SortPriority: 23
- Regex: '^<sys.*/'
Priority: 2
SortPriority: 24
- Regex: '^<vm/vm\.h>'
Priority: 3
SortPriority: 30
- Regex: '^<vm/'
Priority: 3
SortPriority: 31
- Regex: '^<machine/'
Priority: 4
SortPriority: 40
- Regex: '^<(x86|amd64|i386|xen)/'
Priority: 5
SortPriority: 50
- Regex: '^<dev/'
Priority: 6
SortPriority: 60
# Most BSD require <netinet/in.h> before this ...
- Regex: '^<netinet/if_ether.h>'
Priority: 7
SortPriority: 71
- Regex: '^<net.*/'
Priority: 7
SortPriority: 70
- Regex: '^<protocols/'
Priority: 7
SortPriority: 72
- Regex: '^<(fs|nfs(|client|server)|ufs)/'
Priority: 8
SortPriority: 80
- Regex: '^<[^/].*\.h'
Priority: 9
SortPriority: 90
- Regex: '^\".*\.h\"'
Priority: 10
SortPriority: 100
# LLVM's header include ordering style is almost the exact opposite of ours.
# Unfortunately, they have hard-coded their preferences into clang-format.
# Clobbering this regular expression to avoid matching prevents non-system
# headers from being forcibly moved to the top of the include list.
# http://llvm.org/docs/CodingStandards.html#include-style
IncludeIsMainRegex: 'BLAH_DONT_MATCH_ANYTHING'
SortIncludes: true
KeepEmptyLinesAtTheStartOfBlocks: false
TypenameMacros:
- ARB_ELMTYPE
- ARB_HEAD
- ARB8_HEAD
- ARB16_HEAD
- ARB32_HEAD
- ARB_ENTRY
- ARB8_ENTRY
- ARB16_ENTRY
- ARB32_ENTRY
- LIST_CLASS_ENTRY
- LIST_CLASS_HEAD
- LIST_ENTRY
- LIST_HEAD
- QUEUE_TYPEOF
- RB_ENTRY
- RB_HEAD
- SLIST_CLASS_HEAD
- SLIST_CLASS_ENTRY
- SLIST_HEAD
- SLIST_ENTRY
- SMR_POINTER
- SPLAY_ENTRY
- SPLAY_HEAD
- STAILQ_CLASS_ENTRY
- STAILQ_CLASS_HEAD
- STAILQ_ENTRY
- STAILQ_HEAD
- TAILQ_CLASS_ENTRY
- TAILQ_CLASS_HEAD
- TAILQ_ENTRY
- TAILQ_HEAD
5 changes: 5 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Disable DeprecatedOrUnsafeBufferHandling - our use of these is fine
# and musl does not support the the _s variants.
# Disable valist due to clang-tidy bug fixed in v19?
Checks: "cert-*,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,-clang-analyzer-valist.Uninitialized"
HeaderFilterRegex: ".*"
6 changes: 3 additions & 3 deletions .clangd
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
If:
PathMatch: src/dev/.*\.c
CompileFlags:
Add: [-I.., -I../.., -I../../compat]
Add: [-I.., -I../.., -I../../compat, -I../../vendor]
---
If:
PathMatch: src/.*\.c
PathMatch: src/.*\.(c|h)
CompileFlags:
Add: [-I.., -I../compat]
Add: [-I.., -I../compat, -I../vendor]
---
CompileFlags:
Add: [-DINET, -DARP, -DARPING, -DIPV4LL, -DINET6, -DDHCP6, -DPLUGIN_DEV, -DAUTH, -DPRIVSEP]
164 changes: 83 additions & 81 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,84 +28,86 @@ jobs:
- name: Tests
run: make tests

openbsd:
runs-on: ubuntu-latest
steps:
- name: Bootstrap OpenBSD-latest
uses: mario-campos/emulate@v1
with:
operating-system: openbsd-latest

- name: Install Dependencies
run: pkg_add git

- name: Build
run: |
git clone --depth=1 "${{ github.server_url }}/${{ github.repository }}" build
cd build
[ "${{ github.event.pull_request.number }}" = "" ] || (echo "fetching PR ${{ github.event.pull_request.number }}"; git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }} && git checkout "pr-${{ github.event.pull_request.number }}")
./configure
make

- name: Tests
run: |
ulimit -n 1024
cd build
make tests

freebsd:
runs-on: ubuntu-latest
steps:
- name: Bootstrap FreeBSD-latest
uses: mario-campos/emulate@v1
with:
operating-system: freebsd-latest

- name: Install Dependencies
run: pkg install -y git

- name: Build
run: |
git clone --depth=1 "${{ github.server_url }}/${{ github.repository }}" build
cd build
[ "${{ github.event.pull_request.number }}" = "" ] || (echo "fetching PR ${{ github.event.pull_request.number }}"; git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }} && git checkout "pr-${{ github.event.pull_request.number }}")
./configure
make

- name: Tests
run: |
cd build
make tests

netbsd:
strategy:
matrix:
args:
-
- --disable-ipv4
- --disable-arp
- --disable-ipv4ll
- --disable-ipv6
- --disable-dhcp6
cppflags:
-
- -DSMALL
runs-on: ubuntu-latest
steps:
- name: Bootstrap NetBSD-latest
uses: mario-campos/emulate@v1
with:
operating-system: netbsd-latest

- name: Build
run: |
git clone --depth=1 "${{ github.server_url }}/${{ github.repository }}" build
cd build
[ "${{ github.event.pull_request.number }}" = "" ] || (echo "fetching PR ${{ github.event.pull_request.number }}"; git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }} && git checkout "pr-${{ github.event.pull_request.number }}")
CFLAGS=-Werror CPPFLAGS="${{ matrix.cppflags }}" ./configure ${{ matrix.args }}
make

- name: Tests
run: |
cd build
make tests
# Sadly the BSDs have stopped building ....

# openbsd:
# runs-on: ubuntu-latest
# steps:
# - name: Bootstrap OpenBSD-latest
# uses: mario-campos/emulate@v1
# with:
# operating-system: openbsd-latest

# - name: Install Dependencies
# run: pkg_add git

# - name: Build
# run: |
# git clone --depth=1 "${{ github.server_url }}/${{ github.repository }}" build
# cd build
# [ "${{ github.event.pull_request.number }}" = "" ] || (echo "fetching PR ${{ github.event.pull_request.number }}"; git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }} && git checkout "pr-${{ github.event.pull_request.number }}")
# ./configure
# make

# - name: Tests
# run: |
# ulimit -n 1024
# cd build
# make tests

# freebsd:
# runs-on: ubuntu-latest
# steps:
# - name: Bootstrap FreeBSD-latest
# uses: mario-campos/emulate@v1
# with:
# operating-system: freebsd-latest

# - name: Install Dependencies
# run: pkg install -y git

# - name: Build
# run: |
# git clone --depth=1 "${{ github.server_url }}/${{ github.repository }}" build
# cd build
# [ "${{ github.event.pull_request.number }}" = "" ] || (echo "fetching PR ${{ github.event.pull_request.number }}"; git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }} && git checkout "pr-${{ github.event.pull_request.number }}")
# ./configure
# make

# - name: Tests
# run: |
# cd build
# make tests

# netbsd:
# strategy:
# matrix:
# args:
# -
# - --disable-ipv4
# - --disable-arp
# - --disable-ipv4ll
# - --disable-ipv6
# - --disable-dhcp6
# cppflags:
# -
# - -DSMALL
# runs-on: ubuntu-latest
# steps:
# - name: Bootstrap NetBSD-latest
# uses: mario-campos/emulate@v1
# with:
# operating-system: netbsd-latest

# - name: Build
# run: |
# git clone --depth=1 "${{ github.server_url }}/${{ github.repository }}" build
# cd build
# [ "${{ github.event.pull_request.number }}" = "" ] || (echo "fetching PR ${{ github.event.pull_request.number }}"; git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }} && git checkout "pr-${{ github.event.pull_request.number }}")
# CFLAGS=-Werror CPPFLAGS="${{ matrix.cppflags }}" ./configure ${{ matrix.args }}
# make

# - name: Tests
# run: |
# cd build
# make tests
Comment on lines +31 to +113
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Re-enable BSD CI as non-blocking instead of fully commenting it out.

Commenting out openbsd, freebsd, and netbsd removes all BSD regression signal; from this point, BSD breakage can merge unnoticed. Keep these jobs runnable but non-blocking (continue-on-error: true) and/or move them to a scheduled/manual workflow if they’re currently flaky.

Suggested direction
+  openbsd:
+    continue-on-error: true
+    if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
+    runs-on: ubuntu-latest
+    steps:
+      # existing steps...

Apply the same pattern to freebsd and netbsd, and remove the large commented blocks once moved.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build.yml around lines 31 - 113, Uncomment and restore the
openbsd, freebsd, and netbsd jobs in the GitHub Actions workflow so BSD CI runs
again, but make them non-blocking by adding continue-on-error: true to each job
block (openbsd, freebsd, netbsd) or alternatively move them into a separate
scheduled/manual workflow; after doing this remove the large commented blocks
and ensure the existing job steps (Bootstrap, Install Dependencies, Build,
Tests) remain unchanged so the matrix/steps still execute.

Loading
Loading