diff options
author | Ian Lewis <ianlewis@google.com> | 2021-01-21 20:09:32 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-01-21 20:11:53 -0800 |
commit | d02c03a268f98b471bcaf3afd99e61ddb161bfb4 (patch) | |
tree | dffaeb3c7a09a717a26eba1f92375411253de0cd /website/cmd/syscalldocs | |
parent | 9f46328e1174be6b8b5442467050ad0b2f0b260f (diff) |
Syscall docs update
- Moves the id to the <tr> 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
Diffstat (limited to 'website/cmd/syscalldocs')
-rw-r--r-- | website/cmd/syscalldocs/main.go | 33 |
1 files 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. </thead> <tbody> {{range $i, $syscall := .Syscalls}} - <tr> - <td><a class="doc-table-anchor" id="{{.Name}}"></a>{{.Number}}</td> - <td><a href="http://man7.org/linux/man-pages/man2/{{.Name}}.2.html" target="_blank" rel="noopener">{{.Name}}</a></td> + <tr id="{{.Name}}"> + <td><a href="#{{.Name}}">{{.Number}}</a></td> + <td><a href="{{.DocURL}}" target="_blank" rel="noopener">{{.Name}}</a></td> <td>{{.Support}}</td> <td>{{.Note}} {{range $i, $url := .URLs}}<br/>See: <a href="{{.}}">{{.}}</a>{{end}}</td> </tr> @@ -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, }) } |