scripts/check-sysctl-docs

Source file repositories/reference/linux-study-clean/scripts/check-sysctl-docs

File Facts

System
Linux kernel
Corpus path
scripts/check-sysctl-docs
Extension
[no extension]
Size
4138 bytes
Lines
175
Domain
Support Tooling And Documentation
Bucket
scripts
Inferred role
Support Tooling And Documentation: scripts
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

function trimpunct(value) {
	while (value ~ /^["&]/) {
		value = substr(value, 2)
	}
	while (value ~ /[]["&,}]$/) {
		value = substr(value, 1, length(value) - 1)
	}
	return value
}

# Print the information for the given entry
function printentry(entry) {
	seen[entry]++
	printf "* %s from %s", entry, file[entry]
	if (documented[entry]) {
		printf " (documented)"
	}
	print ""
}


# Stage 1: build the list of documented entries
FNR == NR && /^=+$/ {
	for (i in skiplist) {
		if (prevline ~ skiplist[i]) {
			next
		}
	}

	# The previous line is a section title, parse it
	$0 = prevline
	if (debug) print "Parsing " $0
	inbrackets = 0
	for (i = 1; i <= NF; i++) {
		if (length($i) == 0) {
			continue
		}
		if (!inbrackets && substr($i, 1, 1) == "(") {
			inbrackets = 1
		}
		if (!inbrackets) {
			token = trimpunct($i)
			if (length(token) > 0 && token != "and") {
				if (debug) print trimpunct($i)
					documented[trimpunct($i)]++
			}
		}
		if (inbrackets && substr($i, length($i), 1) == ")") {
			inbrackets = 0
		}
	}
}

FNR == NR {
	prevline = $0
	next
}


# Stage 2: process each file and find all sysctl tables
BEGINFILE {
	delete entries
	curtable = ""
	curentry = ""
	delete vars
	if (debug) print "Processing file " FILENAME
}

/^static( const)? struct ctl_table/ {
	match($0, /static( const)? struct ctl_table ([^][]+)/, tables)

Annotation

Implementation Notes