From d02c03a268f98b471bcaf3afd99e61ddb161bfb4 Mon Sep 17 00:00:00 2001 From: Ian Lewis Date: Thu, 21 Jan 2021 20:09:32 -0800 Subject: Syscall docs update - Moves the id to the tag so that the page aligns properly when using an anchor. - Makes the syscall number a link to the anchor. - Fixes some broken links to syscalls without man pages. PiperOrigin-RevId: 353159903 --- website/cmd/syscalldocs/main.go | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/website/cmd/syscalldocs/main.go b/website/cmd/syscalldocs/main.go index 5e529aa56..830d2bac7 100644 --- a/website/cmd/syscalldocs/main.go +++ b/website/cmd/syscalldocs/main.go @@ -76,9 +76,9 @@ syscalls. {{if .Undocumented}}{{.Undocumented}} syscalls are not yet documented. {{range $i, $syscall := .Syscalls}} - - {{.Number}} - {{.Name}} + + {{.Number}} + {{.Name}} {{.Support}} {{.Note}} {{range $i, $url := .URLs}}
See: {{.}}{{end}} @@ -93,6 +93,27 @@ func Fatalf(format string, a ...interface{}) { os.Exit(1) } +// syscallDocURL returns a doc url for a given syscall, doing its best to return a url that exists. +func syscallDocURL(name string) string { + customDocs := map[string]string{ + "io_pgetevents": "https://man7.org/linux/man-pages/man2/syscalls.2.html", + "rseq": "https://man7.org/linux/man-pages/man2/syscalls.2.html", + "io_uring_setup": "https://manpages.debian.org/buster-backports/liburing-dev/io_uring_setup.2.en.html", + "io_uring_enter": "https://manpages.debian.org/buster-backports/liburing-dev/io_uring_enter.2.en.html", + "io_uring_register": "https://manpages.debian.org/buster-backports/liburing-dev/io_uring_register.2.en.html", + "open_tree": "https://man7.org/linux/man-pages/man2/syscalls.2.html", + "move_mount": "https://man7.org/linux/man-pages/man2/syscalls.2.html", + "fsopen": "https://man7.org/linux/man-pages/man2/syscalls.2.html", + "fsconfig": "https://man7.org/linux/man-pages/man2/syscalls.2.html", + "fsmount": "https://man7.org/linux/man-pages/man2/syscalls.2.html", + "fspick": "https://man7.org/linux/man-pages/man2/syscalls.2.html", + } + if url, ok := customDocs[name]; ok { + return url + } + return fmt.Sprintf("http://man7.org/linux/man-pages/man2/%s.2.html", name) +} + func main() { inputFlag := flag.String("in", "-", "File to input ('-' for stdin)") outputDir := flag.String("out", ".", "Directory to output files.") @@ -146,6 +167,7 @@ func main() { Syscalls []struct { Name string Number uintptr + DocURL string Support string Note string URLs []string @@ -162,6 +184,7 @@ func main() { Syscalls: []struct { Name string Number uintptr + DocURL string Support string Note string URLs []string @@ -188,14 +211,16 @@ func main() { data.Syscalls = append(data.Syscalls, struct { Name string Number uintptr + DocURL string Support string Note string URLs []string }{ Name: s.Name, Number: num, + DocURL: syscallDocURL(s.Name), Support: s.Support, - Note: s.Note, // TODO urls + Note: s.Note, URLs: s.URLs, }) } -- cgit v1.2.3